Skip to content

Commit

Permalink
Merge pull request #159 from pyplati/dockerfile-corrections
Browse files Browse the repository at this point in the history
Dockerfile corrections
  • Loading branch information
pchlap authored Oct 4, 2022
2 parents 3efebb5 + 3cf372a commit 0c212b1
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: service.Dockerfile
file: dev.Dockerfile
platforms: linux/amd64
push: true
tags: |
Expand Down
88 changes: 43 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Release

on:
Expand All @@ -10,49 +9,48 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python - --version 1.2.0rc1
poetry install --with dev,docs --all-extras
echo "PYTHONPATH=`pwd`" >> $GITHUB_ENV
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
PLACEHOLDER='__version__ = "develop"'
VERSION_FILE='platipy/__init__.py'
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
shell: bash
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python - --version 1.2.1
poetry install --with dev,docs --all-extras
echo "PYTHONPATH=`pwd`" >> $GITHUB_ENV
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
VERSION_PLACEHOLDER='__version__ = "0.0.0"'
VERSION_FILE='platipy/__init__.py'
grep "$VERSION_PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$VERSION_PLACEHOLDER/__version__ = \"${VERSION}\"/g" 'platipy/__init__.py'
PYPROJECT_PLACEHOLDER='version = "0.0.0"'
PYPROJECT_FILE='pyproject.toml'
grep "$PYPROJECT_PLACEHOLDER" "$PYPROJECT_FILE"
sed -i "s/$PYPROJECT_PLACEHOLDER/version = \"${VERSION}\"/g" "$PYPROJECT_FILE"
shell: bash

- name: Build package
run: |
pip install setuptools wheel
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Build docs
run: |
sudo apt-get update -y && sudo apt-get install -y pandoc
poetry run sphinx-build -b html -a docs docs/site
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/site
- name: Build & publish package
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry build
poetry publish
- name: Build docs
run: |
sudo apt-get update -y && sudo apt-get install -y pandoc
poetry run sphinx-build -b html -a docs docs/site
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/site

- name: Build docker
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: pyplati/platipy
event-type: docker
- name: Build docker
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: pyplati/platipy
event-type: docker
16 changes: 12 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@ request](https://github.com/pyplati/platipy/compare) to merge your changes into
(**master**). At this point the automated tests will run and maintainers will review your
submission before merging.

## Example Installation
## Poetry

To install a development environment run the following within a virtual environment:
platipy uses poetry to manage dependencies. Instructions for installing poetry are available
[here](https://python-poetry.org/docs/#installation). Once installed, you can easily install the
libraries required to develop for platipy using the following command:

```bash
pip install -r requirements.txt -r requirements-dev.txt -r requirements-backend.txt
pip install -e .
poetry install --with dev --all-extras
```

This will automatically create a virtual environment managed by poetry. To run a script within this
environment, use the `poetry run` followed by what to run. For example, to run a test.py script:

```bash
poetry run python test.py
```

## Style Guide
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,22 @@ fig = vis.show()
![Figure 3](assets/figure_3.png)

## Getting started
There aren't many requirements, just an installed Python interpreter (3.6 or greater). The list of
required Python packages can be found in requirements.txt.

PlatiPy can be installed with **pip**:
There aren't many requirements, just an installed Python interpreter (3.7 or greater). PlatiPy can
be installed with **pip**:

```bash
pip install platipy
```

The base installation of platipy does not include some large libraries needed for various
components of platipy. The following extras are available to install to run specific platipy tools:

```bash
pip install platipy[cardiac]
pip install platipy[nnunet]
pip install platipy[backend]
```

## Authors

* **Phillip Chlap** - [[email protected]]([email protected])
Expand Down
7 changes: 7 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ PlatiPy is available from the Python package repositories and can be installed w

``pip install platipy``

The base installation of platipy does not include some large libraries needed for various
components of platipy. The following extras are available to install to run specific platipy tools:

``pip install platipy[cardiac]``
``pip install platipy[nnunet]``
``pip install platipy[backend]``

If you have already installed the library, you can install the latest updates using:

``pip install --upgrade platipy``
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ nbsphinx = "^0.8.9"
m2r2 = "^0.3.3"
Jinja2 = "^3.1"

[tool.poetry-dynamic-versioning]
enable = true

[build-system]
requires = ["poetry-core>=1.1.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.core.masonry.api"
2 changes: 1 addition & 1 deletion services/nnunet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM platipy/platipy:service

RUN env -C /platipy /root/.local/bin/poetry install --E backend,nnunet
RUN env -C /platipy /root/.local/bin/poetry install -E backend,nnunet

COPY ./nnUNetTrainerHeart.py /usr/lib/python3.8/site-packages/nnunet/training/network_training/nnUNetTrainerHeart.py

Expand Down

0 comments on commit 0c212b1

Please sign in to comment.