Skip to content
Snippets Groups Projects
Verified Commit f1c08b4e authored by Antoine Lambert's avatar Antoine Lambert
Browse files

Apply swh-py-template v0.3.3 with copier

Bump development tools: mypy, codespell, isort, ...

Move all tools configuration in pyproject.toml.

Remove no longer needed mypy overrides.
parent 0de1ae1f
No related branches found
No related tags found
No related merge requests found
Pipeline #13222 passed
# Changes here will be overwritten by Copier # Changes here will be overwritten by Copier
_commit: v0.2.2 _commit: v0.3.3
_src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git _src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git
description: Software Heritage authentication utilities description: Software Heritage authentication utilities
distribution_name: swh-auth distribution_name: swh-auth
......
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 rev: v5.0.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: check-json - id: check-json
- id: check-yaml - id: check-yaml
- repo: https://github.com/python/black - repo: https://github.com/python/black
rev: 24.8.0 rev: 25.1.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/PyCQA/isort - repo: https://github.com/PyCQA/isort
rev: 5.13.2 rev: 6.0.0
hooks: hooks:
- id: isort - id: isort
...@@ -20,14 +20,14 @@ repos: ...@@ -20,14 +20,14 @@ repos:
rev: 7.1.1 rev: 7.1.1
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: [flake8-bugbear==24.4.26] additional_dependencies: [flake8-bugbear==24.12.12, flake8-pyproject]
- repo: https://github.com/codespell-project/codespell - repo: https://github.com/codespell-project/codespell
rev: v2.3.0 rev: v2.4.1
hooks: hooks:
- id: codespell - id: codespell
name: Check source code spelling name: Check source code spelling
stages: [commit] stages: [pre-commit]
- id: codespell - id: codespell
name: Check commit message spelling name: Check commit message spelling
stages: [commit-msg] stages: [commit-msg]
......
[mypy]
namespace_packages = True
warn_unused_ignores = True
explicit_package_bases = True
# ^ Needed for mypy to detect py.typed from swh packages installed
# in editable mode
# support for django magic: https://github.com/typeddjango/django-stubs
plugins = mypy_django_plugin.main, mypy_drf_plugin.main
[mypy.plugins.django-stubs]
django_settings_module = swh.auth.tests.django.app.apptest.settings
# 3rd party libraries without stubs (yet)
[mypy-jwcrypto.*]
ignore_missing_imports = True
[mypy-keycloak.*]
ignore_missing_imports = True
[mypy-pkg_resources.*]
ignore_missing_imports = True
[mypy-starlette.*]
ignore_missing_imports = True
[mypy-aiocache.*]
ignore_missing_imports = True
# [mypy-add_your_lib_here.*]
# ignore_missing_imports = True
...@@ -60,3 +60,41 @@ ensure_newline_before_comments = true ...@@ -60,3 +60,41 @@ ensure_newline_before_comments = true
line_length = 88 line_length = 88
force_sort_within_sections = true force_sort_within_sections = true
known_first_party = ['swh'] known_first_party = ['swh']
[tool.django-stubs]
django_settings_module = "swh.auth.tests.django.app.apptest.settings"
[tool.mypy]
namespace_packages = true
warn_unused_ignores = true
explicit_package_bases = true
# ^ Needed for mypy to detect py.typed from swh packages installed
# in editable mode
plugins = ["mypy_django_plugin.main",
"mypy_drf_plugin.main"]
# 3rd party libraries without stubs (yet)
[[tool.mypy.overrides]]
module = [
"aiocache.*",
]
ignore_missing_imports = true
[tool.flake8]
select = ["C", "E", "F", "W", "B950"]
ignore = [
"E203", # whitespaces before ':' <https://github.com/psf/black/issues/315>
"E231", # missing whitespace after ','
"E501", # line too long, use B950 warning from flake8-bugbear instead
"W503" # line break before binary operator <https://github.com/psf/black/issues/52>
]
max-line-length = 88
[tool.pytest.ini_options]
addopts = "-p no:flask"
norecursedirs = "build docs .*"
asyncio_mode = "strict"
consider_namespace_packages = true
DJANGO_SETTINGS_MODULE = "swh.auth.tests.django.app.apptest.settings"
[pytest]
addopts = -p no:flask
norecursedirs = build docs .*
asyncio_mode = strict
consider_namespace_packages = true
DJANGO_SETTINGS_MODULE = swh.auth.tests.django.app.apptest.settings
...@@ -6,5 +6,6 @@ pytest-mock ...@@ -6,5 +6,6 @@ pytest-mock
requests_mock requests_mock
swh.core[testing] swh.core[testing]
types-click types-click
types-jwcrypto
types-pytz types-pytz
types-pyyaml types-pyyaml
[flake8]
# E203: whitespaces before ':' <https://github.com/psf/black/issues/315>
# E231: missing whitespace after ','
# E501: line too long, use B950 warning from flake8-bugbear instead
# W503: line break before binary operator <https://github.com/psf/black/issues/52>
select = C,E,F,W,B950
ignore = E203,E231,E501,W503
max-line-length = 88
...@@ -24,7 +24,7 @@ commands = ...@@ -24,7 +24,7 @@ commands =
[testenv:black] [testenv:black]
skip_install = true skip_install = true
deps = deps =
black==24.8.0 black==25.1.0
commands = commands =
{envpython} -m black --check swh {envpython} -m black --check swh
...@@ -32,8 +32,10 @@ commands = ...@@ -32,8 +32,10 @@ commands =
skip_install = true skip_install = true
deps = deps =
flake8==7.1.1 flake8==7.1.1
flake8-bugbear==24.4.26 flake8-bugbear==24.12.12
flake8-pyproject==1.2.3
pycodestyle==2.12.1 pycodestyle==2.12.1
commands = commands =
{envpython} -m flake8 {envpython} -m flake8
...@@ -41,7 +43,7 @@ commands = ...@@ -41,7 +43,7 @@ commands =
extras = extras =
testing testing
deps = deps =
mypy==1.11.1 mypy==1.15.0
commands = commands =
mypy swh mypy swh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment