-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from templateflow/maint/pep517-update
MAINT: Finalize migration of package build to PEP517/8
- Loading branch information
Showing
13 changed files
with
225 additions
and
129 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
File renamed without changes.
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,45 @@ | ||
#!/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 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 |
---|---|---|
@@ -1,16 +1,164 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools >= 45", | ||
"setuptools_scm >= 6.2", | ||
"nipreps-versions", | ||
"setuptools>=64", | ||
"setuptools_scm>=8", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
write_to = "templateflow/_version.py" | ||
write_to_template = """\ | ||
version_file = "templateflow/_version.py" | ||
version_file_template = """\ | ||
\"\"\"Version file, automatically generated by setuptools_scm.\"\"\" | ||
__version__ = "{version}" | ||
""" | ||
fallback_version = "0.0" | ||
version_scheme = "nipreps-calver" | ||
# version_scheme = "nipreps-calver" | ||
|
||
[project] | ||
name = "templateflow" | ||
description = "TemplateFlow Python Client - TemplateFlow is the Zone of neuroimaging templates." | ||
readme = "README.rst" | ||
authors = [{name = "The NiPreps Developers", email = "nipreps@gmail.com"}] | ||
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", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
license = {file = "LICENSE"} | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"pybids >= 0.15.2", | ||
"importlib_resources >= 5.7; python_version < '3.11'", | ||
"requests", | ||
"tqdm", | ||
] | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
Archive = "https://github.com/templateflow/templateflow" | ||
"Bug Tracker" = "https://github.com/templateflow/python-client/issues" | ||
Home = "https://www.templateflow.org" | ||
Documentation = "https://www.templateflow.org/python-client/" | ||
"Source Code" = "https://github.com/templateflow/python-client" | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"pytest", | ||
"pytest-xdist", | ||
"pytest-cov == 2.5.1", | ||
"coverage", | ||
] | ||
datalad = [ | ||
"datalad ~= 0.12.0" | ||
] | ||
doc = [ | ||
"nbsphinx", | ||
"packaging", | ||
"pydot>=1.2.3", | ||
"pydotplus", | ||
"sphinx-argparse", | ||
"sphinx ~= 4.0", | ||
"sphinx_rtd_theme >= 0.4.3", | ||
"sphinxcontrib-apidoc", | ||
"sphinx_multiversion", | ||
] | ||
# Aliases | ||
tests = ["templateflow[test]"] | ||
docs = ["templateflow[doc]"] | ||
all = ["templateflow[datalad,doc,test]"] | ||
|
||
# | ||
# Developer tool configurations | ||
# | ||
|
||
[tool.black] | ||
line-length = 99 | ||
skip-string-normalization = true | ||
|
||
[tool.isort] | ||
profile = 'black' | ||
|
||
[tool.flake8] | ||
max-line-length = "99" | ||
doctests = "False" | ||
exclude = "*build/" | ||
ignore = ["W503", "E203"] | ||
per-file-ignores = [ | ||
"**/__init__.py : F401", | ||
"docs/conf.py : E265", | ||
] | ||
|
||
[tool.pytest.ini_options] | ||
norecursedirs = [".git"] | ||
addopts = "-svx --doctest-modules" | ||
doctest_optionflags = "ALLOW_UNICODE NORMALIZE_WHITESPACE ELLIPSIS" | ||
env = "PYTHONHASHSEED=0" | ||
filterwarnings = ["ignore::DeprecationWarning"] | ||
junit_family = "xunit2" | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
concurrency = 'multiprocessing' | ||
omit = [ | ||
'*/tests/*', | ||
'*/conftest.py', | ||
'templateflow/_version.py' | ||
] | ||
|
||
[tool.coverage.report] | ||
# Regexes for lines to exclude from consideration | ||
exclude_lines = [ | ||
'raise NotImplementedError', | ||
'warnings\.warn', | ||
] | ||
|
||
[tool.ruff] | ||
line-length = 99 | ||
|
||
[tool.ruff.lint] | ||
extend-select = [ | ||
"F", | ||
"E", | ||
"W", | ||
"I", | ||
"UP", | ||
"YTT", | ||
"S", | ||
"BLE", | ||
"B", | ||
"A", | ||
# "CPY", | ||
"C4", | ||
"DTZ", | ||
"T10", | ||
# "EM", | ||
"EXE", | ||
"FA", | ||
"ISC", | ||
"ICN", | ||
"PT", | ||
"Q", | ||
] | ||
extend-ignore = [ | ||
"S311", # We are not using random for cryptographic purposes | ||
"ISC001", | ||
"S603", | ||
] | ||
|
||
[tool.ruff.lint.flake8-quotes] | ||
inline-quotes = "single" | ||
|
||
[tool.ruff.lint.extend-per-file-ignores] | ||
"*/test_*.py" = ["S101"] | ||
"fmriprep/utils/debug.py" = ["A002", "T100"] | ||
"docs/conf.py" = ["A001"] | ||
"docs/sphinxext/github_link.py" = ["BLE001"] | ||
|
||
[tool.ruff.format] | ||
quote-style = "single" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.