-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use pyproject.toml instead of setup.py (including dev, docs, test dependencies installed in normal fashion with pip install .[dev]) - CI testing for all OSes and python 3.8-3.11 (more strict on warnings except deprecation) - Add pre-commit - Add codecoverage (runs locally, we will see how it looks on the repo) - Use hatch build system instead of setuptools (need to test automatic version setting) - Add outlines for readme and contributor guide
- Loading branch information
Showing
6 changed files
with
271 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,37 @@ | ||
name: Test | ||
|
||
on: [push, pull_request] | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.platform }} py${{ matrix.python-version }} | ||
runs-on: ${{ matrix.platform }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.10","3.11"] | ||
platform: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
|
||
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: | | ||
pip install . | ||
pip install -r requirements-dev.txt | ||
- name: Test with pytest | ||
run: | | ||
pytest tests | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e . | ||
pip install -r requirements-dev.txt | ||
- name: Test | ||
run: pytest tests -s -v --color=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
ci: | ||
autoupdate_schedule: monthly | ||
autofix_commit_msg: "style(pre-commit.ci): auto fixes [...]" | ||
autoupdate_commit_msg: "ci(pre-commit.ci): autoupdate" | ||
|
||
default_install_hook_types: [pre-commit, commit-msg] | ||
|
||
repos: | ||
# - repo: https://github.com/compilerla/conventional-pre-commit | ||
# rev: v2.1.1 | ||
# hooks: | ||
# - id: conventional-pre-commit | ||
# stages: [commit-msg] | ||
|
||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.2.1 | ||
hooks: | ||
- id: ruff | ||
args: [--fix] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.2.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/abravalheri/validate-pyproject | ||
rev: v0.16 | ||
hooks: | ||
- id: validate-pyproject | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.8.0 | ||
hooks: | ||
- id: mypy | ||
files: "^src/" | ||
# # you have to add the things you want to type check against here | ||
# additional_dependencies: | ||
# - numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Contributor Guide | ||
|
||
## Development Installation | ||
- currently, pip install -r requirements-dev.txt | ||
and then pip install -e . | ||
TODO: set up pip install -e .[dev] | ||
|
||
## Style and Pre-Commit | ||
- TODO: pre-commit with black mypy | ||
- do use ruff and black | ||
- do have typing, developers should supply types | ||
|
||
## Testing | ||
- Unittest your functions | ||
- Pytest run automatically on PR, and so is codcov (maybe) | ||
TODO: codecov | ||
|
||
|
||
## Branching and PRs | ||
- Users that have been added to the CellMap organization and the DaCapo project should be able to develop directly into the CellMap fork of DaCapo. Other users will need to create a fork. | ||
- For a completely new feature, make a branch off of the `main` branch of CellMap's fork of DaCapo with a name describing the feature. If you are collaborating on a feature that already has a branch, you can branch off that feature branch. | ||
- Currently, you should make your PRs into the main branch of CellMap's fork, or the feature branch you branched off of. Once the PR is merged, the feature branch should be deleted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,25 @@ on arbitrarily large volumes of | |
multi-dimensional images. `dacapo` is not tied to a particular learning | ||
framework, but currently only supports [`torch`](https://pytorch.org/) with | ||
plans to support [`tensorflow`](https://www.tensorflow.org/). | ||
|
||
## Installation and Setup | ||
Currently, only python 3.10 is supported. We recommend creating a new conda environment for dacapo with python 3.10. | ||
``` | ||
conda create -n dacapo python=3.10 | ||
``` | ||
|
||
Then clone this repository, go into the directory, and install: | ||
``` | ||
git clone [email protected]:janelia-cellmap/dacapo.git | ||
cd dacapo | ||
pip install . | ||
``` | ||
This will install the minimum required dependencies. However, having acess to a MongoDB server for storing outputs is strongly recommended for smoothest performance. | ||
|
||
To install and run MongoDB locally, refer to the MongoDB documentation [here](https://www.mongodb.com/docs/manual/installation/). | ||
|
||
## Functionality Overview | ||
|
||
Tasks we support | ||
|
||
Networks we have for those tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
# https://peps.python.org/pep-0517/ | ||
[build-system] | ||
requires = ["hatchling", "hatch-vcs"] | ||
build-backend = "hatchling.build" | ||
|
||
# https://peps.python.org/pep-0621/ | ||
[project] | ||
name = "dacapo-ml" | ||
description = "Framework for easy composition of volumetric machine learning jobs." | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
# license = { text = "BSD 3-Clause License" } | ||
authors = [ | ||
{ email = "[email protected]", name = "Jeff Rhoades" }, | ||
{ email = "[email protected]", name = "Will Patton" }, | ||
{ email = "[email protected]", name = "Marwan Zouinkhi" }, | ||
{ email = "[email protected]", name = "Jan Funke" }, | ||
] | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"License :: OSI Approved :: BSD License", | ||
"Natural Language :: English", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Typing :: Typed", | ||
] | ||
dynamic = ["version"] | ||
dependencies = [ | ||
"numpy==1.22.3", | ||
"pyyaml", | ||
"zarr", | ||
"cattrs", | ||
"pymongo", | ||
"tqdm", | ||
"simpleitk", | ||
"lazy-property", | ||
"neuroglancer", | ||
"torch", | ||
"fibsem_tools", | ||
"attrs", | ||
"bokeh", | ||
"numpy-indexed>=0.3.7", | ||
"daisy>=1.0", | ||
"funlib.math>=0.1", | ||
"funlib.geometry>=0.2", | ||
"mwatershed>=0.1", | ||
"funlib.persistence @ git+https://github.com/janelia-cellmap/funlib.persistence", | ||
"funlib.evaluate @ git+https://github.com/pattonw/funlib.evaluate", | ||
"gunpowder>=1.3", | ||
# "lsds>=0.1.3", | ||
"lsds @ git+https://github.com/funkelab/lsd", | ||
"xarray", | ||
"cattrs", | ||
"numpy-indexed", | ||
"click",] | ||
|
||
# extras | ||
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies | ||
[project.optional-dependencies] | ||
test = ["pytest==7.4.4", "pytest-cov", "pytest-lazy-fixture"] | ||
dev = [ | ||
"black", | ||
"ipython", | ||
"mypy", | ||
"pdbpp", | ||
"rich", | ||
"ruff", | ||
] | ||
docs = [ | ||
"sphinx-autodoc-typehints", | ||
"sphinx-material", | ||
] | ||
|
||
[project.urls] | ||
homepage = "https://github.com/janelia-cellmap/dacapo" | ||
repository = "https://github.com/janelia-cellmap/dacapo" | ||
|
||
# https://hatch.pypa.io/latest/config/metadata/ | ||
[tool.hatch.version] | ||
source = "vcs" | ||
|
||
# https://hatch.pypa.io/latest/config/build/#file-selection | ||
# [tool.hatch.build.targets.sdist] | ||
# include = ["/src", "/tests"] | ||
[tool.hatch.metadata] | ||
allow-direct-references = true | ||
|
||
[tool.hatch.build.targets.wheel] | ||
only-include = ["dacapo"] | ||
sources = ["dacapo"] | ||
|
||
# https://github.com/charliermarsh/ruff | ||
[tool.ruff] | ||
line-length = 88 | ||
target-version = "py38" | ||
src = ["dacapo"] | ||
# https://beta.ruff.rs/docs/rules/ | ||
select = [ | ||
"E", # style errors | ||
"W", # style warnings | ||
"F", # flakes | ||
"D", # pydocstyle | ||
"I", # isort | ||
"UP", # pyupgrade | ||
"C4", # flake8-comprehensions | ||
"B", # flake8-bugbear | ||
"A001", # flake8-builtins | ||
"RUF", # ruff-specific rules | ||
] | ||
|
||
[tool.ruff.per-file-ignores] | ||
"tests/*.py" = ["D", "S"] | ||
|
||
# https://docs.pytest.org/en/6.2.x/customize.html | ||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
testpaths = ["tests"] | ||
filterwarnings = [ | ||
"error", | ||
"ignore::DeprecationWarning", | ||
] | ||
|
||
|
||
# https://mypy.readthedocs.io/en/stable/config_file.html | ||
[tool.mypy] | ||
files = "dacapo/**/" | ||
strict = true | ||
disallow_any_generics = false | ||
disallow_subclassing_any = false | ||
show_error_codes = true | ||
pretty = true | ||
|
||
# # module specific overrides | ||
# [[tool.mypy.overrides]] | ||
# module = ["numpy.*",] | ||
# ignore_errors = true | ||
|
||
|
||
# https://coverage.readthedocs.io/en/6.4/config.html | ||
[tool.coverage.report] | ||
exclude_lines = [ | ||
"pragma: no cover", | ||
"if TYPE_CHECKING:", | ||
"@overload", | ||
"except ImportError", | ||
"\\.\\.\\.", | ||
"raise NotImplementedError()", | ||
] | ||
[tool.coverage.run] | ||
source = ["dacapo"] | ||
|
||
# https://github.com/mgedmin/check-manifest#configuration | ||
[tool.check-manifest] | ||
ignore = [ | ||
".github_changelog_generator", | ||
".pre-commit-config.yaml", | ||
".ruff_cache/**/*", | ||
"tests/**/*", | ||
] |