Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
186 lines (172 loc) · 5.8 KB
/
Copy pathpyproject.toml
File metadata and controls
186 lines (172 loc) · 5.8 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
[project]
name = "bidict"
version = "0.24.2.dev0"
description = "The bidirectional mapping library for Python."
authors = [{ name = "Joshua Bronson", email = "jabronson@gmail.com" }]
license = "MPL-2.0"
license-files = ["LICENSE"]
dependencies = [
# bidict/_typing.py's `typing`/`typing_extensions` imports branch on python<3.12
"typing_extensions>=4.0; python_version<'3.12'",
]
requires-python = ">=3.11"
readme = "README.rst"
keywords = [
"bidict",
"bimap",
"bidirectional",
"dict",
"dictionary",
"mapping",
"collections",
]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Typing :: Typed",
]
[project.urls]
# https://github.com/pypi/warehouse/blob/main/warehouse/templates/packaging/detail.html#L20-L62
Changelog = "https://bidict.readthedocs.io/changelog.html"
Documentation = "https://bidict.readthedocs.io"
Sponsor = "https://bidict.readthedocs.io/#sponsoring"
Repository = "https://github.com/jab/bidict"
[dependency-groups]
test = [
"coverage",
"hypothesis",
"pytest",
"pytest-benchmark",
"pytest-sphinx",
"pytest-xdist",
"sortedcollections",
"sortedcontainers",
"ty>=0.0.84",
"typing_extensions",
]
dev = [
"pytest-clarity",
"pytest-icdiff",
"pytest-sugar",
"tox",
"tox-uv",
]
docs = [
"sphinx",
"sphinx-copybutton",
"furo",
]
[tool.uv]
default-groups = ["test", "dev", "docs"]
[tool.uv.build-backend]
module-root = ""
source-exclude = [".mypy_cache"]
[build-system]
# uv_build, not the uv on PATH, is what writes the wheel's RECORD, and it comes from this pin.
# The floor is load-bearing: 0.24.0 shipped hex-encoded RECORD hashes (#406) because the pin
# read >=0.7.13,<0.8.0, so it kept resolving uv_build to 0.7.22 long after 0.8.13 fixed them to
# be urlsafe-base64 as the spec requires, and 0.7.x got no backport. Keeping the floor at that
# fix, rather than raising it in lockstep with the ceiling, means every version this admits
# writes a valid RECORD even if the ceiling goes stale again, and leaves distro packagers a
# wide range to build the sdist against whatever uv_build they ship.
# The ceiling is only change control, and is what uv recommends (it warns without one). Keep it
# covering the uv in uv.lock, so `uv build` keeps using that uv's built-in uv_build rather than
# downloading one; update_dev_dependencies checks this.
requires = ["uv_build>=0.8.13,<0.12"]
build-backend = "uv_build"
[tool.ty.src]
include = ["bidict", "tests"]
[tool.ty.terminal]
error-on-warning = true
[tool.ty.rules]
# ty has no `strict`-mode bundle like mypy's; instead, ratchet up the rules that
# default to `warn`/`ignore` but that we want enforced as errors. `error-on-warning`
# above already makes the `warn`-level rules fatal; the following promote rules that
# default to `ignore` (so are otherwise silent even under `error-on-warning`).
missing-type-argument = "error" # analogous to mypy's disallow_any_generics
missing-override-decorator = "error" # require @override on overriding methods
[tool.ruff]
preview = true
line-length = 121
# Ruff's default rule set grows between minor versions, so an older ruff than the one pinned in
# .pre-commit-config.yaml lints with fewer rules and passes code that CI rejects. Fail on that
# rather than let it be discovered in CI. ./update_dev_dependencies checks these two stay in step.
required-version = ">=0.16.4"
[tool.ruff.lint]
# https://docs.astral.sh/ruff/rules/
# Whole linters, selected by prefix. Individual rules are selected by name below, since
# a name says what it checks where a code does not.
extend-select = [
"A",
"ARG",
"B",
"BLE",
"E",
"F",
"FA",
"FLY",
"FURB",
"G",
"I",
"ICN",
"PERF",
"PGH",
"PIE",
"PT",
"PTH",
"RET",
"RSE",
"RUF",
"SLOT",
"T20",
"TID",
"UP",
"W",
"YTT",
# Individual rules, from linters whose other rules do not suit this codebase:
"debugger",
"runtime-cast-value", # keeps cast()'s type expression from being evaluated at runtime
"unspecified-encoding", # text I/O should not depend on the machine's locale
]
ignore = [
"in-dict-keys", # https://github.com/astral-sh/ruff/issues/4481
"non-empty-init-module", # Allow __init__.py to set __module__ on re-exported classes
"unaliased-collections-abc-set-import", # Prefer `Set` over `AbstractSet` for readability
"useless-import-alias", # Allow explicit re-exports (import X as X)
]
# Rules that know about typing should treat what bidict._typing re-exports the same way.
typing-modules = ["bidict._typing"]
[tool.ruff.lint.per-file-ignores]
# Printing their results is what these scripts are for.
"callgrind.py" = ["print"]
"compare_instructions.py" = ["print"]
[tool.ruff.lint.isort]
force-single-line = true
lines-after-imports = 2
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = "dynamic"
preview = true
quote-style = "single" # Keep the code (especially in the docs' doctests) matching Python's output
[tool.pytest]
addopts = [
"-vv",
"--doctest-modules",
"--doctest-glob=docs/*.rst",
"--durations=5",
"--hypothesis-profile=less-examples",
"--numprocesses=auto",
# Benchmarks are run separately (see the benchmark tox env and workflow, which
# invoke pytest with `-c /dev/null` to bypass this config), so unload
# pytest-benchmark here. Otherwise, being installed, it loads on every run and
# warns under xdist (which addopts enables above) that it is auto-disabling itself.
"-p", "no:benchmark",
]
doctest_optionflags = ["ELLIPSIS"]
# Treat warnings as errors so deprecations etc. fail the suite instead of going
# unnoticed. (The benchmark plugin is unloaded above so its xdist warning
# doesn't trip this.)
filterwarnings = ["error"]
strict = true
testpaths = ["bidict", "tests", "docs"]