Commit graph

516 commits

Author SHA1 Message Date
aa1a7c796f
Register the shared fixtures via pytest_plugins
That is the documented way to share fixtures from other modules,
instead of importing them into tests/conftest.py
2026-11-30 15:03:27 +01:00
0b2a1197a2
Import sqlalchemy.ext.hybrid as sa_hybrid 2026-11-30 14:22:42 +01:00
9d3af5e447
Import the postgresql dialect as psql 2026-11-30 14:21:01 +01:00
78e052b668
Use sa.func instead of importing func
Naming rule for `velofy`: Import modules instead of objects
2026-11-30 14:19:42 +01:00
e30b3efbe8
Use the sa alias for sqlalchemy everywhere
`sa` is the common alias, also in SQLAlchemy's own documentation
2026-11-30 14:18:05 +01:00
a85ba4c4c4
Merge branch 'fix-mypy' into develop
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m52s
Reviewed-on: #8
2026-11-30 14:13:43 +01:00
2b112f46e2
Remove the no longer used engine and connection globals
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m52s
Only `session` is used in the package.
Bound to the `engine`, it connects on its first query
instead of when the package is imported.
2026-11-30 14:03:26 +01:00
e9dbf528d7
Query order history via the db.session
The query then runs in the same transaction as the `db.session`

For that, `addresses_mock` now replaces only `session.query()`
instead of the whole `db.session`.
2026-11-30 13:59:34 +01:00
6119064d71
Remove obsolete exceptions from the mypy config
`nox` and `pytest` are not imported in the package,
and the other libraries ship their own types by now
2026-11-30 13:23:29 +01:00
570c9c9fcb
Run mypy in the "lint" session
It needs the dependencies of `velofy` installed,
and it now also reports "# type: ignore" comments without an error code
or that are not needed anymore
2026-11-30 13:15:27 +01:00
295a271ad7
Remove no longer needed "# type: ignore" comments
With the ORM columns annotated, `mypy` understands these lines on its own
2026-11-30 13:11:52 +01:00
607055d55a
Raise an error if Path._directions is not set ...
... instead of failing inside `json.loads()` on `None`
2026-11-30 12:50:31 +01:00
744d9a6353
Raise an error if an Order timestamp is not set
Like `Order.time_to_delivery` already does,
instead of failing with a `TypeError` on `None`
2026-11-30 12:43:33 +01:00
1c206a715b
Rename the restaurants list ...
... because it shadowed the `restaurants` parameter, a `bool`
2026-11-30 12:33:17 +01:00
a4d1f477ae
Return a bool from Order.corrected ...
... because the `or` chain over nullable columns could return `None`
2026-11-30 12:29:09 +01:00
e08272e6ab
Use dt for the datetime module in orders.py
Like in the other modules
2026-11-30 11:44:34 +01:00
1cc5dcff54
Avoid queries that may return None
The last `grid` of the loop already belongs to the `city`,
and `.scalar()` returns the maximum or `None` without indexing a row
2026-11-30 11:39:56 +01:00
82d245836f
Annotate the defaults in Address.draw()
The `**kwargs` for `folium.Circle()` are not all strings
2026-11-30 11:38:27 +01:00
a320c1fba5
Type the database placeholders for mypy
The test fixtures replace the `None` placeholders, and `velofy.configuration` already ensures that "DATABASE_URI" is set outside of tests
2026-11-30 11:36:01 +01:00
b5a6fb42cc
Accept any arguments in the R console callbacks
`rpy2` names the parameter `s`, so `_msg` did not match its signature
2026-11-30 11:33:59 +01:00
27171fe79a
Exclude folium from the "untyped-call" check
`folium` has no type annotations, so every call into it counted as untyped
2026-11-30 11:33:19 +01:00
c339719936
Annotate the ORM columns with orm.Mapped
Since SQLAlchemy 2.0, `orm.mapped_column()` with an annotation
lets `mypy` see `pixel.id` as an `int` instead of a `Column[int]`.
2026-11-30 11:22:04 +01:00
a8b4bca79d
Merge branch 'fix-sawarnings' into develop
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m44s
Reviewed-on: #7
2026-11-30 11:05:11 +01:00
c3198ecc48
Turn all warnings into errors
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m43s
New warnings, such as deprecations,
then fail right away instead of piling up.

