Skip to content

Commit

Permalink
Upgrade DeepCell to 0.9.2 and set up CI/CD workflows (#14)
Browse files Browse the repository at this point in the history
* Update `.gitignore` and `.dockerignore` and add several other repository config files

* Update default deepcell version to 0.9.2.

* Rename `main.py` to `run_app.py`

* Refactor `MultiplexSegmentation` to `Mesmer`

* Import `get_image` from `deepcell.utils.io_utils` (Fixes #12)

* Add GitHub Actions workflows from `vanvalenlab/deepcell-tf`

* Replace `skimage` with `tifffile`

* New `deepcell_applications` for application-generalized functions

* Refactor mpp to image_mpp to match mesmer signature.

* Pin the `deepcell` version to prevent breaking changes.

* Update README with new parameters

* Refactor `get_arg_parser` for application-based subparsers.

* Add badges to README

* Add batch_size as a possible inference value.

Co-authored-by: Noah F. Greenwald <noahfgreenwald@gmail.com>
  • Loading branch information
willgraf and ngreenwald committed Aug 12, 2021
1 parent 4f71fb2 commit f65bb8e
Show file tree
Hide file tree
Showing 24 changed files with 1,546 additions and 186 deletions.
16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# .coveragerc to control coverage.py
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
except ImportError

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

ignore_errors = True
fail_under = 50
show_missing = True

omit =
**/*_test.py
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Deepcell Specific ###
lib_dormant
app_dormant
output/

### Development config files ###
.pylintrc
Expand Down Expand Up @@ -55,6 +56,7 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
Expand Down Expand Up @@ -88,3 +90,6 @@ target/
venv/
ENV/
env/

# IDEs
.vscode/
33 changes: 33 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
55 changes: 55 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name-template: '$RESOLVED_VERSION'

tag-template: '$RESOLVED_VERSION'

version-template: '$MAJOR.$MINOR.$PATCH'

categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- 'hotfix'
- title: '🧰 Maintenance'
labels:
- 'chore'
- title: '📚️ Documentation'
labels:
- 'documentation'

change-template: |
<details>
<summary>$TITLE @$AUTHOR (#$NUMBER)</summary>
$BODY
</details>
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.

version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
- 'enhancement'
patch:
labels:
- 'auto-update'
- 'patch'
- 'fix'
- 'bugfix'
- 'bug'
- 'hotfix'
- 'packages'
- 'documentation'
default: minor

template: |
$CHANGES
61 changes: 61 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build & Push Docker Image

on:
release:
types: [published]

jobs:

docker:

runs-on: ubuntu-latest

env:
DEEPCELL_VERSION: 0.9.1

steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push CPU Image
id: docker_build_cpu
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ github.event.release.tag_name }}
build-args: |
DEEPCELL_VERSION=${{ env.DEEPCELL_VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build_cpu.outputs.digest }}

- name: Build and push GPU Image
id: docker_build_gpu
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ github.repository }}:latest-gpu
${{ github.repository }}:${{ github.event.release.tag_name }}-gpu
build-args: |
DEEPCELL_VERSION=${{ env.DEEPCELL_VERSION }}-gpu
- name: Image digest
run: echo ${{ steps.docker_build_gpu.outputs.digest }}
25 changes: 25 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68 changes: 68 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build

on: [push, pull_request]

jobs:

tests:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6, 3.7, 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: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: PyTest
run: |
pytest deepcell_applications --cov deepcell_applications --pep8
- name: Coveralls
if: env.COVERALLS_REPO_TOKEN != null
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
run: |
coveralls
coveralls:
name: Finish Coveralls
needs: tests
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
if: env.COVERALLS_REPO_TOKEN != null
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# VSCode settings
.vscode/
Loading

0 comments on commit f65bb8e

Please sign in to comment.