SRE/Data Persistence/Documentation/Python
Appearance
Python development tips
This page documents Python development tips for the Data Persistence team and SREs in general.
If you starting a new project you might also consider https://gitlab.wikimedia.org/repos/data_persistence/service-template
pyproject.toml
Create pyproject.toml as:
[tool.pylsp-mypy]
# Enable mypy integration in the Python LSP server
enabled = true
live_mode = true
# strict = true
[tool.mypy]
# Fine-grained mypy configuration. You can incrementally enable stricter checks as you improve type hints.
# check_untyped_defs = true
# disallow_incomplete_defs = true
# disallow_untyped_calls = true
follow_imports = "skip"
ignore_missing_imports = true
pretty = true
show_error_context = true
strict_equality = true
strict = false
warn_unused_configs = true
x[tool.black]
line-length = 120
[tool.flake8]
max-line-length = 120
#[tool.coverage.run]
#omit = [
# "<myprojectname>/tests/*"
#]
This replaces the need for dedicated conf files for mypy and tox.
Security
Where possible consider using only dependencies from Debian instead of pip/poetry install.