The ignore for `patsy` is obsolete.
2026-11-30 10:56:56 +01:00
e01421bb96
Close the connection after running the migrations
The pooled `connection` stayed open until garbage collection,
which emits a `ResourceWarning`
2026-11-30 10:54:36 +01:00
ee5a372b2b
Link new objects from the parent
Since SQLAlchemy 2.0, only the parent's end
cascades a new object into the session'
2026-11-30 10:40:27 +01:00
87aaebe475
Join the session into the outer transaction
With "create_savepoint", commits inside a test case
only release a savepoint, so the final rollback no longer warns
2026-11-30 10:24:10 +01:00
fb87326d66
Merge branch 'add-ruff' into develop
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m43s
Reviewed-on: #6
2026-11-28 05:01:26 +01:00
a24db98262
Enable PLR in ruff
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m43s
2026-11-28 04:57:25 +01:00
8f36a740d7
Enable ERA in ruff
Dead code belongs in the history, not in comments
2026-11-28 04:55:19 +01:00
707b4ab652
Add flynt to the "format" session
`flynt` converts old-style string formatting
into f-strings before `black` formats the result
2026-11-28 04:49:16 +01:00
e451f03d0f
Add ruff to the "format" session
`ruff format` adds parentheses around multi-line lambda bodies
and removes blank lines after block openers,
both of which `black` accepts.

Lines with `# type:ignore` are shortened
because `black` counts pragma comments toward the line length
and `ruff` does not.
2026-11-28 04:44:52 +01:00
318dff8fc8
Add ruff to the "lint" session
`ruff` runs alongside `flake8` and `isort`,
with the rules aligned to theirs:
- `noqa` comments go where both tools expect them
- `import`s stay sorted case-insensitively,
  now stated explicitly in both tools
- `print()` in the "docs" session became `session.log()`
2026-11-28 04:37:25 +01:00
175d722071
Merge branch 'remove-wps' into develop
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m41s
Reviewed-on: #5
2026-11-28 04:16:01 +01:00
88554e3939
Silence the module name notice of bandit
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m41s
2026-11-28 04:11:56 +01:00
1a4dfb0ee7
Sort the plugins in the "select" list 2026-11-28 04:09:52 +01:00
4a81403f15
Replace darglint with pydoclint 2026-11-28 04:06:53 +01:00
3ec7ec8c98
Add pep8-naming 2026-11-28 03:54:49 +01:00
afe8b3ce90
Apply shared fixtures to whole test classes 2026-11-28 03:52:11 +01:00
882d3c98ba
Add flake8-unused-arguments
- Request fixtures only needed for their side effects
  via `@pytest.mark.usefixtures()` instead of as arguments
- Remove fixtures that a test does not use at all
- Exempt abstract methods because their arguments define an interface
2026-11-28 03:48:50 +01:00
29a711f049
Add flake8-todos 2026-11-28 03:37:25 +01:00
cb8f919b1f
Add flake8-sfs 2026-11-28 03:34:40 +01:00
650765a9d3
Add flake8-quotes 2026-11-28 03:28:50 +01:00
50a0e45309
Ignore the double quotes commit in git blame 2026-11-28 03:28:49 +01:00
ea8f1a13e3
Use double quotes 2026-11-28 03:26:13 +01:00
7b32ffc599
Add flake8-docstrings 2026-11-28 03:26:12 +01:00
efde4322bf
Add flake8-debugger 2026-11-28 03:26:12 +01:00
08493d1ea1
Add flake8-comprehensions 2026-11-28 03:26:12 +01:00
7f14c9c855
Add flake8-commas 2026-11-28 03:26:11 +01:00
cb110267f0
Add flake8-bugbear 2026-11-28 03:26:11 +01:00