aboutsummaryrefslogtreecommitdiff
path: root/pyproject.toml
diff options
context:
space:
mode:
Diffstat (limited to 'pyproject.toml')
-rw-r--r--pyproject.toml150
1 files changed, 138 insertions, 12 deletions
diff --git a/pyproject.toml b/pyproject.toml
index eed7728..508408b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,8 +1,8 @@
[build-system]
-requires = ["setuptools"]
-build-backend = "setuptools.build_meta"
-#requires = ["hatchling"]
-#build-backend = "hatchling.build"
+#requires = ["setuptools"]
+#build-backend = "setuptools.build_meta"
+requires = ["hatchling"]
+build-backend = "hatchling.build"
#requires = ["pdm-backend"]
#build-backend = "pdm.backend"
@@ -54,15 +54,141 @@ wikiget = "wikiget.wikiget:main"
[tool.setuptools.dynamic]
version = {attr = "wikiget.version.__version__"}
-#[tool.hatch.version]
-#path = "src/wikiget/version.py"
+[tool.hatch.version]
+path = "wikiget/version.py"
#[tool.pdm]
-#version = { source = "file", path = "src/wikiget/version.py" }
+#version = { source = "file", path = "wikiget/version.py" }
-[tool.pytest.ini_options]
-addopts = [
- "--import-mode=importlib",
- "--cov=wikiget",
+#[tool.pytest.ini_options]
+#addopts = [
+# "--import-mode=importlib",
+# "--cov=wikiget",
+#]
+#testpaths = ["test"]
+
+[tool.hatch.envs.default]
+dependencies = [
+ "coverage[toml]>=6.5",
+ "pytest",
+]
+[tool.hatch.envs.default.scripts]
+test = "pytest {args:test}"
+test-cov = "coverage run -m pytest {args:test}"
+cov-report = [
+ "- coverage combine",
+ "coverage report",
+]
+cov = [
+ "test-cov",
+ "cov-report",
]
-testpaths = ["test"]
+
+[[tool.hatch.envs.all.matrix]]
+python = ["3.7", "3.8", "3.9", "3.10", "3.11"]
+
+[tool.hatch.envs.lint]
+detached = true
+dependencies = [
+ "black>=23.1.0",
+ "mypy>=1.0.0",
+ "ruff>=0.0.243",
+]
+[tool.hatch.envs.lint.scripts]
+typing = "mypy --install-types --non-interactive {args:wikiget test}"
+style = [
+ "ruff {args:.}",
+ "black --check --diff {args:.}",
+]
+fmt = [
+ "black {args:.}",
+ "ruff --fix {args:.}",
+ "style",
+]
+all = [
+ "style",
+ "typing",
+]
+
+[tool.black]
+target-version = ["py37"]
+line-length = 120
+skip-string-normalization = true
+
+[tool.ruff]
+target-version = "py37"
+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 complexity
+ "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
+]
+unfixable = [
+ # Don't touch unused imports
+ "F401",
+]
+
+[tool.ruff.isort]
+known-first-party = ["wikiget"]
+
+[tool.ruff.flake8-tidy-imports]
+ban-relative-imports = "all"
+
+[tool.ruff.per-file-ignores]
+# Tests can use magic values, assertions, and relative imports
+"test/**/*" = ["PLR2004", "S101", "TID252"]
+
+[tool.coverage.run]
+source_pkgs = ["wikiget"]
+branch = true
+parallel = true
+omit = [
+ "wikiget/version.py",
+]
+
+[tool.coverage.paths]
+hatchtest = ["wikiget"]
+tests = ["test"]
+
+[tool.coverage.report]
+exclude_lines = [
+ "no cov",
+ "if __name__ == .__main__.:",
+ "if TYPE_CHECKING:",
+]
+
+[[tool.mypy.overrides]]
+module = ["mwclient"]
+ignore_missing_imports = true