This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maint: migrate to PEP517/518 packaging
- Loading branch information
Showing
9 changed files
with
250 additions
and
166 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
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
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,44 @@ | ||
#!/usr/bin/env python3 | ||
from copy import copy | ||
from pathlib import Path | ||
from packaging.requirements import Requirement, SpecifierSet | ||
|
||
try: | ||
from tomllib import loads # Python +3.11 | ||
except ImportError: | ||
from pip._vendor.tomli import loads | ||
|
||
repo_root = Path(__file__).parent.parent | ||
pyproject = repo_root / "pyproject.toml" | ||
reqs = repo_root / "requirements.txt" | ||
min_reqs = repo_root / "min-requirements.txt" | ||
|
||
requirements = [ | ||
Requirement(req) | ||
for req in loads(pyproject.read_text())["project"]["dependencies"] | ||
] | ||
|
||
script_name = Path(__file__).relative_to(repo_root) | ||
|
||
|
||
def to_min(req): | ||
if req.specifier: | ||
req = copy(req) | ||
try: | ||
min_spec = [spec for spec in req.specifier if spec.operator in (">=", "~=")][0] | ||
except IndexError: | ||
return req | ||
min_spec._spec = ("==",) + min_spec._spec[1:] | ||
req.specifier = SpecifierSet(str(min_spec)) | ||
return req | ||
|
||
|
||
lines = [f"# Auto-generated by {script_name}", ""] | ||
|
||
# Write requirements | ||
lines[1:-1] = [str(req) for req in requirements] | ||
reqs.write_text("\n".join(lines)) | ||
|
||
# Write minimum requirements | ||
lines[1:-1] = [str(to_min(req)) for req in requirements] | ||
min_reqs.write_text("\n".join(lines)) |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
# Auto-generated by .maint/update_requirements.py | ||
dipy==1.3.0 | ||
joblib | ||
nipype==1.5.1 | ||
nitransforms==21.0.0 | ||
nireports | ||
numpy==1.17.3 | ||
nest-asyncio==1.5.1 | ||
scikit-image==0.14.2 | ||
scipy==1.8.0 |
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,15 +1,181 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools >= 45", | ||
"setuptools_scm[toml] >= 6.2", | ||
"wheel" | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
write_to = "src/eddymotion/_version.py" | ||
write_to_template = """\ | ||
\"\"\"Version file, automatically generated by setuptools_scm.\"\"\" | ||
__version__ = "{version}" | ||
""" | ||
fallback_version = "0.0" | ||
requires = ["hatchling", "hatch-vcs", "nipreps-versions"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "eddymotion" | ||
description = "Pure python eddy-current and head-motion correction for dMRI, an extension of QSIprep's SHOREline algorithm (Cieslak, 2020) to multiple diffusion models." | ||
readme = "README.rst" | ||
authors = [{name = "The NiPreps Developers", email = "[email protected]"}] | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering :: Image Recognition", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
] | ||
license = "Apache-2.0" | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"dipy>=1.3.0", | ||
"joblib", | ||
"nipype>= 1.5.1, < 2.0", | ||
"nitransforms>=21.0.0", | ||
"nireports", | ||
"numpy>=1.17.3", | ||
"nest-asyncio>=1.5.1", | ||
"scikit-image>=0.14.2", | ||
"scipy>=1.8.0", | ||
] | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
Documentation = "https://www.nipreps.org/eddymotion" | ||
Home = "https://github.com/nipreps/eddymotion" | ||
NiPreps = "https://www.nipreps.org/" | ||
|
||
[project.optional-dependencies] | ||
doc = [ | ||
"nbsphinx", | ||
"packaging", | ||
"pydot >= 1.2.3", | ||
"pydotplus", | ||
"sphinx >= 2.1.2", | ||
"sphinx-argparse", | ||
"sphinx_rtd_theme", | ||
"sphinxcontrib-apidoc ~= 0.3.0", | ||
"sphinxcontrib-napoleon", | ||
"sphinxcontrib-versioning" | ||
] | ||
|
||
dev = [ | ||
"black~=22.3", | ||
"flake8~=4.0", | ||
"isort~=5.10", | ||
"pre-commit", | ||
"pre-commit-hooks", | ||
] | ||
|
||
plotting = ["nilearn"] | ||
|
||
resmon = ["psutil >=5.4"] | ||
|
||
popylar = ["popylar >= 0.2"] | ||
|
||
test = [ | ||
"coverage", | ||
"pytest >= 4.4", | ||
"pytest-cov", | ||
"pytest-env", | ||
"pytest-xdist >= 1.28" | ||
] | ||
|
||
# Aliases | ||
docs = ["eddymotion[doc]"] | ||
tests = ["eddymotion[test]"] | ||
all = ["eddymotion[doc,test,dev,plotting,resmon,popylar]"] | ||
|
||
[project.scripts] | ||
sdcflows-find-estimators = "sdcflows.cli.find_estimators:main" | ||
|
||
# | ||
# Hatch configurations | ||
# | ||
|
||
[tool.hatch.metadata] | ||
allow-direct-references = true | ||
|
||
[tool.hatch.build.targets.sdist] | ||
exclude = [".git_archival.txt"] # No longer needed in sdist | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["eddymotion"] | ||
# exclude = [ | ||
# "sdcflows/tests/data", # Large test data directory | ||
# ] | ||
|
||
|
||
[tool.hatch.version] | ||
validate-bump = true | ||
source = "vcs" | ||
raw-options = { version_scheme = "nipreps-calver" } | ||
|
||
[tool.hatch.build.hooks.vcs] | ||
version-file = "src/eddymotion/_version.py" | ||
|
||
# | ||
# Developer tool configurations | ||
# | ||
|
||
[tool.black] | ||
line-length = 99 | ||
target-version = ['py39'] | ||
skip-string-normalization = true | ||
exclude = ''' | ||
# Directories | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.venv | ||
| venv | ||
| _build | ||
| build | ||
| dist | ||
)/ | ||
''' | ||
|
||
[tool.isort] | ||
profile = 'black' | ||
skip_gitignore = true | ||
|
||
[tool.flake8] | ||
max-line-length = 99 | ||
doctests = false | ||
exclude = ["*build/", "docs/"] | ||
select = "C,E,F,W,B,B950" | ||
ignore = "N802,N806,W503,E203" | ||
per-file-ignores = [ | ||
"*/__init__.py: F401", | ||
"docs/conf.py: E265", | ||
"/^\\s*\\.\\. _.*?: http/: E501" | ||
] | ||
|
||
[tool.pytest.ini_options] | ||
pythonpath = "src/ test/" | ||
norecursedirs = [".*", "_*"] | ||
addopts = "-v --doctest-modules" | ||
doctest_optionflags = "ALLOW_UNICODE NORMALIZE_WHITESPACE" | ||
env = "PYTHONHASHSEED=0" | ||
filterwarnings = ["ignore::DeprecationWarning"] | ||
|
||
|
||
[tool.coverage.run] | ||
branch = true | ||
concurrency = 'multiprocessing' | ||
omit = [ | ||
'*/tests/*', | ||
'*/__init__.py', | ||
'*/conftest.py', | ||
'eddymotion/_version.py' | ||
] | ||
|
||
[tool.coverage.report] | ||
# Regexes for lines to exclude from consideration | ||
exclude_lines = [ | ||
'raise NotImplementedError', | ||
'warnings\.warn', | ||
] | ||
|
||
[tool.codespell] | ||
# nd - import scipy.ndimage as nd | ||
# mapp, reson -- Mapp. and Reson. abbreviations in citation | ||
ignore-words-list = 'nd,mapp,reson' | ||
skip = """ | ||
./.git,*.pdf,*.svg,*.min.js,*.ipynb,ORIGINAL_LICENSE,\ | ||
./docs/source/_static/example_anatreport.html""" |
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,10 @@ | ||
# Auto-generated by .maint/update_requirements.py | ||
dipy>=1.3.0 | ||
joblib | ||
nipype<2.0,>=1.5.1 | ||
nitransforms>=21.0.0 | ||
nireports | ||
numpy>=1.17.3 | ||
nest-asyncio>=1.5.1 | ||
scikit-image>=0.14.2 | ||
scipy>=1.8.0 |
Oops, something went wrong.