Commit graph

440 commits

Author SHA1 Message Date
0a4fd0edbc
Enable PERF in ruff 2026-11-30 22:06:44 +01:00
9cc21f5b69
Enable PTH in ruff 2026-11-30 22:06:43 +01:00
0cb924b3b6
Enable ISC in flake8 and ruff 2026-11-30 22:06:43 +01:00
3bd7dd5772
Enable RET in flake8 and ruff 2026-11-30 22:06:42 +01:00
007998372f
Enable SIM in flake8 and ruff 2026-11-30 22:06:41 +01:00
5dce8e6645
Enable UP in ruff 2026-11-30 21:28:31 +01:00
d0d5c92c55
Sort the ruff-only rule families by code 2026-11-30 20:50:21 +01:00
75824ea602
Merge branch 'unify-imports' into develop
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m54s
Reviewed-on: #9
2026-11-30 20:30:53 +01:00
31dda815d9
Ignore the import renames in git blame
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m52s
2026-11-30 20:25:54 +01:00
5c13d719cd
Enforce the established import aliases with ruff
These aliases were already in use before this branch
2026-11-30 20:22:06 +01:00
cf2534f41e
Import velofy.config as pkg_config everywhere 2026-11-30 20:19:35 +01:00
de5e49b497
Import alembic.config as alembic_config 2026-11-30 20:13:46 +01:00
dc45c689c4
Import alembic.command as alembic_cmd 2026-11-30 20:12:41 +01:00
e9743eaa01
Import rpy2.robjects.packages as r_packages 2026-11-30 20:06:09 +01:00
8bca30c836
Import rpy2.rinterface_lib.callbacks as r_callbacks 2026-11-30 20:04:44 +01:00
9b844b16e7
Import statsmodels.tsa.api as tsa
The alias in the `statsmodels` documentation
2026-11-30 20:03:25 +01:00
07e90b7851
Import click.testing as cli_testing
Like `click.core` as `cli_core`
2026-11-30 20:01:43 +01:00
07660ecff9
Import geopy.distance as geo_distance everywhere 2026-11-30 20:01:42 +01:00
d660f0cc4e
Import googlemaps as gm everywhere 2026-11-30 20:01:41 +01:00
d006752194
Enforce the import conventions with ruff
flake8 has no plugin with configurable aliases
2026-11-30 17:18:29 +01:00
5ca16ae47c
Import datetime as dt everywhere 2026-11-30 15:50:17 +01:00
f0c617955b
Use the nox module import 2026-11-30 15:44:05 +01:00
9c3b52befb
Import typing as t ...
... and `collections.abc` as `cabc`

Linting rule for `velofy`: Import modules instead of objects
2026-11-30 15:42:21 +01:00
c6518f6b39
Use builtin generics and X | None
Since Python 3.9 and 3.10, `list`, `tuple`, and `X | None`
replace `typing.List`, `typing.Tuple`, and `typing.Optional`
2026-11-30 15:07:47 +01:00
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