Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINT] switch bidsschematools to pyproject.toml #1948

Merged
merged 10 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-ast
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -48,7 +49,7 @@ repos:
rev: 7.1.1
hooks:
- id: flake8
args: [--config=tools/schemacode/setup.cfg]
args: [--config=tools/schemacode/.flake8]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
Expand All @@ -61,6 +62,11 @@ repos:
- id: yamllint
args: [-f=standard, -c=.yamllint.yml]
files: src/schema/.*/.*\.yaml
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-toml
args: [--autofix, --indent, '4']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think sorting leads to a very readable pyproject.toml, where I think there are some rough importance levels that are good to indicate (e.g. "name" should be the first thing in project metadata).

Suggested change
args: [--autofix, --indent, '4']
args: [--autofix, --indent, '4', --no-sort]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good with me
defo not a hill I want to die on

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to commit this one

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
7 changes: 7 additions & 0 deletions tools/schemacode/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 99
exclude = *build/
ignore = E203,E402,E722,W503
per-file-ignores =
*/__init__.py : F401
docstring-convention = numpy
90 changes: 76 additions & 14 deletions tools/schemacode/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,65 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
build-backend = "hatchling.build"
requires = ["hatchling"]

[project]
authors = [{name = "Nilearn developers"}]
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Information Analysis",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
]
dependencies = [
"click",
"pyyaml",
"importlib_resources; python_version < '3.9'",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this can go now, no?

"jsonschema"
]
description = " Python tools for working with the BIDS schema."
license = {text = "MIT"}
maintainers = [{name = "bids-standard developers", email = " [email protected]"}]
name = "bidsschematools"
readme = "README.md"
requires-python = ">=3.9"
version = "0.11.4-dev" # file:bidsschematools/data/schema/SCHEMA_VERSION
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved

[project.optional-dependencies]
all = [
"bidsschematools[doc,render,tests,expressions]"
]
doc = [
"sphinx>=1.5.3",
"sphinx_rtd_theme"
]
expressions = ["pyparsing"]
render = [
"tabulate",
"pandas",
"markdown-it-py"
]
tests = [
"codecov",
"coverage[toml]",
"flake8",
"flake8-black",
"flake8-isort",
"pytest",
"pytest-cov"
]

[project.scripts]
bst = "bidsschematools.__main__:cli"

[project.urls]
Homepage = "https://github.com/bids-standard/bids-specification"

Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
[tool.black]
line-length = 99
target-version = ['py39']
include = '\.pyi?$'
exclude = '''
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
(
/(
Expand All @@ -20,19 +74,27 @@ exclude = '''
)/
)
'''
include = '\.pyi?$'
line-length = 99
target-version = ['py39']
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved

[tool.coverage.run]
omit = [
"*/*/tests/*",
"**/tests/*"
]
parallel = true

[tool.isort]
profile = "black"
multi_line_output = 3
profile = "black"

[tool.pytest.ini_options]
addopts = "-ra --strict-markers"
log_cli = true
log_cli_level = "INFO"
markers = [
"validate_schema: tests that validate the schema itself",
]

[tool.coverage.run]
parallel = true
omit = [
"*/*/tests/*",
"**/tests/*"
"validate_schema: tests that validate the schema itself"
]
minversion = "6.0"
xfail_strict = true
71 changes: 0 additions & 71 deletions tools/schemacode/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,59 +1,3 @@
[metadata]
name = bidsschematools
version = file:bidsschematools/data/schema/SCHEMA_VERSION
url = https://github.com/bids-standard/bids-specification
author = bids-standard developers
author_email = [email protected]
description = Python tools for working with the BIDS schema.
long_description = file:README.md
long_description_content_type = text/markdown; charset=UTF-8; variant=GFM
license = MIT
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Information Analysis
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13

[options]
python_requires = >=3.9
install_requires =
click
pyyaml
importlib_resources; python_version < "3.9"
jsonschema
packages = find:
include_package_data = false
zip_safe = false

[options.extras_require]
doc =
sphinx>=1.5.3
sphinx_rtd_theme
render =
tabulate
pandas
markdown-it-py
expressions =
pyparsing
tests =
codecov
coverage[toml]
flake8
flake8-black
flake8-isort
pytest
pytest-cov
all =
%(doc)s
%(render)s
%(tests)s
%(expressions)s

[options.package_data]
bidsschematools =
data/metaschema.json
Expand All @@ -62,18 +6,3 @@ bidsschematools =
data/schema/**/*.yaml
tests/data/**/*
tests/data/**/.bidsignore

[options.entry_points]
console_scripts =
bst=bidsschematools.__main__:cli

[flake8]
max-line-length = 99
exclude = *build/
ignore = E203,E402,E722,W503
per-file-ignores =
*/__init__.py : F401
docstring-convention = numpy

[tool:pytest]
log_cli = true
Loading