Skip to content

Commit

Permalink
Merge pull request #14 from Toth-Technology/matlab
Browse files Browse the repository at this point in the history
Merging milestone 1 from Matlab to master.
  • Loading branch information
robtoth authored Sep 22, 2020
2 parents 77ccef3 + ac1394f commit fc48ee8
Show file tree
Hide file tree
Showing 35 changed files with 2,095 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .env-scripts/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
autopep8
mypy
jupyterlab
pylint
sphinx
sphinx-rtd-theme
recommonmark
twine
5 changes: 5 additions & 0 deletions .env-scripts/setup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python -m venv .env
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r .env-scripts/dev_requirements.txt
pip install -r requirements.txt
7 changes: 7 additions & 0 deletions .env-scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rm -r .env
python3 -m venv .env
source .env/bin/activate
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r .env-scripts/dev_requirements.txt
pip install -r requirements.txt
41 changes: 41 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Python package for pypi

on:
push:
tags:
- 'v*'

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r .env-scripts/dev_requirements.txt
pip install -r requirements.txt
- name: Package Dependencies
run: |
cd src
python setup.py sdist bdist_wheel
- name: List Environment variables
run: |
printenv
- name: Deploy package to test Pypi
env:
USERNAME: ${{ secrets.TWINE_PROD_USERNAME }}
PASSWORD: ${{ secrets.TWINE_PROD_PASSWORD }}
run: |
cd src
twine upload -r pypi -u $USERNAME -p $PASSWORD dist/*
38 changes: 38 additions & 0 deletions .github/workflows/testpypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Python package for testpypi

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r .env-scripts/dev_requirements.txt
pip install -r requirements.txt
- name: Package Dependencies
run: |
cd src
python setup.py sdist bdist_wheel
- name: List Environment variables
run: |
printenv
- name: Deploy package to test Pypi
env:
USERNAME: ${{ secrets.TWINE_TEST_USERNAME }}
PASSWORD: ${{ secrets.TWINE_TEST_PASSWORD }}
run: |
cd src
twine upload -r testpypi -u $USERNAME -p $PASSWORD dist/*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

*DS_Store
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": []
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": ".env/bin/python",
}
72 changes: 71 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,71 @@
# bric-morphology
# Getting started with topology radiomics

## Installing using pip

You can find our package on pypi

Run the below command to install the package:

```
pip install topology_radiomics
```

## Running with docker

First clone this repository

```
git clone https://github.com/radxtools/topology-radiomics.git
```

There are multiple ways to get started.

1. docker-compose
2. docker run

### docker-compose

Run the following commands to start the docker container

```
cd docker
docker-compose up
```

### docker run

With this step, you don't need to clone the url.
Run the following commands to start the docker container

```
docker rm radxtools/topology-radiomics-examples
docker pull radxtools/topology-radiomics-examples
docker run -d -p 3000:3000 --name topology-radiomics-examples radxtools/topology-radiomics-examples
```

## Tutorials

Once the docker image is up and running. You can view our notebooks. You can get started with the notebook to learn how to use the package. You should start with `Tutorial - Getting started with topology_radiomics.ipynb`

Tutorial Notebooks:

1. Tutorial - Getting started with topoplogy_radiomics.ipynb
2. Tutorial - Using topology_radiomics to visualize features.ipynb
3. Tutorial - Working with medpy and topology_radiomics.ipynb

The notebooks can be viewed by opening the browser and visting the url http://localhost:3000


# Contribution Guide:

Please follow google style formatting for [docstrings](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings)

## Bugs and Feature Request

Please submit bugs and features to our github page.


## Pull Requests
Create a issue on our board.
Create a pull request with your changes. Tag your changes with the issue number (commit message should have issue number).
Someone from the team will review your request and merge your changes for the next release.
6 changes: 6 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '2'
services:
app:
image: radxtools/topology-radiomics-examples:latest
ports:
- "3000:3000"
29 changes: 29 additions & 0 deletions docker/notebook.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# set base image (host OS)
FROM python:3.8

# install graphics libs
RUN apt-get update && apt-get install -y libglu1-mesa-dev freeglut3-dev mesa-common-dev

# set the working directory in the container
WORKDIR /notebooks

# copy the dependencies file to the working directory
COPY requirements.txt .
COPY .env-scripts/dev_requirements.txt .
COPY notebooks ./notebooks


# install dpendencies
RUN PIP_INSTALL="python -m pip install --upgrade --no-cache-dir --retries 10 --timeout 60" && \
$PIP_INSTALL -r dev_requirements.txt && \
$PIP_INSTALL install -r requirements.txt

COPY src ./src

# copy the content of the local src directory to the working directory
RUN cd src && python setup.py develop

# # command to run on container start
CMD [ "jupyter", "notebook", "--port=3000", "--no-browser", "--ip=0.0.0.0", "--allow-root", "--NotebookApp.token=" ]

EXPOSE 3000
52 changes: 52 additions & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
The below documentation explains how to create and run docker containers.

# Prerequisites:
Software Installation
1. Docker

# Build

This command will create the image using the file `docker/notebook.dockerfile` and will name the name image `notebook`

```sh
docker build -f docker/notebook.dockerfile -t notebook .
docker tag notebook radxtools/topology-radiomics-examples
```

# Run

This command will create a container called `topology-radiomics-examples` that will start the image `notebook`

```sh
docker rm topology-radiomics-examples
docker run -d -p 3000:3000 --name topology-radiomics-examples notebook
```

# Compose

```sh
cd docker
docker-compose up
```

# Pushing to Docker Repo

The docker repo can be found [here](https://hub.docker.com/repository/docker/radxtools/topology-radiomics-examples)

```sh
docker login
>>username
>>password
docker tag notebook radxtools/topology-radiomics-examples
docker push radxtools/topology-radiomics-examples:latest
```

# Debugging the docker build

If the app is already running, we can open a shell using the following command.

```
docker exec -it topology-radiomics-examples /bin/bash
```

This will create a shell. You can use this shell to troubleshoot other things like installed packages, file system paths and etc...
42 changes: 42 additions & 0 deletions docs/sphinx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
This article discusses how to build documentation for this project using sphinx.


# Generating Source Files

The following command will create the source documentation files

```
cd src
sphinx-apidoc -o docs/source topology_radiomics
```

# Building the docs

## Method 1

We can build using the setup utils.

```
python setup.py build_sphinx
```

## Method 2

We can build using the sphinx cli

```
cd docs
make html
```

# Notes

More information can be found here:

* [Python Docstring guide](https://google.github.io/styleguide/pyguide)

* [Napolean Guide](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/index.html)

* [sphinx-apidoc guide](https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html#sphinx-apidoc-manual-page)

* [Blog post on getting started with sphnix](https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs)
Loading

0 comments on commit fc48ee8

Please sign in to comment.