generated from Wesztman/pyproject-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpyproject.toml
115 lines (103 loc) · 2.98 KB
/
pyproject.toml
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
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
[tool.pdm.version]
source = "scm"
[project]
name = "get-py-deps"
description = ""
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["prettytable~=3.10.0", "setuptools~=69.1.1"]
dynamic = ["version"]
[project.optional-dependencies]
lint = [
"ruff~=0.2.1",
"mypy~=1.8.0",
"types-setuptools~=69.1.0.20240229",
"pyright~=1.1.352",
]
test = ["pytest~=8.0.0", "pytest-cov~=4.1.0", "coverage[toml]~=7.4.1"]
dev = ["pre-commit~=3.6.1", "get-py-deps[lint]", "get-py-deps[test]"]
[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
[project.scripts]
get-py-deps = "get_py_deps.main:_cli"
[project.urls]
Repository = "https://github.com/Wesztman/get-py-deps"
[tool.pdm.scripts]
# Misc
_add-title.shell = "echo '\\e[35m##################################### {args} #####################################\\e[0m'"
_print-python-version.shell = "python --version"
_print-success.shell = "echo '\n\\e[32m{args}\\e[0m'"
# Runs before each pdm run command
pre_run = { composite = [
"_add-title 'Checking dependencies'",
"pdm sync -G dev",
"_print-python-version",
], help = "Check and install dependencies, run automatically before each `pdm run`" }
# Test
test = { composite = [
"_add-title 'Running Pytest'",
"pytest {args:tests/ --cov src/get_py_deps --cov-report term --cov-report html}",
], help = "Run pytest with coverage report" }
# Linting
_precommit = { shell = "pre-commit run --all-files" } # incl. ruff lint, ruff format, and lock file check
_mypy-typecheck = { shell = "mypy ." }
_pyright-typecheck = { shell = "pyright ." }
lint = { composite = [
"_add-title 'Running linting'",
"_precommit",
"_mypy-typecheck",
"_pyright-typecheck",
], help = "Run linting incl. pre-commit, typechecks, ruff format, lint and lock file check" }
# Build
build = { composite = [
"_add-title 'Building package'",
"pdm build",
], help = "Build the package in the dist/ directory" }
# Run all checks
all = { composite = [
"lint",
"test",
"build",
"_print-success '🎉🎉 All checks passed 🎉🎉'",
], help = "Run all tests and checks, as well as building the package" }
[tool.ruff]
src = ["src"]
[tool.ruff.lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
]
[tool.ruff.lint.extend-per-file-ignores]
"tests/**" = [
"S101", # Use of `assert` detected
"D103", # Missing docstring in public function
]
"**/__init__.py" = [
"F401", # Imported but unused
"F403", # Wildcard imports
]
"docs/**" = [
"INP001", # Requires __init__.py but docs folder is not a package.
]
[tool.mypy]
disallow_untyped_defs = true
warn_unused_ignores = true
exclude = [".venv/", "dist/", "tests/"]
[tool.coverage.run]
omit = ["*tests*"]