Debian Codegraph @

pyproject.toml

raw
1 [project]
2 name = "bidict"
3 version = "0.24.1"
4 description = "The bidirectional mapping library for Python."
5 authors = [{ name = "Joshua Bronson", email = "[email protected]" }]
6 license = "MPL-2.0"
7 license-files = ["LICENSE"]
8 dependencies = [
9 # bidict/_typing.py's `typing`/`typing_extensions` imports branch on python<3.12
10 "typing_extensions>=4.0; python_version<'3.12'",
11 ]
12 requires-python = ">=3.11"
13 readme = "README.rst"
14 keywords = [
15 "bidict",
16 "bimap",
17 "bidirectional",
18 "dict",
19 "dictionary",
20 "mapping",
21 "collections",
22 ]
23 classifiers = [
24 "Operating System :: OS Independent",
25 "Programming Language :: Python :: Implementation :: CPython",
26 "Programming Language :: Python :: Implementation :: PyPy",
27 "Typing :: Typed",
28 ]
29
30 [project.urls]
31 # https://github.com/pypi/warehouse/blob/main/warehouse/templates/packaging/detail.html#L20-L62
32 Changelog = "https://bidict.readthedocs.io/changelog.html"
33 Documentation = "https://bidict.readthedocs.io"
34 Sponsor = "https://bidict.readthedocs.io/#sponsoring"
35 Repository = "https://github.com/jab/bidict"
36
37 [dependency-groups]
38 test = [
39 "coverage",
40 "hypothesis",
41 "pytest",
42 "pytest-benchmark",
43 "pytest-sphinx",
44 "pytest-xdist",
45 "sortedcollections",
46 "sortedcontainers",
47 "ty>=0.0.72",
48 "typing_extensions",
49 ]
50 dev = [
51 "pytest-clarity",
52 "pytest-icdiff",
53 "pytest-sugar",
54 "tox",
55 "tox-uv",
56 ]
57 docs = [
58 "sphinx",
59 "sphinx-copybutton",
60 "furo",
61 ]
62
63 [tool.uv]
64 default-groups = ["test", "dev", "docs"]
65
66 [tool.uv.build-backend]
67 module-root = ""
68 source-exclude = [".mypy_cache"]
69
70 [build-system]
71 # uv_build, not the uv on PATH, is what writes the wheel's RECORD, and it comes from this pin.
72 # The floor is load-bearing: 0.24.0 shipped hex-encoded RECORD hashes (#406) because the pin
73 # 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
74 # be urlsafe-base64 as the spec requires, and 0.7.x got no backport. Keeping the floor at that
75 # fix, rather than raising it in lockstep with the ceiling, means every version this admits
76 # writes a valid RECORD even if the ceiling goes stale again, and leaves distro packagers a
77 # wide range to build the sdist against whatever uv_build they ship.
78 # The ceiling is only change control, and is what uv recommends (it warns without one). Keep it
79 # covering the uv in uv.lock, so `uv build` keeps using that uv's built-in uv_build rather than
80 # downloading one; update_dev_dependencies checks this.
81 requires = ["uv_build>=0.8.13,<0.12"]
82 build-backend = "uv_build"
83
84 [tool.ty.src]
85 include = ["bidict", "tests"]
86
87 [tool.ty.terminal]
88 error-on-warning = true
89
90 [tool.ty.rules]
91 # ty has no `strict`-mode bundle like mypy's; instead, ratchet up the rules that
92 # default to `warn`/`ignore` but that we want enforced as errors. `error-on-warning`
93 # above already makes the `warn`-level rules fatal; the following promote rules that
94 # default to `ignore` (so are otherwise silent even under `error-on-warning`).
95 missing-type-argument = "error" # analogous to mypy's disallow_any_generics
96 missing-override-decorator = "error" # require @override on overriding methods
97
98 [tool.ruff]
99 preview = true
100 line-length = 121
101 # Ruff's default rule set grows between minor versions, so an older ruff than the one pinned in
102 # .pre-commit-config.yaml lints with fewer rules and passes code that CI rejects. Fail on that
103 # rather than let it be discovered in CI. ./update_dev_dependencies checks these two stay in step.
104 required-version = ">=0.16.4"
105
106 [tool.ruff.lint]
107 # https://docs.astral.sh/ruff/rules/
108 # Whole linters, selected by prefix. Individual rules are selected by name below, since
109 # a name says what it checks where a code does not.
110 extend-select = [
111 "A",
112 "ARG",
113 "B",
114 "BLE",
115 "E",
116 "F",
117 "FA",
118 "FLY",
119 "FURB",
120 "G",
121 "I",
122 "ICN",
123 "PERF",
124 "PGH",
125 "PIE",
126 "PT",
127 "PTH",
128 "RET",
129 "RSE",
130 "RUF",
131 "SLOT",
132 "T20",
133 "TID",
134 "UP",
135 "W",
136 "YTT",
137 # Individual rules, from linters whose other rules do not suit this codebase:
138 "debugger",
139 "runtime-cast-value", # keeps cast()'s type expression from being evaluated at runtime
140 "unspecified-encoding", # text I/O should not depend on the machine's locale
141 ]
142 ignore = [
143 "in-dict-keys", # https://github.com/astral-sh/ruff/issues/4481
144 "non-empty-init-module", # Allow __init__.py to set __module__ on re-exported classes
145 "unaliased-collections-abc-set-import", # Prefer `Set` over `AbstractSet` for readability
146 "useless-import-alias", # Allow explicit re-exports (import X as X)
147 ]
148 # Rules that know about typing should treat what bidict._typing re-exports the same way.
149 typing-modules = ["bidict._typing"]
150
151 [tool.ruff.lint.per-file-ignores]
152 "cachegrind.py" = ["print"] # printing its results is what this script is for
153
154 [tool.ruff.lint.isort]
155 force-single-line = true
156 lines-after-imports = 2
157
158 [tool.ruff.format]
159 docstring-code-format = true
160 docstring-code-line-length = "dynamic"
161 preview = true
162 quote-style = "single" # Keep the code (especially in the docs' doctests) matching Python's output
163
164 [tool.pytest]
165 addopts = [
166 "-vv",
167 "--doctest-modules",
168 "--doctest-glob=docs/*.rst",
169 "--durations=5",
170 "--hypothesis-profile=less-examples",
171 "--numprocesses=auto",
172 # Benchmarks are run separately (see the benchmark tox env and workflow, which
173 # invoke pytest with `-c /dev/null` to bypass this config), so unload
174 # pytest-benchmark here. Otherwise, being installed, it loads on every run and
175 # warns under xdist (which addopts enables above) that it is auto-disabling itself.
176 "-p", "no:benchmark",
177 ]
178 doctest_optionflags = ["ELLIPSIS"]
179 # Treat warnings as errors so deprecations etc. fail the suite instead of going
180 # unnoticed. (The benchmark plugin is unloaded above so its xdist warning
181 # doesn't trip this.)
182 filterwarnings = ["error"]
183 strict = true
184 testpaths = ["bidict", "tests", "docs"]