From 318627bcfcc7dde3a1efb0e97006596cabde249e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= <43667554+CagtayFabry@users.noreply.github.com> Date: Thu, 26 Jan 2023 12:57:39 +0100 Subject: [PATCH] add validate-pyproject (#841) * add validate-pyproject --- .pre-commit-config.yaml | 8 ++++++-- pyproject.toml | 44 ++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bbf7277e4..03cec171f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,6 +39,10 @@ repos: args: - --quiet - --fix + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.11 + hooks: + - id: validate-pyproject # ----- Jupyter Notebooks ----- - repo: https://github.com/nbQA-dev/nbQA rev: 1.6.1 @@ -46,8 +50,8 @@ repos: - id: nbqa-black - id: nbqa-ruff # ruff handles isort args: - - --fix - - --force-exclude + - --fix + - --force-exclude - repo: https://github.com/roy-ht/pre-commit-jupyter rev: v1.2.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index 13ec2643f..be0fc8f22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,7 +107,7 @@ addopts = "--tb=short --color=yes -rsw --cov=weldx --cov-report=term-missing:ski testpaths = "weldx" # custom test markers, see https://docs.pytest.org/en/latest/example/markers.html#mark-examples markers = "slow: marks tests as slow to run (skipped by default, enable with --runslow option)" -asdf_schema_root = "weldx/schemas/weldx.bam.de/weldx" # TODO: couldn't we just use the entry points to resolve this? +asdf_schema_root = "weldx/schemas/weldx.bam.de/weldx" # TODO: couldn"t we just use the entry points to resolve this? #asdf_schema_tests_enabled = true #asdf_schema_skip_tests = # weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml @@ -182,35 +182,35 @@ ignore_errors = true [tool.ruff] target-version = "py38" # designated Python version exclude = [ - '__init__.py', - 'doc/conf.py', + "__init__.py", + "doc/conf.py", ] # TODO: should be the following list, but Ruff does not yet impl all of them. # W503,W504 # E203 # C408 ignore = [ - 'C408', - #'E203', - 'E402', - #'W503', - #'W504', + "C408", + #"E203", + "E402", + #"W503", + #"W504", "D203", "D211", "D213" ] line-length = 88 select = [ - 'B', # flake8-bugbear - 'C', # flake8-comprehensions - #'D', # note: all relevant D's will be set by setting pydocstyle.convention=numpy! - 'E', # pycodestyles - 'F', # pyflakes - 'W', # pycodestyle warnings - 'UP', # pyupgrade - 'T2', # flake8-print - 'I001', # isort - 'ICN', # import conventions, e.g. import numpy as np - #'B950', # not yet implemented by Ruff. - 'RUF100', # ensure 'noqa' declarations are still valid. + "B", # flake8-bugbear + "C", # flake8-comprehensions + #"D", # note: all relevant D's will be set by setting pydocstyle.convention=numpy! + "E", # pycodestyles + "F", # pyflakes + "W", # pycodestyle warnings + "UP", # pyupgrade + "T2", # flake8-print + "I001", # isort + "ICN", # import conventions, e.g. import numpy as np + #"B950", # not yet implemented by Ruff. + "RUF100", # ensure 'noqa' declarations are still valid. ] # Allow pydocstyle violations in certain areas. @@ -228,7 +228,7 @@ pyupgrade = {keep-runtime-typing = true} mccabe = {max-complexity = 15} # max branches inside a function. [tool.ruff.isort] -known-first-party = ['weldx'] +known-first-party = ["weldx"] [tool.ruff.flake8-import-conventions] -extend-aliases = {xarray = 'xr'} +extend-aliases = {xarray = "xr"}