Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
382 lines (349 loc) · 12 KB
/
Copy pathpyproject.toml
File metadata and controls
382 lines (349 loc) · 12 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
[build-system]
requires = ["maturin>=1.9.3,<2.0"]
build-backend = "maturin"
[project]
name = "basedpython"
version = "0.0.1b1"
description = "a transpiler for both Python and basedpython"
authors = [{ name = "Astral Software Inc.", email = "hey@astral.sh" }]
readme = "README.md"
requires-python = ">=3.7"
license = "MIT"
license-files = ["LICENSE"]
keywords = [
"automation",
"flake8",
"pycodestyle",
"pyflakes",
"pylint",
"clippy",
]
classifiers = [
"Development Status :: 1 - Planning",
"Environment :: Console",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"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",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Rust",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Compilers",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Pre-processors",
"Topic :: Software Development :: Code Generators",
]
[project.urls]
Repository = "https://github.com/KotlinIsland/basedpython"
Documentation = "https://kotlinisland.github.io/basedpython/"
Changelog = "https://github.com/KotlinIsland/basedpython/blob/main/CHANGELOG.md"
# builds the standalone distribution crate, which produces both the `by`
# (type-checker / transpiler) and `buff` (linter / formatter) binaries. maturin
# packages every bin of the target crate as a console script, so the wheel ships
# both. the two tools are exposed purely as those scripts — a single
# `python -m basedpython` would be ambiguous between them
#
# the python package alongside them is not an api: it is `basedpython.build`, the
# PEP 517 backend a basedpython project names in its own `[build-system]`. it has
# to be importable from the same distribution as `by`, because building a project
# means running `by` and a backend that found a different one on `PATH` would be
# transpiling with a version nobody chose
[tool.maturin]
bindings = "bin"
manifest-path = "crates/basedpython/Cargo.toml"
python-source = "python"
module-name = "basedpython"
strip = true
[dependency-groups]
dev = [
"astral-dev-toolchain-cargo-codspeed>=5.0.1",
"astral-dev-toolchain-cargo-fuzz>=0.13.2",
"astral-dev-toolchain-cargo-insta>=1.48.0",
"astral-dev-toolchain-cargo-nextest>=0.9.143",
"astral-dev-toolchain-cargo-shear>=1.13.4",
"astral-dev-toolchain-hyperfine>=1.20.0",
"prek==0.4.12",
]
basedpython-docs = [
"basedpython-pygments",
"zensical",
]
release = [
"rooster==0.1.1",
]
docs = [
"mkdocs>=1.6.1",
"mkdocs-github-admonitions-plugin>=0.1.1",
"mkdocs-llmstxt>=0.2.0",
"mkdocs-material>=9.7.7",
"mkdocs-redirects>=1.2.3",
"pyyaml>=6.0.3",
]
# The compatibility tests use the Ruff binary built from this checkout.
ruff-lsp-test = [
"lsprotocol>=2023.0.0",
"packaging>=23.1",
# ruff-lsp uses the pygls 1.x server API.
"pygls>=1.1.0,<2",
"pytest>=9.0.3,<10",
"pytest-asyncio>=0.21.2",
"python-lsp-jsonrpc>=1.0.0",
"typing-extensions>=4.7.1",
]
ty-ecosystem = [
"ecosystem-analyzer",
]
typeshed-docstrings = [
"docstring-adder",
]
typeshed-formatting = [
"black",
]
[tool.uv]
no-build = true
# CI installs the local ecosystem runner and tools pinned to Git revisions.
no-binary-package = [
# a local path dependency, so it is always built from source and `no-build` above
# would otherwise refuse it
"basedpython-pygments",
"black",
"docstring-adder",
"ecosystem-analyzer",
"mypy-primer",
"ruff-ecosystem",
"typeshed-client",
]
# Pin the isolated build environment for source-build exceptions.
build-constraint-dependencies = [
"flit-core==4.0.2",
"hatch-fancy-pypi-readme==25.1.0",
"hatch-vcs==0.5.0",
"hatchling==1.32.0",
"packaging==26.3",
"pathspec==1.1.1",
"pluggy==1.6.0",
"setuptools==84.0.0",
"setuptools-scm==10.2.1",
"tomli==2.4.1; python_version < '3.11'",
"tomlkit==0.15.1",
"trove-classifiers==2026.6.1.19",
"typing-extensions==4.16.0; python_version < '3.11'",
"uv-build==0.12.3",
"vcs-versioning==2.2.4",
"wheel==0.47.0",
]
exclude-newer = "P7D"
[tool.uv.exclude-newer-package]
astral-dev-toolchain-hyperfine = "2026-08-27T00:00:00Z"
astral-dev-toolchain-cargo-shear = "2026-08-27T00:00:00Z"
astral-dev-toolchain-cargo-codspeed = "2026-08-27T00:00:00Z"
astral-dev-toolchain-cargo-nextest = "2026-08-27T00:00:00Z"
astral-dev-toolchain-cargo-insta = "2026-08-27T00:00:00Z"
astral-dev-toolchain-cargo-fuzz = "2026-09-01T00:00:00Z"
[tool.uv.dependency-groups]
dev = { requires-python = ">=3.12" }
basedpython-docs = { requires-python = ">=3.12" }
docs = { requires-python = ">=3.12" }
release = { requires-python = ">=3.12" }
ruff-lsp-test = { requires-python = ">=3.12" }
ty-ecosystem = { requires-python = ">=3.13" }
typeshed-docstrings = { requires-python = ">=3.10" }
typeshed-formatting = { requires-python = ">=3.10" }
[tool.uv.sources]
# the pygments lexer that highlights `by` code blocks in the docs
basedpython-pygments = { path = "python/basedpython-pygments" }
docstring-adder = { git = "https://github.com/astral-sh/docstring-adder.git" }
# Switch to a released version once it includes
# https://github.com/psf/black/commit/f665703258bfa1916f8a6c1cbab0bc384b90cbac.
black = { git = "https://github.com/psf/black.git" }
# Keep scripts/setup_primer_project.py and its lockfile synchronized with
# ecosystem-analyzer's mypy-primer pin when updating its locked revision.
ecosystem-analyzer = { git = "https://github.com/astral-sh/ecosystem-analyzer" }
[tool.ruff]
target-version = "py38"
extend-exclude = [
# benchmark programs are measurement inputs, not code. an autofix that
# rewrites `i = i + 1` or hoists a loop changes what is being measured, and
# the isort rule alone would put `from __future__ import annotations` at the
# top of every one of them
"scripts/native-bench/programs/",
# the helpers the transpiler emits into the python it produces. reformatting
# them rewrites transpiled output, and the isort rule would put a
# `from __future__ import annotations` at the top of every module that gets
# a helper pasted into it. what shape they take is pinned by the
# transpiler's own tests
"crates/by_transforms/src/runtime/",
"crates/ty_vendored/vendor/",
"crates/ruff/resources/",
"crates/ruff_linter/resources/",
"crates/ruff_python_formatter/resources/",
"crates/ruff_python_parser/resources/",
"crates/ruff_python_semantic/resources/"
]
[tool.ruff.lint]
preview = true
select = [
# Categories
"correctness",
"suspicious",
"complexity",
"performance",
"style",
# E # pycodestyle (error)
"ambiguous-class-name",
"ambiguous-function-name",
"ambiguous-variable-name",
"lambda-assignment",
"module-import-not-at-top-of-file",
"multiple-imports-on-one-line",
"multiple-leading-hashes-for-block-comment",
"no-indented-block",
"none-comparison",
"not-in-test",
"not-is-test",
"true-false-comparison",
"type-comparison",
"unexpected-indentation",
# F # pyflakes
"forward-annotation-syntax-error",
"undefined-local-with-import-star",
"undefined-local-with-import-star-usage",
# B # bugbear
"batched-without-explicit-strict",
"class-as-data-structure",
"map-without-explicit-strict",
"no-explicit-stacklevel",
"raise-without-from-inside-except",
"re-sub-positional-args",
"unused-loop-control-variable",
"zip-without-explicit-strict",
# C4 # flake8-comprehensions
"unnecessary-comprehension",
# SIM # flake8-simplify
"compare-with-tuple",
"dict-get-with-none-default",
"if-else-block-instead-of-dict-lookup",
"if-else-block-instead-of-if-exp",
"if-expr-with-twisted-arms",
"suppressible-exception",
"uncapitalized-environment-variables",
"yoda-conditions",
# I # isort
"missing-required-import",
# UP # pyupgrade
"convert-typed-dict-functional-to-class",
"redundant-open-modes",
# PGH # pygrep-hooks
"blanket-noqa",
"blanket-type-ignore",
# PYI # flake8-pyi
"argument-default-in-stub",
"collections-named-tuple",
"docstring-in-stub",
"numeric-literal-too-long",
"redundant-literal-union",
"string-or-bytes-too-long",
"typed-argument-default-in-stub",
"unsupported-method-call-on-all",
# RUF
"ambiguous-unicode-character-comment",
"ambiguous-unicode-character-docstring",
"ambiguous-unicode-character-string",
"asyncio-dangling-task",
"collection-literal-concatenation",
"incorrectly-parenthesized-tuple-in-subscript",
"non-empty-init-module",
"noqa-comments",
"parenthesize-chained-operators",
"rule-codes-in-selectors",
"unnecessary-assign-before-yield",
"unraw-re-pattern",
"unused-async",
"used-dummy-variable",
# S
"subprocess-popen-with-shell-equals-true",
]
ignore = [
# only relevant if you run a script with `python -0`,
# which seems unlikely for any of the scripts in this repo
"assert-false",
# Leave it to the formatter to split long lines and
# the judgement of all of us.
"line-too-long",
# This is often more readable in our scripts.
"repeated-append",
]
[tool.ruff.lint.per-file-ignores]
# a pygments lexer declares its public api as plain class attributes, and the
# framework reads `tokens` at class-creation time. `ClassVar` annotations would
# be correct at runtime but unique to this lexer among every lexer pygments has
"python/basedpython-pygments/**" = ["RUF012"]
# a lexer's keyword tables are its module-level api, which is what the module is
# for — there is nowhere else for them to live
"python/basedpython-pygments/basedpython_pygments/__init__.py" = ["RUF067"]
# developer scripts read a subprocess's outcome themselves, catch whatever a tool
# throws so one failure does not end a sweep, and touch the filesystem directly
"scripts/**" = ["S603", "PLW1510", "BLE001", "ASYNC240", "ISC004"]
[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
combine-as-imports = true
[tool.ruff.per-file-target-version]
"crates/ty_python_semantic/mdtest.py" = "py310"
"crates/ty_vendored/ty_extensions/*.pyi" = "py312"
"scripts/*.py" = "py312"
[tool.black]
force-exclude = '''
/(
| crates/ty_vendored/vendor
| crates/ruff_linter/resources
| crates/ruff_python_formatter/resources
| crates/ruff_python_parser/resources
)/
'''
[tool.rooster]
major_labels = [] # Ruff never uses the major version number
minor_labels = ["breaking"] # Bump the minor version on breaking changes
ignore_labels = ["internal", "ci", "testing", "ty"]
version_files = [
"README.md",
"pyproject.toml",
# Might become unneeded once Markdown formatting is stabilized.
"docs/formatter.md",
"docs/installation.md",
"docs/integrations.md",
"docs/tutorial.md",
"crates/ruff/Cargo.toml",
"crates/ruff_linter/Cargo.toml",
# Note that the value being replaced here needs to be kept in sync with the
# validation regex in the `violation_metadata` macro.
{ target = "crates/ruff_linter/src/rules/**/*.rs", replace = "NEXT_RUFF_VERSION" },
"crates/ruff_wasm/Cargo.toml",
"scripts/benchmarks/pyproject.toml",
]
[tool.rooster.section-labels]
"Breaking changes" = ["breaking"]
"Preview features" = ["preview"]
"Bug fixes" = ["bug"]
"Rule changes" = [
"diagnostics",
"docstrings",
"rule",
"fixes",
"isort",
]
"Performance" = ["performance"]
"Formatter" = ["formatter"]
"Server" = ["server"]
"CLI" = ["cli"]
"Configuration" = ["configuration"]
"Documentation" = ["documentation"]
"Other changes" = ["__unknown__"]