Merge branch 'integrate-setup-cfg' into develop
All checks were successful
CI / Tests (Python 3.13) (push) Successful in 1m13s

This commit is contained in:
Alexander Hess 2026-11-25 15:09:21 +01:00
commit afb17b61da
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
5 changed files with 355 additions and 338 deletions

View file

@ -59,6 +59,6 @@ jobs:
uv venv --python 3.13 --seed .venv
poetry sync --no-interaction
# `TESTING=true` comes from `setup.cfg`
# `TESTING=true` comes from `pyproject.toml`
- name: Run the test suite
run: poetry run pytest -q

19
poetry.lock generated
View file

@ -1282,6 +1282,23 @@ files = [
{file = "flake8_plugin_utils-1.3.3-py3-none-any.whl", hash = "sha256:e4848c57d9d50f19100c2d75fa794b72df068666a9041b4b0409be923356a3ed"},
]
[[package]]
name = "flake8-pyproject"
version = "1.2.4"
description = "Flake8 plug-in loading the configuration from pyproject.toml"
optional = false
python-versions = ">=3.6"
groups = ["dev"]
files = [
{file = "flake8_pyproject-1.2.4-py3-none-any.whl", hash = "sha256:ea34c057f9a9329c76d98723bb2bb498cc6ba8ff9872c4d19932d48c91249a77"},
]
[package.dependencies]
Flake8 = ">=5"
[package.extras]
dev = ["Flit (>=3.4)", "pyTest (>=7)", "pyTest-cov (>=7) ; python_version >= \"3.10\""]
[[package]]
name = "flake8-pytest-style"
version = "2.2.0"
@ -5570,4 +5587,4 @@ research = ["jupyterlab", "numpy", "pytz"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.13,<4.0"
content-hash = "58a1f3c117121076e5f8a72d80318d6373578f3a53e04a9cedae516122babdad"
content-hash = "f45c2c4015cc87f8679f0dded5ec13fa5de3922bd626864aae0bbc223f768511"

View file

@ -78,6 +78,315 @@ skip-string-normalization = true # `wemake-python-styleguide` enforces single q
[tool.coverage]
# Source: https://coverage.readthedocs.io/en/latest/config.html
[tool.coverage.paths]
source = [
"src/",
"*/site-packages/",
]
[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
[tool.coverage.run]
branch = true
data_file = ".cache/coverage/data"
source = ["velofy"]
[tool.flake8]
# Source: https://flake8.pycqa.org/en/latest/user/configuration.html
# Include error classes only explicitly
# to avoid forward compatibility issues.
select = [
# =============
# flake8's base
# =============
# mccabe => cyclomatic complexity
"C901",
# pycodestyle => PEP8 compliance
"E", "W",
# pyflakes => basic errors
"F4", "F5", "F6", "F7", "F8", "F9",
# ========================
# wemake-python-styleguide
# Source: https://wemake-python-stylegui.de/en/latest/pages/usage/violations/index.html
# ========================
"WPS1", "WPS2", "WPS3", "WPS4", "WPS5", "WPS6",
# darglint => docstring matches implementation
"DAR0", "DAR1", "DAR2", "DAR3", "DAR4", "DAR5",
# flake8-bandit => common security issues
"S1", "S2", "S3", "S4", "S5", "S6", "S7",
# flake8-broken-line => no \ to end a line
"N400",
# flake8-bugbear => opinionated bugs and design flaws
"B0", "B3", "B9",
# flake8-commas => better comma placements
"C8",
# flake8-comprehensions => better comprehensions
"C4",
# flake8-debugger => no debugger usage
"T100",
# flake8-docstrings => PEP257 compliance
"D1", "D2", "D3", "D4",
# flake8-eradicate => no commented out code
"E800",
# flake8-isort => isort would make changes
"I0",
# flake8-rst-docstrings => valid rst in docstrings
"RST2", "RST3", "RST4",
# flake8-string-format => unify usage of str.format()
"P1", "P2", "P3",
# flake8-quotes => use double quotes everywhere (complying with black)
"Q0",
# pep8-naming
"N8",
# =====
# other
# =====
# flake8-annotations => enforce type checking for functions
"ANN0", "ANN2", "ANN3",
# flake8-black => complain if black would make changes
"BLK1", "BLK9",
# flake8-pytest-style => enforce a consistent style with pytest
"PT0",
]
# By default, flake8 ignores some errors.
# Instead, do not ignore anything.
ignore = []
# If --ignore is passed on the command
# line, still ignore the following:
extend-ignore = [
# TODO: New in `wemake-python-styleguide` v0.15 - v0.17, revisit in the tooling goal
"WPS110",
"WPS237",
"WPS238",
"WPS358",
"WPS456",
"WPS458",
"WPS459",
"WPS462",
"WPS469",
# Too long line => duplicate with E501.
"B950",
# Comply with black's style.
# Source: https://github.com/psf/black/blob/master/docs/compatible_configs.md#flake8
"E203", "W503", "WPS348",
# Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`.
"PT023",
# Google's Python Style Guide is not reStructuredText
# until after being processed by Sphinx Napoleon.
# Source: https://github.com/peterjc/flake8-rst-docstrings/issues/17
"RST201", "RST203", "RST210", "RST213", "RST301",
# The "too deep nesting" violation fires off "too early" and cannot be configured.
"WPS220",
# String constant over-use is checked visually by the programmer.
"WPS226",
# Function complexity is checked by `mccabe` (=C901),
# which yields the same result in most cases.
"WPS231",
# Modules as a whole are assumed to be not "too complex".
"WPS232",
# Allow underscores in numbers.
"WPS303",
# f-strings are ok.
"WPS305",
# Classes should not have to specify a base class.
"WPS306",
# Let's be modern: The Walrus is ok.
"WPS332",
# Let's not worry about the number of noqa's.
# Multi-line loops are ok.
"WPS352",
"WPS402",
# Putting logic into __init__.py files may be justified.
"WPS412",
# Allow multiple assignment, e.g., x = y = 123
"WPS429",
# There are no magic numbers.
"WPS432",
]
per-file-ignores = [
# Top-levels of a sub-packages are intended to import a lot.
"**/__init__.py:F401,WPS201",
# Allow shadowing built-ins and reading __*__ variables.
"docs/conf.py:WPS125,WPS609",
# Type annotations are not strictly enforced.
"migrations/env.py:ANN0,ANN2",
# - ANN0, ANN2 => Type annotations are not strictly enforced.
# - S608 => Do not worry about SQL injection here.
# - WPS114, WPS118 => File names of revisions are ok.
# - WPS204, WPS213 => Revisions may have too many expressions.
"migrations/versions/*.py:ANN0,ANN2,S608,WPS114,WPS118,WPS204,WPS213",
# - ANN0, ANN2 => Type annotations are not strictly enforced.
# - WPS202 => TODO (isort): Check if still too many module members.
# - WPS213 => TODO (isort): Remove after simplifying the nox session "lint".
"noxfile.py:ANN0,ANN2,WPS202,WPS213",
# Allow upper case class variables within classes.
"src/velofy/configuration.py:WPS115",
# The module does not have too many imports.
"src/velofy/db/addresses_addresses.py:WPS201",
# The many noqa's are ok.
"src/velofy/forecasts/models/tactical/horizontal.py:WPS403",
# - S608 => No SQL injection as the inputs come from a safe source.
# - WPS403 => The many noqa's are ok.
"src/velofy/forecasts/timify.py:S608,WPS403",
# - ANN0, ANN2 => Type annotations are not strictly enforced.
# - D106 => The `Meta` class inside the factory_boy models do not need a docstring.
# - S101 => `assert` statements are ok in the test suite.
# - S311 => The `random` module is not used for cryptography.
# - WPS442 => Shadowing outer scopes occurs naturally with mocks.
# - WPS100 => `utils` should be a valid module name.
# - WPS118 => Test names may be longer than 40 characters.
# - WPS202, WPS204, WPS214 => Modules may have many test cases.
# - WPS221 => Do not check for Jones complexity in the test suite.
# - WPS338 => "Private" methods are really just a convention for
# fixtures without a return value.
# - WPS402 => We do not care about the number of "# noqa"s in the test suite.
# - WPS430 => Allow closures.
# - WPS437 => When testing, it is normal to use implementation details.
"tests/*.py:ANN0,ANN2,D106,S101,S311,WPS442,WPS100,WPS118,WPS202,WPS204,WPS214,WPS221,WPS338,WPS402,WPS430,WPS437",
]
# Explicitly set mccabe's maximum complexity to 10 as recommended by
# Thomas McCabe, the inventor of the McCabe complexity, and the NIST.
# Source: https://en.wikipedia.org/wiki/Cyclomatic_complexity#Limiting_complexity_during_development
max-complexity = 10
# Allow more than wemake-python-styleguide's 5 local variables per function.
max-local-variables = 8
# Allow more than wemake-python-styleguide's 7 methods per class.
max-methods = 15
# Comply with black's style.
# Source: https://github.com/psf/black/blob/master/docs/the_black_code_style.md#line-length
max-line-length = 88
# Preview the code lines that cause errors.
show-source = true
# ===================================
# wemake-python-styleguide's settings
# ===================================
allowed-domain-names = [
"data",
"obj",
"param",
"result",
"results",
"value",
]
max-name-length = 40
# darglint
strictness = "long"
# flake8-docstrings
docstring-convention = "google"
# flake8-eradicate
eradicate-aggressive = true
# ==============================
# flake8-pytest-style's settings
# ==============================
# Prefer @pytest.fixture over @pytest.fixture().
pytest-fixture-no-parentheses = true
# Prefer @pytest.mark.parametrize(['param1', 'param2'], [(1, 2), (3, 4)])
# over @pytest.mark.parametrize(('param1', 'param2'), ([1, 2], [3, 4]))
pytest-parametrize-names-type = "list"
pytest-parametrize-values-row-type = "tuple"
pytest-parametrize-values-type = "list"
[tool.isort]
# Source: https://pycqa.github.io/isort/docs/configuration/options.html
atomic = true
case_sensitive = true
combine_star = true
force_alphabetical_sort_within_sections = true
lines_after_imports = 2
remove_redundant_aliases = true
# Comply with black's style
# Source: https://github.com/psf/black/blob/master/docs/compatible_configs.md#isort
ensure_newline_before_comments = true
force_grid_wrap = 0
include_trailing_comma = true
line_length = 88
multi_line_output = 3
use_parentheses = true
# Comply with Google's Python Style Guide
# => All imports go on a single line except the ones from the typing module
# Source: https://google.github.io/styleguide/pyguide.html#313-imports-formatting
force_single_line = true
single_line_exclusions = ["typing"]
[tool.mypy]
# Source: https://mypy.readthedocs.io/en/stable/config_file.html
cache_dir = ".cache/mypy"
# Check the interior of functions without type annotations
check_untyped_defs = true
# Disallow generic types without explicit type parameters
disallow_any_generics = true
# Disallow functions with incomplete type annotations
disallow_incomplete_defs = true
# Disallow calling functions without type annotations
disallow_untyped_calls = true
# Disallow functions without type annotations (or incomplete annotations)
disallow_untyped_defs = true
[[tool.mypy.overrides]]
module = [
"folium.*",
"geopy.*",
"googlemaps.*",
"matplotlib.*",
"nox.*",
"numpy.*",
"ordered_set.*",
"packaging",
"pandas",
"pytest",
"rpy2.*",
"sqlalchemy.*",
"statsmodels.*",
"utm.*",
]
ignore_missing_imports = true
[tool.poetry.group.dev.dependencies]
# Task Runners
@ -93,6 +402,7 @@ isort = ">=9.0.2,<10"
flake8 = ">=7.5.0,<8"
flake8-annotations = ">=3.3.1,<4"
flake8-black = ">=0.5.0,<0.6"
flake8-pyproject = ">=1.2.4,<2"
flake8-pytest-style = ">=2.2.0,<3"
mypy = ">=2.4.1,<3"
@ -109,3 +419,28 @@ xdoctest = { version=">=1.3.2,<2", extras=["optional"] }
# Documentation
sphinx = ">=9.2.0,<10"
sphinx-autodoc-typehints = ">=3.17.7,<4"
[tool.pytest.ini_options]
# Source: https://docs.pytest.org/en/stable/reference/reference.html#ini-options-ref
cache_dir = ".cache/pytest"
addopts = "--strict-markers"
console_output_style = "count"
env = [
"TESTING=true",
]
filterwarnings = [
"ignore:::patsy.*",
]
markers = [
"db: (integration) tests touching the database",
"e2e: non-db and non-r integration tests",
"r: (integration) tests using rpy2",
]

335
setup.cfg
View file

@ -1,335 +0,0 @@
[black]
# black's settings are in pyproject.toml => [tool.black]
[coverage:paths]
source =
src/
*/site-packages/
[coverage:report]
show_missing = true
skip_covered = true
skip_empty = true
[coverage:run]
branch = true
data_file = .cache/coverage/data
source =
velofy
[flake8]
# Include error classes only explicitly
# to avoid forward compatibility issues.
select =
# =============
# flake8's base
# =============
# mccabe => cyclomatic complexity
C901,
# pycodestyle => PEP8 compliance
E, W,
# pyflakes => basic errors
F4, F5, F6, F7, F8, F9
# ========================
# wemake-python-styleguide
# Source: https://wemake-python-stylegui.de/en/latest/pages/usage/violations/index.html
# ========================
WPS1, WPS2, WPS3, WPS4, WPS5, WPS6,
# darglint => docstring matches implementation
DAR0, DAR1, DAR2, DAR3, DAR4, DAR5,
# flake8-bandit => common security issues
S1, S2, S3, S4, S5, S6, S7,
# flake8-broken-line => no \ to end a line
N400,
# flake8-bugbear => opinionated bugs and design flaws
B0, B3, B9,
# flake8-commas => better comma placements
C8,
# flake8-comprehensions => better comprehensions
C4,
# flake8-debugger => no debugger usage
T100,
# flake8-docstrings => PEP257 compliance
D1, D2, D3, D4,
# flake8-eradicate => no commented out code
E800,
# flake8-isort => isort would make changes
I0,
# flake8-rst-docstrings => valid rst in docstrings
RST2, RST3, RST4,
# flake8-string-format => unify usage of str.format()
P1, P2, P3,
# flake8-quotes => use double quotes everywhere (complying with black)
Q0,
# pep8-naming
N8,
# =====
# other
# =====
# flake8-annotations => enforce type checking for functions
ANN0, ANN2, ANN3,
# flake8-black => complain if black would make changes
BLK1, BLK9,
# flake8-pytest-style => enforce a consistent style with pytest
PT0,
# By default, flake8 ignores some errors.
# Instead, do not ignore anything.
ignore =
# If --ignore is passed on the command
# line, still ignore the following:
extend-ignore =
# TODO: New in `wemake-python-styleguide` v0.15 - v0.17, revisit in the tooling goal
WPS110,
WPS237,
WPS238,
WPS358,
WPS456,
WPS458,
WPS459,
WPS462,
WPS469,
# Too long line => duplicate with E501.
B950,
# Comply with black's style.
# Source: https://github.com/psf/black/blob/master/docs/compatible_configs.md#flake8
E203, W503, WPS348,
# Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`.
PT023,
# Google's Python Style Guide is not reStructuredText
# until after being processed by Sphinx Napoleon.
# Source: https://github.com/peterjc/flake8-rst-docstrings/issues/17
RST201,RST203,RST210,RST213,RST301,
# The "too deep nesting" violation fires off "too early" and cannot be configured.
WPS220,
# String constant over-use is checked visually by the programmer.
WPS226,
# Function complexity is checked by `mccabe` (=C901),
# which yields the same result in most cases.
WPS231,
# Modules as a whole are assumed to be not "too complex".
WPS232,
# Allow underscores in numbers.
WPS303,
# f-strings are ok.
WPS305,
# Classes should not have to specify a base class.
WPS306,
# Let's be modern: The Walrus is ok.
WPS332,
# Let's not worry about the number of noqa's.
# Multi-line loops are ok.
WPS352,
WPS402,
# Putting logic into __init__.py files may be justified.
WPS412,
# Allow multiple assignment, e.g., x = y = 123
WPS429,
# There are no magic numbers.
WPS432,
per-file-ignores =
# Top-levels of a sub-packages are intended to import a lot.
**/__init__.py:
F401,WPS201,
docs/conf.py:
# Allow shadowing built-ins and reading __*__ variables.
WPS125,WPS609,
migrations/env.py:
# Type annotations are not strictly enforced.
ANN0, ANN2,
migrations/versions/*.py:
# Type annotations are not strictly enforced.
ANN0, ANN2,
# Do not worry about SQL injection here.
S608,
# File names of revisions are ok.
WPS114,WPS118,
# Revisions may have too many expressions.
WPS204,WPS213,
noxfile.py:
# Type annotations are not strictly enforced.
ANN0, ANN2,
# TODO (isort): Check if still too many module members.
WPS202,
# TODO (isort): Remove after simplifying the nox session "lint".
WPS213,
src/velofy/configuration.py:
# Allow upper case class variables within classes.
WPS115,
src/velofy/db/addresses_addresses.py:
# The module does not have too many imports.
WPS201,
src/velofy/forecasts/models/tactical/horizontal.py:
# The many noqa's are ok.
WPS403,
src/velofy/forecasts/timify.py:
# No SQL injection as the inputs come from a safe source.
S608,
# The many noqa's are ok.
WPS403,
tests/*.py:
# Type annotations are not strictly enforced.
ANN0, ANN2,
# The `Meta` class inside the factory_boy models do not need a docstring.
D106,
# `assert` statements are ok in the test suite.
S101,
# The `random` module is not used for cryptography.
S311,
# Shadowing outer scopes occurs naturally with mocks.
WPS442,
# `utils` should be a valid module name.
WPS100,
# Test names may be longer than 40 characters.
WPS118,
# Modules may have many test cases.
WPS202,WPS204,WPS214,
# Do not check for Jones complexity in the test suite.
WPS221,
# "Private" methods are really just a convention for
# fixtures without a return value.
WPS338,
# We do not care about the number of "# noqa"s in the test suite.
WPS402,
# Allow closures.
WPS430,
# When testing, it is normal to use implementation details.
WPS437,
# Explicitly set mccabe's maximum complexity to 10 as recommended by
# Thomas McCabe, the inventor of the McCabe complexity, and the NIST.
# Source: https://en.wikipedia.org/wiki/Cyclomatic_complexity#Limiting_complexity_during_development
max-complexity = 10
# Allow more than wemake-python-styleguide's 5 local variables per function.
max-local-variables = 8
# Allow more than wemake-python-styleguide's 7 methods per class.
max-methods = 15
# Comply with black's style.
# Source: https://github.com/psf/black/blob/master/docs/the_black_code_style.md#line-length
max-line-length = 88
# Preview the code lines that cause errors.
show-source = true
# ===================================
# wemake-python-styleguide's settings
# ===================================
allowed-domain-names =
data,
obj,
param,
result,
results,
value,
max-name-length = 40
# darglint
strictness = long
# flake8-docstrings
docstring-convention = google
# flake8-eradicate
eradicate-aggressive = true
# ==============================
# flake8-pytest-style's settings
# ==============================
# Prefer @pytest.fixture over @pytest.fixture().
pytest-fixture-no-parentheses = true
# Prefer @pytest.mark.parametrize(['param1', 'param2'], [(1, 2), (3, 4)])
# over @pytest.mark.parametrize(('param1', 'param2'), ([1, 2], [3, 4]))
pytest-parametrize-names-type = list
pytest-parametrize-values-row-type = tuple
pytest-parametrize-values-type = list
[isort]
atomic = true
case_sensitive = true
combine_star = true
force_alphabetical_sort_within_sections = true
lines_after_imports = 2
remove_redundant_aliases = true
# Comply with black's style.
# Source: https://github.com/psf/black/blob/master/docs/compatible_configs.md#isort
ensure_newline_before_comments = true
force_grid_wrap = 0
include_trailing_comma = true
line_length = 88
multi_line_output = 3
use_parentheses = true
# Comply with Google's Python Style Guide.
# All imports go on a single line except the ones from the typing module.
# Source: https://google.github.io/styleguide/pyguide.html#313-imports-formatting
force_single_line = true
single_line_exclusions = typing
[mypy]
cache_dir = .cache/mypy
# Check the interior of functions without type annotations.
check_untyped_defs = true
# Disallow generic types without explicit type parameters.
disallow_any_generics = true
# Disallow functions with incomplete type annotations.
disallow_incomplete_defs = true
# Disallow calling functions without type annotations.
disallow_untyped_calls = true
# Disallow functions without type annotations (or incomplete annotations).
disallow_untyped_defs = true
[mypy-folium.*]
ignore_missing_imports = true
[mypy-geopy.*]
ignore_missing_imports = true
[mypy-googlemaps.*]
ignore_missing_imports = true
[mypy-matplotlib.*]
ignore_missing_imports = true
[mypy-nox.*]
ignore_missing_imports = true
[mypy-numpy.*]
ignore_missing_imports = true
[mypy-ordered_set.*]
ignore_missing_imports = true
[mypy-packaging]
ignore_missing_imports = true
[mypy-pandas]
ignore_missing_imports = true
[mypy-pytest]
ignore_missing_imports = true
[mypy-rpy2.*]
ignore_missing_imports = true
[mypy-sqlalchemy.*]
ignore_missing_imports = true
[mypy-statsmodels.*]
ignore_missing_imports = true
[mypy-utm.*]
ignore_missing_imports = true
[tool:pytest]
addopts =
--strict-markers
cache_dir = .cache/pytest
console_output_style = count
env =
TESTING=true
filterwarnings =
ignore:::patsy.*
markers =
db: (integration) tests touching the database
e2e: non-db and non-r integration tests
r: (integration) tests using rpy2

View file

@ -19,7 +19,7 @@ from velofy import db
# The TESTING environment variable is set
# in setup.cfg in pytest's config section.
# in pyproject.toml in pytest's config section.
if not os.getenv('TESTING'):
raise RuntimeError('Tests must be executed with TESTING set in the environment')