-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
173 lines (153 loc) · 4.14 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
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
[build-system]
requires = ["setuptools >= 40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
ds = ["py.typed"]
[project.scripts]
ds = "ds:main"
[tool.setuptools.dynamic]
version = { attr = "ds.__version__" }
[project.urls]
Homepage = "https://github.com/metaist/ds"
Documentation = "https://metaist.github.io/ds/"
Repository = "https://github.com/metaist/ds.git"
Changelog = "https://github.com/metaist/ds/blob/main/CHANGELOG.md"
[project]
name = "ds-run"
description = "run dev scripts"
keywords = ["dev", "scripts"]
dynamic = ["version"]
requires-python = ">=3.8"
dependencies = [
# app => version pinned exactly
# TODO 2024-10-31 @ py3.8 EOL: remove
"graphlib_backport==1.1.0; python_version < '3.9'",
# TODO 2026-10-31 @ py3.10 EOL: remove
"tomli==2.0.1; python_version < '3.11'",
]
optional-dependencies = { dev = [
# dev => version latest
"build",
"cogapp",
"coverage",
"mypy",
"pdoc3",
"pip",
"pyright",
"pytest-cov",
"pytest",
"ruff",
"cosmofy>=0.1.0",
] }
readme = "README.md"
license = { text = "MIT" }
authors = [{ name = "Metaist LLC", email = "metaist@metaist.com" }]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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",
"Topic :: Software Development :: Build Tools",
"Typing :: Typed",
]
[tool.coverage.report]
exclude_also = ["no cover: start(?s:.)*?no cover: stop"]
[tool.ds.scripts] # run dev scripts <https://github.com/metaist/ds>
# Lint
lint = ["ruff-*", "+cspell"]
ruff-format = "ruff format ${@:-.}"
ruff-lint = "ruff check --fix ${@:-.}"
cspell = "cspell --gitignore '**/*.{py,txt,md,markdown}'"
# Type Check
types = ["pyright", "mypy"]
pyright = "pyright src test"
mypy = """
mypy \
--strict \
--install-types \
--non-interactive \
src test
"""
# Test
test.help = "run unit tests"
test.env = { PYTHONPATH = "src" }
test.shell = """
coverage run --branch --source=src -m \
pytest \
--doctest-modules \
--doctest-ignore-import-errors \
$@ src test;
coverage report --omit=src/cog_helpers.py -m
"""
coverage-report = "coverage html"
coverage-serve = { shell = "python -m http.server 8080", cwd = "htmlcov" }
coverage = ["coverage-*"]
# Documentation
docs = ["cog", "pdoc"]
cog = "cog -r README.md"
pdoc = """
rm -rf docs;
mkdir -p docs;
pdoc \
--html \
--output-dir docs \
--config sort_identifiers=False \
--config show_inherited_members=True \
--force src/$(basename $(pwd));
mv docs/**/* docs/;
touch docs/.nojekyll
"""
# Common
dev.help = "lint, type-check, and unit tests"
dev.composite = ["lint", "types", "test"]
dev-all.help = "check every supported python version"
dev-all.shell = """
ds lint;
versions=($(grep -oP '(?<=Python :: )[0-9]+\\.[0-9]+' pyproject.toml));
for v in ${versions[@]};
do
uv run --isolated --all-extras --python $v -- ds types test;
echo;
done;
"""
# Build
build = ["pip install -e .", "python -m build", "cosmo"]
cosmo.help = "build portable executable (cosmopolitan)"
cosmo.shell = """
cosmofy src/ds --output dist/ds \
--release-url https://github.com/metaist/ds/releases/latest/download/ds
"""
clean = """
rm -rf .mypy_cache;
rm -rf .pytest_cache;
rm -rf .ruff_cache;
rm -rf dist;
rm -rf htmlcov;
rm -rf src/*.egg-info
rm -rf .coverage;
"""
# Release
recent.help = "see commits since last tag"
recent.shell = "git log --oneline --color $(git describe --tags --abbrev=0)..HEAD"
recent-closed = ["recent | rg 'closes #'"]
release.help = "commit & tag the release"
release.shell = """
git commit -am "release: $1";
git tag $1;
git push;
git push --tags;
git checkout main;
git merge --no-ff --no-edit prod;
git push
"""