diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 90c277e197..98bd4e1ff6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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: @@ -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', --no-sort] - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: diff --git a/tools/schemacode/.flake8 b/tools/schemacode/.flake8 new file mode 100644 index 0000000000..57d01f9d11 --- /dev/null +++ b/tools/schemacode/.flake8 @@ -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 diff --git a/tools/schemacode/pyproject.toml b/tools/schemacode/pyproject.toml index c0a581cd85..9068e6d471 100644 --- a/tools/schemacode/pyproject.toml +++ b/tools/schemacode/pyproject.toml @@ -1,10 +1,82 @@ [build-system] -requires = ["setuptools"] build-backend = "setuptools.build_meta" +requires = ["setuptools"] + +[project] +name = "bidsschematools" +description = " Python tools for working with the BIDS schema." +authors = [{name = "bids-standard developers"}] +maintainers = [{name = "bids-standard developers", email = " bids.maintenance@gmail.com"}] +license = {text = "MIT"} +readme = "README.md" +requires-python = ">=3.9" +dependencies = [ + "click", + "pyyaml", + "jsonschema" +] +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" +] +dynamic = ["version"] + +[project.optional-dependencies] +expressions = ["pyparsing"] +render = [ + "tabulate", + "pandas", + "markdown-it-py" +] +tests = [ + "bidsschematools[expressions,render]", + "codecov", + "coverage[toml]", + "flake8", + "flake8-black", + "flake8-isort", + "pytest>6", + "pytest-cov" +] +doc = [ + "sphinx>=1.5.3", + "sphinx_rtd_theme" +] +all = [ + "bidsschematools[doc,tests]" +] + +[project.scripts] +bst = "bidsschematools.__main__:cli" + +[project.urls] +Homepage = "https://github.com/bids-standard/bids-specification" + +[tool.setuptools.dynamic] +version = {file = "bidsschematools/data/schema/SCHEMA_VERSION"} + +[tool.setuptools.package-data] +bidsschematools = [ + "data/metaschema.json", + "data/schema/BIDS_VERSION", + "data/schema/SCHEMA_VERSIO", + "data/schema/**/*.yaml", + "tests/data/**/*", + "tests/data/**/.bidsignore" +] + +[tool.setuptools.packages.find] +include = ["bidsschematools*"] [tool.black] line-length = 99 -target-version = ['py39'] include = '\.pyi?$' exclude = ''' ( @@ -21,18 +93,23 @@ exclude = ''' ) ''' +[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 --strict-config" +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 diff --git a/tools/schemacode/setup.cfg b/tools/schemacode/setup.cfg deleted file mode 100644 index 01f4f2c726..0000000000 --- a/tools/schemacode/setup.cfg +++ /dev/null @@ -1,79 +0,0 @@ -[metadata] -name = bidsschematools -version = file:bidsschematools/data/schema/SCHEMA_VERSION -url = https://github.com/bids-standard/bids-specification -author = bids-standard developers -author_email = bids.maintenance@gmail.com -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 - data/schema/BIDS_VERSION - data/schema/SCHEMA_VERSION - 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