Files
obsidian-metadata/pyproject.toml
2023-08-31 08:53:42 -04:00

290 lines
8.1 KiB
TOML

[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0"]
[tool.poetry]
authors = ["Nate Landau <github@natenate.org>"]
description = "Make batch updates to Obsidian metadata"
homepage = "https://github.com/natelandau/obsidian-metadata"
keywords = ["obsidian"]
license = "GNU AFFERO"
name = "obsidian-metadata"
readme = "README.md"
repository = "https://github.com/natelandau/obsidian-metadata"
version = "0.12.0"
[tool.poetry.scripts] # https://python-poetry.org/docs/pyproject/#scripts
obsidian-metadata = "obsidian_metadata.cli:app"
[tool.poetry.dependencies]
charset-normalizer = "^3.2.0"
emoji = "^2.8.0"
loguru = "^0.7.0"
python = "^3.10"
questionary = "^1.10.0"
regex = "^2023.8.8"
rich = "^13.5.2"
ruamel-yaml = "^0.17.32"
shellingham = "^1.5.3"
tomlkit = "^0.12.1"
typer = "^0.9.0"
[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
pytest-clarity = "^1.0.1"
pytest-mock = "^3.11.1"
pytest-pretty-terminal = "^1.1.0"
pytest-xdist = "^3.3.1"
[tool.poetry.group.dev.dependencies]
black = "^23.7.0"
commitizen = "^3.7.0"
coverage = "^7.3.0"
interrogate = "^1.5.0"
mypy = "^1.5.1"
pdoc = "^14.0.0"
poethepoet = "^0.22.0"
pre-commit = "^3.3.3"
ruff = "^0.0.286"
sh = "^2.0.6"
types-python-dateutil = "^2.8.19.14"
typos = "^1.16.9"
vulture = "^2.9.1"
[tool.black]
line-length = 100
[tool.commitizen]
bump_message = "bump(release): v$current_version → v$new_version"
changelog_incremental = true
tag_format = "v$version"
update_changelog_on_bump = true
version = "0.12.0"
version_files = ["pyproject.toml:version", "src/obsidian_metadata/__version__.py:__version__"]
[tool.coverage.report] # https://coverage.readthedocs.io/en/latest/config.html#report
exclude_lines = [
'def __repr__',
'except [\w\s\._]+ as .*:',
'log\.critical',
'log\.debug',
'log\.error',
'log\.exception',
'log\.info',
'log\.success',
'log\.trace',
'log\.warning',
'pragma: no cover',
'raise Abort',
'raise Exit',
'raise typer\.Exit',
]
fail_under = 50
precision = 1
show_missing = true
skip_covered = true
[tool.coverage.run]
branch = true
command_line = "--module pytest"
data_file = "reports/.coverage"
source = ["src"]
[tool.coverage.xml]
output = "reports/coverage.xml"
[tool.interrogate]
exclude = ["build", "docs", "tests"]
fail-under = 90
ignore-init-method = true
verbose = 2
[tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html
disallow_any_unimported = false
disallow_subclassing_any = false
disallow_untyped_decorators = false
disallow_untyped_defs = true
exclude = [
'tests/', # TOML literal string (single-quotes, regex okay, no escaping necessary)
]
follow_imports = "normal"
ignore_missing_imports = true
junit_xml = "reports/mypy.xml"
no_implicit_optional = true
pretty = false
show_column_numbers = true
show_error_codes = true
show_error_context = true
strict_optional = false
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = true
[tool.pytest.ini_options]
addopts = "--color=yes --doctest-modules --exitfirst --failed-first --strict-config --strict-markers --verbosity=2 --junitxml=reports/pytest.xml"
filterwarnings = ["error", "ignore::DeprecationWarning"]
testpaths = ["src", "tests"]
xfail_strict = true
[tool.ruff] # https://github.com/charliermarsh/ruff
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
# Avoiding flagging (and removing) `V101` from any `# noqa`
# directives, despite Ruff's lack of support for `vulture`.
external = ["V101"]
fix = true
ignore = [
"B006",
"B008",
"D107",
"D203",
"D204",
"D213",
"D215",
"D404",
"D406",
"D407",
"D408",
"D409",
"D413",
"E501",
"N805",
"PGH001",
"PGH003",
"UP007",
]
ignore-init-module-imports = true
line-length = 100
per-file-ignores = { "cli.py" = [
"PLR0912",
"PLR0913",
], "tests/*.py" = [
"PLR0913",
"PLR2004",
"S101",
] }
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-exception
"C40", # flake8-comprehensions
"C90", # McCabe
"D", # pydocstyle
"E", # pycodestyle Errors
"ERA", # flake8-eradicate
"EXE", # flake8-executable
"F", # pyflakes
"I", # iSort
"N", # Pep8-naming
"PGH", # pygrep-hooks
"PLC", # pylint Convention
"PLE", # pylint Error
"PLR", # pylint Refactor
"PLW", # pylint Warning
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"RET", # flake8-return
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle Warnings
"YTT", # flake8-2020
]
src = ["src", "tests"]
target-version = "py310"
unfixable = ["ERA001", "F401", "F841", "UP007"]
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.ruff.pydocstyle]
convention = "google"
[tool.ruff.pylint]
max-args = 6
[tool.vulture] # https://pypi.org/project/vulture/
# exclude = ["file*.py", "dir/"]
# ignore_decorators = ["@app.route", "@require_*"]
ignore_names = ["args", "cls", "indentless", "kwargs", "request", "version"]
# make_whitelist = true
min_confidence = 80
paths = ["src", "tests"]
sort_by_size = true
verbose = false
[tool.poe.tasks]
[tool.poe.tasks.docs]
cmd = """
pdoc
--docformat google
--output-directory docs
src/obsidian_metadata
"""
help = "Generate this package's docs"
[tool.poe.tasks.lint]
help = "Lint this package"
[[tool.poe.tasks.lint.sequence]]
shell = "ruff src/ --no-fix"
[[tool.poe.tasks.lint.sequence]]
shell = "black --check src/ tests/"
[[tool.poe.tasks.lint.sequence]]
shell = "poetry check"
[[tool.poe.tasks.lint.sequence]]
shell = "mypy --config-file pyproject.toml src/"
[[tool.poe.tasks.lint.sequence]]
shell = "vulture src/ tests/"
[[tool.poe.tasks.lint.sequence]]
shell = "yamllint ."
[[tool.poe.tasks.lint.sequence]]
shell = "typos"
[[tool.poe.tasks.lint.sequence]]
shell = "interrogate -c pyproject.toml ."
[tool.poe.tasks.test]
help = "Test this package"
[[tool.poe.tasks.test.sequence]]
cmd = "coverage run"
[[tool.poe.tasks.test.sequence]]
cmd = "coverage report"
[[tool.poe.tasks.test.sequence]]
cmd = "coverage xml"