diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 97e21aef8..d8ddb2e06 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,9 +1,6 @@ name: Generate Pages on: - pull_request: - branches: - - main push: branches: - main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 169439dd2..2c3cf6f0d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,14 +3,9 @@ ci: 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] +default_install_hook_types: [pre-commit] 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 @@ -32,7 +27,7 @@ repos: rev: v1.8.0 hooks: - id: mypy - files: "^src/" + files: "^dacapo/" # # you have to add the things you want to type check against here # additional_dependencies: # - numpy diff --git a/CONTRIBUTOR.md b/CONTRIBUTOR.md index a6c0c11c1..5e37cb8d5 100644 --- a/CONTRIBUTOR.md +++ b/CONTRIBUTOR.md @@ -1,22 +1,27 @@ # Contributor Guide ## Development Installation -- currently, pip install -r requirements-dev.txt -and then pip install -e . -TODO: set up pip install -e .[dev] +`pip install -e .[dev,test]` ## Style and Pre-Commit -- TODO: pre-commit with black mypy -- do use ruff and black -- do have typing, developers should supply types +To set up pre-commit: +``` +pre-commit autoupdate +pre-commit install +``` +Then any time you write a commit, it will run ruff, black, mypy, and validate the pyproject.toml. +To skip the pre-commit step, use: +`git commit --no-verify` + +Ruff, black, and mypy settings are specified in the pyproject.toml. Currently they are not very strict, but this may change in the future. ## Testing -- Unittest your functions -- Pytest run automatically on PR, and so is codcov (maybe) -TODO: codecov +To run tests with coverage locally: +`pytest tests --color=yes --cov --cov-report=term-missing` +This will also be run automatically when a PR is made to master and a codecov report will be generated telling you if your PR increased or decreased coverage. ## 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. +- Currently, you should make your PRs into the main branch of CellMap's fork, or the feature branch you branched off of. PRs currently require one maintainer's approval before merging. Once the PR is merged, the feature branch should be deleted. diff --git a/Makefile b/Makefile index 76daeb22e..d931a643d 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,7 @@ default: pip install . install-dev: - pip install -e . - pip install --upgrade -r requirements-dev.txt + pip install -e ".[dev]" .PHONY: tests tests: diff --git a/README.md b/README.md index ae2f95e5e..3f1561d40 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ 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. +Currently, 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 ``` @@ -30,12 +30,16 @@ git clone git@github.com: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. +This will install the minimum required dependencies. However, having access 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 +Tasks we support and approaches for those tasks: + - Instance Segmentation + - Affinities + - Local Shape Descriptors + - Semantic segmentation + - Signed distances + - One-hot encoding of different types of objects diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index aadc732e4..000000000 --- a/mypy.ini +++ /dev/null @@ -1,74 +0,0 @@ -# Global options: - -[mypy] - -# Per-module options: - -[mypy-funlib.*] -ignore_missing_imports = True - -[mypy-gunpowder.*] -ignore_missing_imports = True - -[mypy-scipy.*] -ignore_missing_imports = True - -[mypy-augment.*] -ignore_missing_imports = True - -[mypy-tifffile.*] -ignore_missing_imports = True - -[mypy-daisy.*] -ignore_missing_imports = True - -[mypy-lazy_property.*] -ignore_missing_imports = True - -[mypy-skimage.*] -ignore_missing_imports = True - -[mypy-fibsem_tools.*] -ignore_missing_imports = True - -[mypy-neuroglancer.*] -ignore_missing_imports = True - -[mypy-tqdm.*] -ignore_missing_imports = True - -[mypy-zarr.*] -ignore_missing_imports = True - -[mypy-pymongo.*] -ignore_missing_imports = True - -[mypy-bson.*] -ignore_missing_imports = True - -[mypy-affogato.*] -ignore_missing_imports = True - -[mypy-SimpleITK.*] -ignore_missing_imports = True - -[mypy-bokeh.*] -ignore_missing_imports = True - -[mypy-lsd.*] -ignore_missing_imports = True - -[mypy-yaml.*] -ignore_missing_imports = True - -[mypy-pytest_lazyfixture.*] -ignore_missing_imports = True - -[mypy-neuclease.dvid.*] -ignore_missing_imports = True - -[mypy-mwatershed.*] -ignore_missing_imports = True - -[mypy-numpy_indexed.*] -ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index 1b9d716a2..21512e15b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ dev = [ "rich", "ruff", "pre-commit", + "jupyter", ] docs = [ "sphinx-autodoc-typehints", @@ -103,22 +104,27 @@ dacapo = "dacapo.cli:cli" line-length = 88 target-version = "py310" src = ["dacapo"] + +[tool.ruff.lint] # https://beta.ruff.rs/docs/rules/ +# We may want to enable some of these options later select = [ "E", # style errors - "W", # style warnings +# "W", # style warnings "F", # flakes - "D", # pydocstyle - "I", # isort - "UP", # pyupgrade - "C4", # flake8-comprehensions - "B", # flake8-bugbear - "A001", # flake8-builtins - "RUF", # ruff-specific rules +# "D", # pydocstyle +# "I", # isort +# "UP", # pyupgrade +# "C4", # flake8-comprehensions +# "B", # flake8-bugbear +# "A001", # flake8-builtins +# "RUF", # ruff-specific rules ] +extend-ignore = ["E501"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/*.py" = ["D", "S"] +"__init__.py" = ["F401"] # https://docs.pytest.org/en/6.2.x/customize.html [tool.pytest.ini_options] @@ -129,20 +135,85 @@ filterwarnings = [ "ignore::DeprecationWarning", ] - # https://mypy.readthedocs.io/en/stable/config_file.html [tool.mypy] files = "dacapo/**/" -strict = true +strict = false 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 +[[tool.mypy.overrides]] +module = ["funlib.*",] +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = ["gunpowder.*"] +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "scipy.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "augment.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module="tifffile.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "daisy.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "lazy_property.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "skimage.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "fibsem_tools.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "neuroglancer.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "tqdm.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "zarr.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "pymongo.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "bson.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "affogato.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "SimpleITK.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "bokeh.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "lsd.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "yaml.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "pytest_lazyfixture.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "neuclease.dvid.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "mwatershed.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "numpy_indexed.*" +ignore_missing_imports = true # https://coverage.readthedocs.io/en/6.4/config.html diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 12afa83a4..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -black -mypy -pytest==7.4.4 -pytest-cov -pytest-lazy-fixture \ No newline at end of file diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index 7193df3e7..000000000 --- a/ruff.toml +++ /dev/null @@ -1,3 +0,0 @@ -extend-ignore = ["E501"] -[per-file-ignores] -"__init__.py" = ["F401"] \ No newline at end of file