1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
|
# Ref: https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
# and https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
[build-system]
requires = ["setuptools >= 75.3.0, < 81.0.0", "wheel ~= 0.42"]
build-backend = "setuptools.build_meta"
[project]
name = "python-semantic-release"
version = "10.3.1"
description = "Automatic Semantic Versioning for Python projects"
requires-python = ">=3.8"
license = { text = "MIT" }
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
readme = "README.rst"
authors = [{ name = "Rolf Erik Lekang", email = "me@rolflekang.com" }]
dependencies = [
"click ~= 8.1.0",
"click-option-group ~= 0.5",
"gitpython ~= 3.0",
"requests ~= 2.25",
"jinja2 ~= 3.1",
"python-gitlab >= 4.0.0, < 7.0.0",
"tomlkit ~= 0.11",
"dotty-dict ~= 1.3",
"importlib-resources ~= 6.0",
"pydantic ~= 2.0",
"rich ~= 14.0",
"shellingham ~= 1.5",
"Deprecated ~= 1.2", # Backport of deprecated decorator for python 3.8
]
[project.scripts]
python-semantic-release = "semantic_release.__main__:main"
semantic-release = "semantic_release.__main__:main"
psr = "semantic_release.__main__:main"
[project.urls]
changelog = "https://github.com/python-semantic-release/python-semantic-release/blob/master/CHANGELOG.md"
documentation = "https://python-semantic-release.readthedocs.io"
homepage = "https://python-semantic-release.readthedocs.io"
issues = "https://github.com/python-semantic-release/python-semantic-release/issues"
repository = "http://github.com/python-semantic-release/python-semantic-release.git"
[project.optional-dependencies]
build = [
"build ~= 1.2"
]
docs = [
"Sphinx ~= 6.0",
"sphinxcontrib-apidoc == 0.5.0",
"sphinx-autobuild == 2024.2.4",
"furo ~= 2024.1",
]
test = [
"coverage[toml] ~= 7.0",
"filelock ~= 3.15",
"flatdict ~= 4.0",
"freezegun ~= 1.5",
"pyyaml ~= 6.0",
"pytest ~= 8.3",
"pytest-clarity ~= 1.0",
"pytest-cov >= 5.0.0, < 7.0.0",
"pytest-env ~= 1.0",
"pytest-lazy-fixtures ~= 1.1.1",
"pytest-mock ~= 3.0",
"pytest-order ~= 1.3",
"pytest-pretty ~= 1.2",
"pytest-xdist ~= 3.0",
"responses ~= 0.25.0",
"requests-mock ~= 1.10",
]
dev = [
"pre-commit ~= 3.5",
"tox ~= 4.11",
"ruff == 0.6.1"
]
mypy = [
"mypy == 1.16.1",
"types-Deprecated ~= 1.2",
"types-requests ~= 2.32.0",
"types-pyyaml ~= 6.0",
]
[tool.setuptools]
include-package-data = true
[tool.setuptools.packages.find]
where = ["src"]
[tool.pytest.ini_options]
env = [
"PYTHONHASHSEED = 123456"
]
addopts = [
# TO DEBUG in single process, swap auto to 0
# "-nauto",
# "-n0",
"-ra",
"--diff-symbols",
"--durations=20",
# No default coverage - causes problems with debuggers
# "--cov=semantic_release",
# "--cov-context=test",
# "--cov-report=html:coverage-html",
# "--cov-report=term-missing",
]
testpaths = [
"tests"
]
markers = [
"unit: mark a test as a unit test",
"e2e: mark a test as a end-to-end test",
"comprehensive: mark a test as a comprehensive (multiple variations) test",
]
[tool.coverage.html]
show_contexts = true
[tool.coverage.run]
omit = ["*/tests/*"]
[tool.bandit]
targets = ["semantic_release"]
[tool.tox]
legacy_tox_ini = """
[tox]
envlist =
mypy,
py{38,39,310,311,312},
coverage
ruff
skipsdist = True
[testenv]
passenv = CI
setenv =
PYTHONPATH = {toxinidir}
TESTING = True
deps = .[test]
commands =
coverage run -p --source=semantic_release -m pytest {posargs:tests}
[testenv:mypy]
deps = .[mypy]
commands =
mypy .
[testenv:coverage]
deps = coverage[toml]
commands =
coverage combine
coverage report -m
coverage xml
[testenv:ruff]
deps = .[dev]
commands =
ruff check . --statistics --output-format=text
"""
[tool.mypy]
python_version = "3.8"
show_column_numbers = true
show_error_context = true
pretty = true
error_summary = true
follow_imports = "normal"
enable_error_code = ["ignore-without-code"]
disallow_untyped_calls = true
# warn_return_any = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
# warn_unused_ignores = true
warn_unused_configs = true
# warn_unreachable = true
disallow_untyped_defs = true
check_untyped_defs = true
cache_dir = "/dev/null"
plugins = ["pydantic.mypy"]
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
[[tool.mypy.overrides]]
module = "flatdict"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "shellingham"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "dotty_dict"
ignore_missing_imports = true
[tool.ruff]
line-length = 88
target-version = "py38"
force-exclude = true
output-format = "grouped"
show-fixes = true
src = ["semantic_release", "tests"]
[tool.ruff.lint]
select = ["ALL"]
# See https://docs.astral.sh/ruff/rules/
# for any of these codes you can also run `ruff rule [CODE]`
# which explains it in the terminal
ignore = [
# attribute shadows builtin (e.g. Foo.list())
"A003",
# Annotations (flake8-annotations)
# missing "self" type-hint
"ANN101",
"ANN102",
"ANN401",
# flake8-bugbear
"B019",
# flake8-commas
"COM",
# Missing docstrings - eventually want to enable
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D107",
"D203",
"D205",
"D212",
"D400",
"D401",
"D404",
"D415",
# flake8-datetimez
"DTZ",
# flake8-errmsg
"EM",
# Some todos and some examples; leave this disabled for now
"ERA001",
# don't compare types, use isinstance()
# sometimes using type(x) == y is deliberately chosen to exclude
# subclasses
"E721",
# flake8-fixme
"FIX",
# flake8-boolean-trap
"FBT",
# No implicit packages
"INP001",
# Errors should end with "Error"
"N818",
# mypy prevents blanket-type-ignore
"PGH003",
# Fixtures that do not return a value need an underscore prefix. The rule
# does not handle generators.
"PT004",
# flake8-pytest-style, values rowtype (list|tuple)
"PT007",
# pytest.raises needs a match - eventually want to enable
"PT011",
"PT012",
"PT013",
# pylint
"PLR",
"PLE1507",
# flake8-use-pathlib
"PTH",
# flake8-raise
"RSE",
# ruff
# This seems to flag a load of false-positives, thinking that the # noqa's are
# unneeded and trying to fix them even though ruff then flags the errors that
# were previously ignored
"RUF100",
# flake8-todos
"TD002",
"TD003",
# tryceratops
"TRY003",
"TRY401",
# other errors that conflict with ruff format
# indentation-with-invalid-multiple
"W191",
"E111",
"E114",
"E117",
"E501",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM812",
"ISC001",
"ISC002",
]
external = ["V"]
task-tags = ["NOTE", "TODO", "FIXME", "XXX"]
[tool.ruff.format]
docstring-code-format = true
indent-style = "space"
line-ending = "lf"
quote-style = "double"
[tool.ruff.lint.per-file-ignores]
# Imported but unused
"__init__.py" = ["F401"]
# pydantic 1 can't handle __future__ annotations-enabled syntax on < 3.10
"src/semantic_release/cli/config.py" = ["UP", "TCH"]
"src/semantic_release/commit_parser/*" = ["UP", "FA", "TCH"]
# Method argument not used. This is mostly a base class
# anyway
"src/semantic_release/hvcs/_base.py" = ["ARG002"]
# from tests.fixtures import * is deliberate
"tests/conftest.py" = ["F403"]
"tests/fixtures/**/__init__.py" = ["F403"]
"tests/*" = [
# unused arguments - likely fixtures to be moved to
# @pytest.mark.usefixtures
"ARG001",
# "assert" used
"S101",
# possible hard-coded password assigned to argument
# because we use "prerelease_token=..." and bandit panics
# when it sees *_token variables
"S105",
"S106",
"S107",
# pseudo-random generators not suitable for cryptographic purposes
# (e.g. random.choice used)
"S311",
# Private member access
"SLF001",
# Annotations
"ANN",
# Using format instead of f-string for readablity
"UP032",
]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.flake8-implicit-str-concat]
allow-multiline = true
[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"
multiline-quotes = "double"
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.flake8-type-checking]
strict = true
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
parametrize-names-type = "csv"
[tool.ruff.lint.isort]
# required-imports = ["from __future__ import annotations"]
combine-as-imports = true
known-first-party = ["semantic_release"]
forced-separate = ["tests"]
relative-imports-order = "closest-to-furthest"
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"tests",
"local-folder",
]
sections = { "tests" = ["tests"] }
[tool.vulture]
ignore_names = ["change_to_ex_proj_dir", "init_example_project"]
[tool.semantic_release]
logging_use_named_masks = true
commit_parser = "conventional"
commit_parser_options = { parse_squash_commits = true, ignore_merge_commits = true }
build_command = """
python -m pip install -e .[build]
python -m build .
"""
major_on_zero = true
version_variables = [
"src/gh_action/requirements.txt:python-semantic-release:nf",
"docs/configuration/automatic-releases/github-actions.rst:python-semantic-release/python-semantic-release:tf",
"docs/configuration/automatic-releases/github-actions.rst:python-semantic-release/publish-action:tf",
]
version_toml = ["pyproject.toml:project.version"]
[tool.semantic_release.changelog]
# default_templates = { changelog_file = "CHANGELOG.rst" }
exclude_commit_patterns = [
'''chore(?:\([^)]*?\))?: .+''',
'''ci(?:\([^)]*?\))?: .+''',
'''refactor(?:\([^)]*?\))?: .+''',
'''style(?:\([^)]*?\))?: .+''',
'''test(?:\([^)]*?\))?: .+''',
'''build\((?!deps\): .+)''',
'''Merged? .*''',
'''Initial Commit.*''',
# Old semantic-release version commits
'''^\d+\.\d+\.\d+''',
]
insertion_flag = "=========\nCHANGELOG\n========="
mode = "update"
template_dir = "config/release-templates"
[tool.semantic_release.branches.main]
match = "^(main|master)$"
prerelease = false
prerelease_token = "rc"
[tool.semantic_release.branches.alpha]
match = "^(feat|fix|perf)/.+"
prerelease = true
prerelease_token = "alpha"
[tool.semantic_release.branches.dev]
match = ".+"
prerelease = true
prerelease_token = "dev"
[tool.semantic_release.remote]
type = "github"
token = { env = "GH_TOKEN" }
[tool.semantic_release.publish]
upload_to_vcs_release = true
|