-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.mise.toml
More file actions
158 lines (133 loc) · 4.13 KB
/
Copy path.mise.toml
File metadata and controls
158 lines (133 loc) · 4.13 KB
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
[tools]
python = "3.13"
uv = "latest"
[env]
_.file = { path = ".env", redact = true }
[tasks.clean]
description = "Remove build artifacts and distribution files"
run = "rm -rf dist build"
[tasks.build]
description = "Build source and wheel distributions"
depends = ["clean"]
run = "uv build"
[tasks.test]
description = "Run the test suite with pytest"
env = { PYTHONPATH = "src" }
run = "uv run pytest test"
[tasks.test-version]
description = "Run the test suite with pytest on a specific python version"
usage = '''
arg "version" "Python version to run tests with"
'''
env = { PYTHONPATH = "src" }
run = "uv run --python $usage_version --group dev --isolated pytest"
[tasks.test-310]
run = "mise test-version 3.10"
[tasks.test-311]
run = "mise test-version 3.11"
[tasks.test-312]
run = "mise test-version 3.12"
[tasks.test-313]
run = "mise test-version 3.13"
[tasks.test-314]
run = "mise test-version 3.14"
[tasks.test-matrix]
description = "Run the test suite with pytest on a matrix of python versions"
depends = [
"test-310",
"test-311",
"test-312",
"test-313",
"test-314",
]
[tasks.lint]
description = "Run linting checks"
run = "uv run ruff check src/ test/ tools/"
[tasks.format]
description = "Format code with ruff"
run = "uv run ruff format src/ test/ tools/"
[tasks.format-check]
description = "Check code formatting with ruff"
run = "uv run ruff format --check src/ test/ tools/"
[tasks.mypy]
description = "Run mypy"
run = "uv run --isolated --with mypy --group dev mypy ."
[tasks.ci]
description = "Run continuous integration tasks"
depends = ["format-check", "lint", "build", "test-matrix"]
run = [
{ tasks = ["format-check", "lint"] },
{ tasks = ["build"] },
{ tasks = ["test-matrix"] },
]
[tasks.bump]
description = "Bump version and commit changes"
usage = '''
arg "version" "Version number to bump to"
'''
run = '''
echo "__version__ = \"$usage_version\"" > src/pylabeador/__version__.py
git add src/pylabeador/__version__.py
git commit -m "Bump version to $usage_version"
'''
[tasks.tag]
description = "Create a git tag with the current version"
run = "version=$(uv run hatch version) && git tag \"v$version\""
depends = ["clean", "ci"]
[tasks.publish-test]
description = "Publish to test PyPI (requires TEST_PYPI_TOKEN)"
run = '''
if [[ -z $TEST_PYPI_TOKEN ]]; then
echo "Set the token for the test site as \$TEST_PYPI_TOKEN"
exit 1
fi
echo "Uploading to test site"
uv publish --publish-url https://test.pypi.org/legacy/ --token "$TEST_PYPI_TOKEN"
'''
[tasks.publish]
description = "Publish to PyPI (requires REAL_PYPI_TOKEN)"
confirm = "Are you sure you want to publish to PyPI?"
run = '''
if [[ -z $REAL_PYPI_TOKEN ]]; then
echo "Set the token for the REAL PyPI site as \$REAL_PYPI_TOKEN"
exit 1
fi
echo "Uploading to PyPI"
uv publish --token "$REAL_PYPI_TOKEN"
'''
[tasks.publish-check]
description = "Check if the package is ready to be published (is the tip a version tag and is it the same the version in the code?)"
run = '''
git_tag=$(git tag --points-at HEAD)
if [[ -z $git_tag ]]; then
echo "The tip of the current branch is not a version tag"
exit 1
fi
version=$(uv run hatch version)
if [[ $git_tag != v$version ]]; then
echo "The version in the code ($version) is not the same as the version in the tag ($git_tag)"
exit 1
fi
echo "The package is ready to be published"
'''
[tasks.release]
description = "Complete release process: bump, tag, and publish"
depends = ["bump", "tag", "publish"]
[tasks.gen-test-data]
description = "Generate test data"
run = "uv run ./tools/hyphenfile.py -t -i test/spanish-hyphens.txt -o test/spanish-hyphens.txt"
[tasks.generate-readmes]
description = "Generate language-specific README files using MMG"
run = "uv run mmg README.base.md --yes"
[tasks.readme-validate]
description = "Validate the base README file structure"
run = "uv run mmg README.base.md --validation-only"
[tasks.ty]
description = "Run ty type checker"
run = "uv run --isolated --with ty --group dev ty check . --output-format concise"
[tasks.precommit]
description = "Run pre-commit checks"
run = "uv run --group dev pre-commit run --all-files"
[tasks.all-checks]
description = "Run all checks"
depends = ["ci", "ty", "mypy", "precommit"]