-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
161 lines (143 loc) · 3.88 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
[build-system]
requires = ["setuptools >= 40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
castfit = ["py.typed"]
[tool.setuptools.dynamic]
version = { attr = "castfit.__version__" }
[project.urls]
Homepage = "https://github.com/metaist/castfit"
Documentation = "https://metaist.github.io/castfit/"
Repository = "https://github.com/metaist/castfit.git"
Changelog = "https://github.com/metaist/castfit/blob/main/CHANGELOG.md"
[project]
name = "castfit"
description = "Basic type casting."
keywords = ["type", "casting"]
dynamic = ["version"]
requires-python = ">=3.9"
dependencies = [
# lib => pinned range
]
optional-dependencies = { dev = [
# dev => latest
"build",
"cogapp",
"coverage",
"ds-run",
"mypy",
"pdoc3",
"pip",
"pyright",
"pytest-cov",
"pytest",
"ruff",
] }
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.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries",
"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=($(rg -oN --pcre2 '(?<=Python :: )(\\d+\\.\\d+)' 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"]
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;
awk 'BEGIN {count=0} /---/ {count++} count==2 && !/---/ {print} count==3 {exit}' \
CHANGELOG.md | gh release create $1 dist/* --draft --verify-tag --title $1 --notes-file -
"""