From b87b071d7575354e0b90e011efbe46da23aa9c8e Mon Sep 17 00:00:00 2001 From: mat ess Date: Fri, 11 Aug 2023 16:06:01 -0400 Subject: [PATCH] Update template --- pyproject.toml | 129 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 112 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 00a5ebd..e5fdfff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" name = "roll" description = "for initiative!" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.11" keywords = [] # license-files = { paths = ["LICENSE.txt"] } authors = [ @@ -15,9 +15,6 @@ authors = [ classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", @@ -35,29 +32,127 @@ Source = "https://git.mat.services/mat/roll" [project.scripts] roll = "roll.cli:roll" -[tool.hatch.envs.default] -dependencies = [ - "pytest", - "pytest-cov", -] -[tool.hatch.envs.default.scripts] -cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=roll --cov=tests {args}" -no-cov = "cov --no-cov {args}" - -[[tool.hatch.envs.test.matrix]] -python = ["37", "38", "39", "310", "311"] - - [tool.hatch.version] path = "roll/__about__.py" +[tool.hatch.envs.default] +dependencies = [ + "coverage[toml]>=6.5", + "pytest", +] +[tool.hatch.envs.default.scripts] +test = "pytest {args:tests}" +test-cov = "coverage run -m pytest {args:tests}" +cov-report = [ + "- coverage combine", + "coverage report", +] +cov = [ + "test-cov", + "cov-report", +] + +[[tool.hatch.envs.all.matrix]] +python = ["3.11"] + +[tool.hatch.envs.lint] +detached = true +dependencies = [ + "black>=23.1.0", + "pyright>=1.1.319", + "ruff>=0.0.243", + "pytest", # for types in tests +] +[tool.hatch.envs.lint.scripts] +typing = "pyright --project pyproject.toml --dependencies {args:roll tests}" +style = [ + "ruff {args:.}", + "black --check --diff {args:.}", +] +fmt = [ + "black {args:.}", + "ruff --fix {args:.}", + "style", +] +all = [ + "style", + "typing", +] + +[tool.black] +target-version = ["py311"] +line-length = 120 +skip-string-normalization = true + +[tool.ruff] +target-version = "py311" +line-length = 120 +select = [ + "A", + "ARG", + "B", + "C", + "DTZ", + "E", + "EM", + "F", + "FBT", + "I", + "ICN", + "ISC", + "N", + "PLC", + "PLE", + "PLR", + "PLW", + "Q", + "RUF", + "S", + "T", + "TID", + "UP", + "W", + "YTT", +] +ignore = [ + # Allow non-abstract empty methods in abstract base classes + "B027", + # Allow boolean positional values in function calls, like `dict.get(... True)` + "FBT003", + # Ignore checks for possible passwords + "S105", "S106", "S107", + # Ignore insecure random checks + "S311", + # Ignore complexity + "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915", +] +unfixable = [ + # Don't touch unused imports + "F401", +] + +[tool.ruff.isort] +known-first-party = ["roll"] + +[tool.ruff.flake8-tidy-imports] +ban-relative-imports = "all" + +[tool.ruff.per-file-ignores] +# Tests can use magic values, assertions, and relative imports +"tests/**/*" = ["PLR2004", "S101", "TID252"] + [tool.coverage.run] +source_pkgs = ["roll", "tests"] branch = true parallel = true omit = [ "roll/__about__.py", ] +[tool.coverage.paths] +roll = ["roll", "*/roll/roll"] +tests = ["tests", "*/roll/tests"] + [tool.coverage.report] exclude_lines = [ "no cov",