Skip to content

Add type-checking #26

@exhuma

Description

@exhuma

The code-base should be fully type-checked.

The project is fairly old and was based on Flask and SQLAlchemy 1.x. Both packages were not very strong with type-checking.

The latest development is focussing FastAPI, Pydantic 2.x, and SQLAlchemy 2.0 which offer much better type-hinting capabilities. As a consequence of not having proper type-checking, the current code-base cannot easily be analyse statically.

Add type-hints to the code-base trying to avoid "Any" as much as possible. Some areas (like function decorators) may need generics. If that's the case we should use the new Python 3.12+ syntax for those. If avoiding the "Any" type would generate more than 10 additional lines of code then we allow using the Any type to avoid blowing up code complexity.

The code should b echecked using "mypy" in "strict" mode. We also need to configure VS-Code to properly run mypy. When configuring mypy we should consider that the project dependencies are installed via uv and live in the ".venv" folder which is relative to the project-root. When running mypy, it should use that virtual-environment to find dependencies.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions