Files
esta-python-template/template/pyproject.toml.jinja
2025-10-11 17:03:02 +02:00

102 lines
3.2 KiB
Django/Jinja

[project]
# we prefix the package name with `sbb-` to defend against dependency confusion, see https://confluence.sbb.ch/x/Fxa9lg
name = "sbb-{{ name }}"
description = "{{ description }}"
authors = {{ authors }}
readme = "README.md"
license = "Proprietary"
dynamic = ["version", "dependencies"]
requires-python = "~= {{ python_version }}.0" # = fix minor version to {{ python_version }}.*
[project.urls]
repository = "https://code.sbb.ch/projects/{{ bitbucket_organization }}/repos/{{ name }}"
documentation = "https://code.sbb.ch/projects/{{ bitbucket_organization }}/repos/{{ name }}/browse/README.md"
[project.scripts]
entrypoint = '{{ package_name }}.main:cli'
[tool.poetry]
version = "0.0.0" # Version is ignored and set by Tekton. Use pipeline to increase.
requires-poetry = ">=2.0"
packages = [{include = "{{ package_name }}", from = "src"}]
[tool.poetry.dependencies]
numpy = "~2.3.0" # NumPy is the fundamental package for array computing with Python.
[tool.poetry.group.dev.dependencies]
coverage = {extras = ["toml"], version = "~7.10.4"} # Code coverage measurement for Python
unittest-xml-reporting = "~3.2" # unittest-based test runner with Ant/JUnit like XML reporting.
pre-commit = "~4.3.0" # A framework for managing and maintaining multi-language pre-commit hooks.
pre-commit-hooks = "~5.0.0" # Some out-of-the-box hooks for pre-commit.
mypy = "~1.18.0" # Tool for static type-checking
ruff = "~0.13.0" # Extremely fast python linter and formatter
{%- if use_ggshield %}
ggshield = "^1.23.0" # Tool to check for leaked secrets
{% endif %}
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.mypy]
python_version = "{{ python_version }}"
plugins = "numpy.typing.mypy_plugin"
strict = true
[tool.coverage.run]
command_line = "-m xmlrunner discover --output-file junittest.xml"
[tool.ruff]
line-length = 140
indent-width = 4
exclude = [
".git",
".git-rewrite",
".ipynb_checkpoints",
".mypy_cache",
".pyenv",
".pytype",
".ruff_cache",
".venv",
".vscode",
"**/*.yaml",
"**/*.yml"
]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.ruff.lint]
select = [
"D", "E", "W", # Pydocstyle rules
"I", # Isort rules
"PL", # Pylint rules
"F", # Pyflake
"N", # Pep8-naming
"G", # Flake8-logging-format
"ARG", # Flake8-unused-arguments
"RUF100", # fail on unused noqa
]
ignore=[]
fixable = ["I"]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["D", "E", "W"] # Ignore Pydocstyle warnings & errors in "test/*" directory
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pylint]
max-args = 8