ICTU/quality-time

View on GitHub
components/shared_code/pyproject.toml

Summary

Maintainability
Test Coverage
[project]
name = "shared_code"
version = "5.13.0"
dependencies = [
    "bottle==0.12.25",
    "packaging==24.0",
    "pydantic==2.7.2",
    "pymongo==4.7.2",
    "python-dateutil==2.9.0.post0",
]

[project.optional-dependencies]
dev = [
    "coverage==7.5.3",
    "mongomock==4.1.2",
    "pip==24.0",
    "pipx==1.6.0",
    "pip-tools==7.4.1",  # To add hashes to requirements
    "types-python-dateutil==2.9.0.20240316",
    "unittest-xml-reporting==3.2.0",  # Needed to generate JUnit XML output for Sonarcloud.io
]
tools = [
    "bandit==1.7.8",
    "mypy==1.10.0",
    "pip-audit==2.7.3",
    "pydantic==2.7.2",  # Needed because pipx needs to inject Pydantic into the mpyp venv, see ci/quality.sh
    "ruff==0.4.7",
    "safety==3.2.0",
    "vulture==2.11"
]

[tool.mypy]
plugins = "pydantic.mypy"
ignore_missing_imports = false
incremental = false
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_ignores = true
disable_error_code = "valid-type"  # mypy does not yet support PEP 695, Type Parameter Syntax. See https://github.com/python/mypy/issues/15238

[[tool.mypy.overrides]]
module = [
    "pymongo",
    "bottle"
]
ignore_missing_imports = true

[tool.pip-tools]
allow_unsafe = true
generate_hashes = true
quiet = true
strip_extras = true
upgrade = true

[tool.ruff]
target-version = "py312"
line-length = 120
src = ["src"]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    "ANN001",  # https://docs.astral.sh/ruff/rules/missing-type-function-argument/ - too many untyped arguments atm to turn this rule on
    "ANN002",  # https://docs.astral.sh/ruff/rules/missing-type-args/ - leads to false positives for super().__init__(*args, **kwargs)
    "ANN003",  # https://docs.astral.sh/ruff/rules/missing-type-kwargs/ - leads to false positives for super().__init__(*args, **kwargs)
    "ANN101",  # https://docs.astral.sh/ruff/rules/missing-type-self/ - type checkers can infer the type of `self`, so annotating it is superfluous
    "ANN102",  # https://docs.astral.sh/ruff/rules/missing-type-cls/ - type checkers can infer the type of `cls`, so annotating it is superfluous
    "COM812",  # https://docs.astral.sh/ruff/rules/missing-trailing-comma/ - this rule may cause conflicts when used with the ruff formatter
    "D107",    # https://docs.astral.sh/ruff/rules/undocumented-public-init/ - requiring __init__() methods to have docstrings seems a bit much
    "D203",    # https://docs.astral.sh/ruff/rules/one-blank-line-before-class/ - prevent warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`
    "D213",    # https://docs.astral.sh/ruff/rules/multi-line-summary-second-line/ - prevent warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`
    "FBT",     # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt - not sure of the value of preventing "boolean traps"
    "ISC001",  # https://docs.astral.sh/ruff/rules/single-line-implicit-string-concatenation/ - this rule may cause conflicts when used with the ruff formatter
    "PD",      # https://docs.astral.sh/ruff/rules/#pandas-vet-pd - pandas isn't used
    "PT",      # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt - pytest isn't used
]

[tool.ruff.lint.isort]
section-order = ["future", "standard-library", "third-party", "first-party", "tests", "local-folder"]

[tool.ruff.lint.isort.sections]
"tests" = ["tests"]

[tool.ruff.lint.per-file-ignores]
".vulture_ignore_list.py" = ["ALL"]
"__init__.py" = [
    "D104",  # https://docs.astral.sh/ruff/rules/undocumented-public-package/ - don't require doc strings in __init__.py files
    "F401",  # https://docs.astral.sh/ruff/rules/unused-import/ - imports in __init__.py files are used to flatten the module hierarchy
]
"src/shared_data_model/**/*.py" = [
    "RUF012",  # https://docs.astral.sh/ruff/rules/mutable-class-default/ - Pydantic models' class attributes are used to specify instance attributes
]
"tests/**/*.py" = [
    "ANN201",  # https://docs.astral.sh/ruff/rules/missing-return-type-undocumented-public-function/ - don't require test functions to have return types
]

[tool.setuptools.packages.find]
where = ["src"]