Skip to content

pyproject.toml cleanup #50

@lwasser

Description

@lwasser

Is it possible to clean up the pyproject.toml just a little bit so the spacing is uniform between tables? It will be easier to read if each table has a space after it! some do and others don't.

[tool.hatch.build]
only-packages = true

[tool.hatch.build.targets.wheel]
packages = ["src/mypkg"]
[tool.pytest.ini_options]
testpaths = ["tests"]
markers = ["raises"]

[tool.coverage.paths]
source = [
    "src/mypkg",
    "*/site-packages/mypkg",
]

[tool.coverage.run]
branch = true
parallel = true

[tool.coverage.report]
exclude_lines = ["pragma: no cover"]
precision = 2
[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    "D107",  # 'Missing docstring in __init__' ignored because pydoclint wants us to document the class instead.
    "D203",  # '1 blank line required before class docstring' ignored because we want no blank line.
    "D212",  # 'Multi-line docstring summary should start at the first line' ignored because we want the summary to start on the second line.
    "D407",  # 'Missing dashed underline after section' ignored because Google style docstrings don't underline.
    "ANN002",  # 'Missing type annotation for {*args} in method'.
    "ANN003",  # 'Missing type annotation for {*kwargs} in method'.
    "ANN101",  # 'Missing type annotation for {self} in method'.
    "ANN102",  # 'Missing type annotation for {cls} in classmethod'.
]
exclude = [
    "docs/conf.py",
]

[tool.ruff.lint.extend-per-file-ignores]
"__init__.py" = [
    "E401",  # 'Multiple imports on one line'
    "E402",  # 'Module level import not at top of file'
    "F401",  # 'Imported but unused'
    "I001",  # 'Import block is un-sorted or un-formatted' ignored because we may have to import in a particular, not-alphabetical order.
]
"tests/**/*.py" = [
    "S101",  # 'Use of assert detected' ignored because we are using pytest.
    "INP001",  # 'Insecure input' ignored because we are testing.
    "ANN201",  # 'Missing type annotation for {return}' ignored because all tests return `None`.
]

[tool.ruff.lint.isort]
case-sensitive = true
known-first-party = ["src", "mypkg"]
lines-after-imports = 1

[tool.pydoclint]
style = "google"  # TODO: Other styles are possible here, like 'numpy'
arg-type-hints-in-docstring = false
check-return-types = false
check-yield-types = false
################################################################################
# Hatch Environments
################################################################################
[tool.hatch.envs.style]
description = """Check the style of the codebase."""
dependencies = [
    "pydoclint",
    "ruff",
]
detached = true

[tool.hatch.envs.style.scripts]
docstrings = "pydoclint"
code = "ruff check {args}"
format = "ruff format {args}"
check = ["docstrings", "code"]

[tool.hatch.envs.audit]
description = """Check dependencies for security vulnerabilities."""
extra-dependencies = [
    "pip-audit",
]

[tool.hatch.envs.audit.scripts]
check = ["pip-audit"]
[tool.hatch.envs.docs]
description = """Build or serve the documentation."""
dependencies = [
    "pydata_sphinx_theme ~=0.16",
    "myst-parser ~=4.0",
    "Sphinx ~=8.0",
    "sphinx-autobuild ==2024.10.3"
]

[tool.hatch.envs.docs.scripts]
build = ["sphinx-apidoc -o docs/api src/mypkg", "sphinx-build {args:-W -b html docs docs/_build}"]
serve = ["sphinx-apidoc -o docs/api src/mypkg", "sphinx-autobuild docs --watch src/mypkg {args:-b html docs/_build/serve}"]

[tool.hatch.envs.install]
description = """Test the installation the package."""
dependencies = [
    "pip",
    "twine",
]
detached = true

[tool.hatch.envs.install.scripts]
check = [
    "pip check",
    "hatch build {args:--clean}",
    "twine check dist/*",
]
[tool.hatch.envs.test]
description = """Run the test suite."""
extra-dependencies = [
    "pytest",
    "pytest-cov",
    "pytest-raises",
    "pytest-randomly",
    "pytest-xdist",
]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12", "3.13"]

[tool.hatch.envs.test.scripts]
run = "pytest {args:--cov=mypkg --cov-report=term-missing}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions