sincewhen 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sincewhen-0.1.0/LICENSE.txt +9 -0
- sincewhen-0.1.0/PKG-INFO +221 -0
- sincewhen-0.1.0/README.md +201 -0
- sincewhen-0.1.0/pyproject.toml +89 -0
- sincewhen-0.1.0/pyproject.toml.orig +84 -0
- sincewhen-0.1.0/src/sincewhen/__init__.py +16 -0
- sincewhen-0.1.0/src/sincewhen/__main__.py +3 -0
- sincewhen-0.1.0/src/sincewhen/cli.py +222 -0
- sincewhen-0.1.0/src/sincewhen/detect.py +392 -0
- sincewhen-0.1.0/src/sincewhen/features.py +234 -0
- sincewhen-0.1.0/src/sincewhen/features.toml +23435 -0
- sincewhen-0.1.0/src/sincewhen/versions.py +91 -0
- sincewhen-0.1.0/tests/__init__.py +0 -0
- sincewhen-0.1.0/tests/test_cli.py +170 -0
- sincewhen-0.1.0/tests/test_detect.py +218 -0
- sincewhen-0.1.0/tests/test_features.py +264 -0
- sincewhen-0.1.0/tests/test_versions.py +48 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Trey Hunner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
sincewhen-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sincewhen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Find out which Python version added each feature your code uses
|
|
5
|
+
Keywords: python-version,compatibility,ast,whatsnew,history
|
|
6
|
+
Author: Trey Hunner
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE.txt
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
13
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.14
|
|
16
|
+
Project-URL: Documentation, https://github.com/treyhunner/sincewhen#readme
|
|
17
|
+
Project-URL: Issues, https://github.com/treyhunner/sincewhen/issues
|
|
18
|
+
Project-URL: Source, https://github.com/treyhunner/sincewhen
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# sincewhen
|
|
22
|
+
|
|
23
|
+
[](https://pypi.org/project/sincewhen)
|
|
24
|
+
[](https://pypi.org/project/sincewhen)
|
|
25
|
+
|
|
26
|
+
Find out which Python version added each feature your code uses.
|
|
27
|
+
|
|
28
|
+
Point `sincewhen` at a file and it will tell you what's in there, when each piece of it arrived, and how old a Python you could get away with running it on.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Installing with [`uv tool`](https://docs.astral.sh/uv/concepts/tools/):
|
|
34
|
+
|
|
35
|
+
```console
|
|
36
|
+
uv tool install sincewhen
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Installing with [`pipx`](https://pipx.pypa.io):
|
|
40
|
+
|
|
41
|
+
```console
|
|
42
|
+
pipx install sincewhen
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
You can also install `sincewhen` globally with `pip`, but I usually recommend installing command-line tools in their own separate environment.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
Give `sincewhen` a file to see every dated feature it uses:
|
|
51
|
+
|
|
52
|
+
```console
|
|
53
|
+
$ sincewhen example.py
|
|
54
|
+
example.py:1 tomllib module 3.11 2022-10-24
|
|
55
|
+
example.py:3 positional-only parameters (/) 3.8 2019-10-14
|
|
56
|
+
example.py:4 with statement 2.5 2006-09-19
|
|
57
|
+
|
|
58
|
+
Minimum: Python 3.11, released 2022-10-24 (set by tomllib module)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The last column is the day that release shipped, so a version number reads as an age.
|
|
62
|
+
|
|
63
|
+
Only the first use of each feature is shown by default.
|
|
64
|
+
Pass `--all` to see every occurrence.
|
|
65
|
+
|
|
66
|
+
The dataset reaches back to Python 0.9.1, which means a file will report things like `str()` and `open()` that have been there since 1991.
|
|
67
|
+
Pass `--since` to hide them:
|
|
68
|
+
|
|
69
|
+
```console
|
|
70
|
+
$ sincewhen --since 3.0 example.py
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Read from standard input with `-`:
|
|
74
|
+
|
|
75
|
+
```console
|
|
76
|
+
$ echo 'x: int = 1' | sincewhen -
|
|
77
|
+
<stdin>:1 variable annotation 3.6 2016-12-23
|
|
78
|
+
|
|
79
|
+
Minimum: Python 3.6, released 2016-12-23 (set by variable annotation)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Look a single feature up by name instead of analyzing code:
|
|
83
|
+
|
|
84
|
+
```console
|
|
85
|
+
$ sincewhen --search walrus
|
|
86
|
+
walrus operator (:=) - Python 3.8 (released 2019-10-14)
|
|
87
|
+
PEP: https://peps.python.org/pep-0572/
|
|
88
|
+
Docs: https://docs.python.org/3/whatsnew/3.8.html
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Pass `--json` to either mode for machine-readable output.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Library
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
>>> import sincewhen
|
|
98
|
+
>>> sincewhen.minimum_version("import tomllib")
|
|
99
|
+
Version(major=3, minor=11)
|
|
100
|
+
>>> [d.feature.name for d in sincewhen.detect("if (n := 1): pass")]
|
|
101
|
+
['walrus operator (:=)']
|
|
102
|
+
>>> sincewhen.lookup("tomllib")[0].added
|
|
103
|
+
Version(major=3, minor=11)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Why it needs Python 3.14
|
|
108
|
+
|
|
109
|
+
`sincewhen` parses code with the standard library's `ast` module, which can only understand syntax that the running interpreter understands.
|
|
110
|
+
A Python 3.9 interpreter cannot parse a `match` statement, so it could not report one either.
|
|
111
|
+
Requiring the newest Python is what lets `sincewhen` recognize the newest syntax.
|
|
112
|
+
|
|
113
|
+
The Python version you *run* `sincewhen` on has nothing to do with the versions it *reports* on, which reach back to Python 0.9.1.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## Known limits
|
|
117
|
+
|
|
118
|
+
- Some features are genuinely ambiguous in an AST.
|
|
119
|
+
`a | b` could be a Python 3.9 dict merge, a Python 3.10 union type, or an integer bitwise-or that has worked since forever, and the AST alone cannot tell you which.
|
|
120
|
+
Ambiguous features are left out rather than guessed at.
|
|
121
|
+
- Detection is syntactic.
|
|
122
|
+
`sincewhen` sees that you called something named `math.isclose`, not that you called the real one.
|
|
123
|
+
Shadowed builtins are skipped, but a shadowed module attribute is not.
|
|
124
|
+
- The dataset is curated and incomplete.
|
|
125
|
+
A feature that isn't in it won't be reported, so the minimum version is a lower bound on the true answer.
|
|
126
|
+
- `added` is the oldest release from which a feature has been available *ever since*, ignoring Python 3.0 and 3.1.
|
|
127
|
+
Nobody shipped code on those two, so a gap there is not a gap anyone lived through: `argparse` shipped in 2.7 and again in 3.2, and is dated 2.7.
|
|
128
|
+
A feature missing from 3.2 as well has a real gap and takes the later date.
|
|
129
|
+
- Some features are older than the oldest surviving documentation, and are reported as "1.2 or earlier".
|
|
130
|
+
Python 0.9.1 is as far back as the archives go.
|
|
131
|
+
- Release dates come from python.org's downloads database back to 2.2, and from CPython's release tags before that.
|
|
132
|
+
Python 0.9 and 1.6 have no release tag, so they show no date.
|
|
133
|
+
- Searching for a module member that has no entry of its own falls back to the module it lives in, since a member cannot be older than its module.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
This project uses [uv](https://docs.astral.sh/uv/) and [just](https://just.systems).
|
|
139
|
+
Run `just` to see every available task.
|
|
140
|
+
|
|
141
|
+
```console
|
|
142
|
+
$ just test # run the test suite
|
|
143
|
+
$ just check # format, lint, typecheck, and test
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
No setup step is needed: `uv` creates the virtual environment and installs dependencies on the first `uv run`.
|
|
147
|
+
|
|
148
|
+
If you would rather not install `just`, every task is a short `uv` command that you can run directly (check the `justfile` for the commands):
|
|
149
|
+
|
|
150
|
+
```console
|
|
151
|
+
uv run pytest
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
### Adding a feature
|
|
156
|
+
|
|
157
|
+
Features live in `src/sincewhen/features.toml`, one `[[features]]` table each.
|
|
158
|
+
Give the feature an id, a human-readable name, the version that added it, a category, exactly one matcher, and the evidence for the version:
|
|
159
|
+
|
|
160
|
+
```toml
|
|
161
|
+
[[features]]
|
|
162
|
+
id = "walrus"
|
|
163
|
+
name = "walrus operator (:=)"
|
|
164
|
+
added = "3.8"
|
|
165
|
+
category = "syntax"
|
|
166
|
+
pep = 572
|
|
167
|
+
nodes = ["NamedExpr"]
|
|
168
|
+
|
|
169
|
+
[features.evidence]
|
|
170
|
+
method = "pep"
|
|
171
|
+
pep = 572
|
|
172
|
+
python_version = "3.8"
|
|
173
|
+
checked = "2026-07-28"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The matcher kinds are `nodes` (AST node class names), `builtins`, `modules`, and `attributes` (dotted `module.name` paths).
|
|
177
|
+
Node matchers can be narrowed with `requires` (a node attribute that must be truthy) or `check` (a predicate registered in `detect.py`).
|
|
178
|
+
|
|
179
|
+
Documentation links are generated from `added` and `pep`, so only set `docs` when you have a better link than the "What's New" page.
|
|
180
|
+
|
|
181
|
+
Nobody should be typing version numbers from memory.
|
|
182
|
+
For anything in the standard library, let the archived documentation say what the version is:
|
|
183
|
+
|
|
184
|
+
```console
|
|
185
|
+
$ just fetch-docs # one-time, into a gitignored .cache/
|
|
186
|
+
$ just whenadded math.lcm # what each source says, and whether they agree
|
|
187
|
+
$ just propose math.lcm math.isqrt # entries with evidence, ready to paste
|
|
188
|
+
$ just verify-dataset # re-derive every claim in the dataset
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`just verify-dataset` also runs in CI, so a pull request that edits a version without editing its evidence fails.
|
|
192
|
+
|
|
193
|
+
Evidence has five `method` values, four of which a machine can recheck:
|
|
194
|
+
|
|
195
|
+
| method | what it means |
|
|
196
|
+
|---|---|
|
|
197
|
+
| `objects.inv` | the symbol is absent from one release's Sphinx inventory and present in the next |
|
|
198
|
+
| `archive` | the same diff over the module lists and built-in function pages in the pre-Sphinx doc builds, back to the 0.9.1 LaTeX |
|
|
199
|
+
| `annotation` | the documentation dates it itself, in an "Added in version" marker quoted in the entry |
|
|
200
|
+
| `grammar` | the token is absent from one release's grammar and present in the next, which is what shipped rather than what a PEP intended |
|
|
201
|
+
| `pep` | the feature's PEP carries a `Python-Version` header |
|
|
202
|
+
| `manual` | a human read the archives and wrote down what they found, and why the other four do not settle it |
|
|
203
|
+
|
|
204
|
+
`manual` is for the cases where the sources genuinely disagree, and every one of them is printed on every `verify-dataset` run so the override stays visible.
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
## Releasing
|
|
208
|
+
|
|
209
|
+
Bump the version, then tag and push:
|
|
210
|
+
|
|
211
|
+
```console
|
|
212
|
+
$ just bump patch
|
|
213
|
+
$ just release
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Pushing a `v*` tag runs the release workflow, which publishes to PyPI with trusted publishing and creates a GitHub release.
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
`sincewhen` is distributed under the terms of the [MIT license](LICENSE.txt).
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# sincewhen
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/sincewhen)
|
|
4
|
+
[](https://pypi.org/project/sincewhen)
|
|
5
|
+
|
|
6
|
+
Find out which Python version added each feature your code uses.
|
|
7
|
+
|
|
8
|
+
Point `sincewhen` at a file and it will tell you what's in there, when each piece of it arrived, and how old a Python you could get away with running it on.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Installing with [`uv tool`](https://docs.astral.sh/uv/concepts/tools/):
|
|
14
|
+
|
|
15
|
+
```console
|
|
16
|
+
uv tool install sincewhen
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Installing with [`pipx`](https://pipx.pypa.io):
|
|
20
|
+
|
|
21
|
+
```console
|
|
22
|
+
pipx install sincewhen
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You can also install `sincewhen` globally with `pip`, but I usually recommend installing command-line tools in their own separate environment.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Give `sincewhen` a file to see every dated feature it uses:
|
|
31
|
+
|
|
32
|
+
```console
|
|
33
|
+
$ sincewhen example.py
|
|
34
|
+
example.py:1 tomllib module 3.11 2022-10-24
|
|
35
|
+
example.py:3 positional-only parameters (/) 3.8 2019-10-14
|
|
36
|
+
example.py:4 with statement 2.5 2006-09-19
|
|
37
|
+
|
|
38
|
+
Minimum: Python 3.11, released 2022-10-24 (set by tomllib module)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The last column is the day that release shipped, so a version number reads as an age.
|
|
42
|
+
|
|
43
|
+
Only the first use of each feature is shown by default.
|
|
44
|
+
Pass `--all` to see every occurrence.
|
|
45
|
+
|
|
46
|
+
The dataset reaches back to Python 0.9.1, which means a file will report things like `str()` and `open()` that have been there since 1991.
|
|
47
|
+
Pass `--since` to hide them:
|
|
48
|
+
|
|
49
|
+
```console
|
|
50
|
+
$ sincewhen --since 3.0 example.py
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Read from standard input with `-`:
|
|
54
|
+
|
|
55
|
+
```console
|
|
56
|
+
$ echo 'x: int = 1' | sincewhen -
|
|
57
|
+
<stdin>:1 variable annotation 3.6 2016-12-23
|
|
58
|
+
|
|
59
|
+
Minimum: Python 3.6, released 2016-12-23 (set by variable annotation)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Look a single feature up by name instead of analyzing code:
|
|
63
|
+
|
|
64
|
+
```console
|
|
65
|
+
$ sincewhen --search walrus
|
|
66
|
+
walrus operator (:=) - Python 3.8 (released 2019-10-14)
|
|
67
|
+
PEP: https://peps.python.org/pep-0572/
|
|
68
|
+
Docs: https://docs.python.org/3/whatsnew/3.8.html
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Pass `--json` to either mode for machine-readable output.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Library
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
>>> import sincewhen
|
|
78
|
+
>>> sincewhen.minimum_version("import tomllib")
|
|
79
|
+
Version(major=3, minor=11)
|
|
80
|
+
>>> [d.feature.name for d in sincewhen.detect("if (n := 1): pass")]
|
|
81
|
+
['walrus operator (:=)']
|
|
82
|
+
>>> sincewhen.lookup("tomllib")[0].added
|
|
83
|
+
Version(major=3, minor=11)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Why it needs Python 3.14
|
|
88
|
+
|
|
89
|
+
`sincewhen` parses code with the standard library's `ast` module, which can only understand syntax that the running interpreter understands.
|
|
90
|
+
A Python 3.9 interpreter cannot parse a `match` statement, so it could not report one either.
|
|
91
|
+
Requiring the newest Python is what lets `sincewhen` recognize the newest syntax.
|
|
92
|
+
|
|
93
|
+
The Python version you *run* `sincewhen` on has nothing to do with the versions it *reports* on, which reach back to Python 0.9.1.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## Known limits
|
|
97
|
+
|
|
98
|
+
- Some features are genuinely ambiguous in an AST.
|
|
99
|
+
`a | b` could be a Python 3.9 dict merge, a Python 3.10 union type, or an integer bitwise-or that has worked since forever, and the AST alone cannot tell you which.
|
|
100
|
+
Ambiguous features are left out rather than guessed at.
|
|
101
|
+
- Detection is syntactic.
|
|
102
|
+
`sincewhen` sees that you called something named `math.isclose`, not that you called the real one.
|
|
103
|
+
Shadowed builtins are skipped, but a shadowed module attribute is not.
|
|
104
|
+
- The dataset is curated and incomplete.
|
|
105
|
+
A feature that isn't in it won't be reported, so the minimum version is a lower bound on the true answer.
|
|
106
|
+
- `added` is the oldest release from which a feature has been available *ever since*, ignoring Python 3.0 and 3.1.
|
|
107
|
+
Nobody shipped code on those two, so a gap there is not a gap anyone lived through: `argparse` shipped in 2.7 and again in 3.2, and is dated 2.7.
|
|
108
|
+
A feature missing from 3.2 as well has a real gap and takes the later date.
|
|
109
|
+
- Some features are older than the oldest surviving documentation, and are reported as "1.2 or earlier".
|
|
110
|
+
Python 0.9.1 is as far back as the archives go.
|
|
111
|
+
- Release dates come from python.org's downloads database back to 2.2, and from CPython's release tags before that.
|
|
112
|
+
Python 0.9 and 1.6 have no release tag, so they show no date.
|
|
113
|
+
- Searching for a module member that has no entry of its own falls back to the module it lives in, since a member cannot be older than its module.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
This project uses [uv](https://docs.astral.sh/uv/) and [just](https://just.systems).
|
|
119
|
+
Run `just` to see every available task.
|
|
120
|
+
|
|
121
|
+
```console
|
|
122
|
+
$ just test # run the test suite
|
|
123
|
+
$ just check # format, lint, typecheck, and test
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
No setup step is needed: `uv` creates the virtual environment and installs dependencies on the first `uv run`.
|
|
127
|
+
|
|
128
|
+
If you would rather not install `just`, every task is a short `uv` command that you can run directly (check the `justfile` for the commands):
|
|
129
|
+
|
|
130
|
+
```console
|
|
131
|
+
uv run pytest
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Adding a feature
|
|
136
|
+
|
|
137
|
+
Features live in `src/sincewhen/features.toml`, one `[[features]]` table each.
|
|
138
|
+
Give the feature an id, a human-readable name, the version that added it, a category, exactly one matcher, and the evidence for the version:
|
|
139
|
+
|
|
140
|
+
```toml
|
|
141
|
+
[[features]]
|
|
142
|
+
id = "walrus"
|
|
143
|
+
name = "walrus operator (:=)"
|
|
144
|
+
added = "3.8"
|
|
145
|
+
category = "syntax"
|
|
146
|
+
pep = 572
|
|
147
|
+
nodes = ["NamedExpr"]
|
|
148
|
+
|
|
149
|
+
[features.evidence]
|
|
150
|
+
method = "pep"
|
|
151
|
+
pep = 572
|
|
152
|
+
python_version = "3.8"
|
|
153
|
+
checked = "2026-07-28"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The matcher kinds are `nodes` (AST node class names), `builtins`, `modules`, and `attributes` (dotted `module.name` paths).
|
|
157
|
+
Node matchers can be narrowed with `requires` (a node attribute that must be truthy) or `check` (a predicate registered in `detect.py`).
|
|
158
|
+
|
|
159
|
+
Documentation links are generated from `added` and `pep`, so only set `docs` when you have a better link than the "What's New" page.
|
|
160
|
+
|
|
161
|
+
Nobody should be typing version numbers from memory.
|
|
162
|
+
For anything in the standard library, let the archived documentation say what the version is:
|
|
163
|
+
|
|
164
|
+
```console
|
|
165
|
+
$ just fetch-docs # one-time, into a gitignored .cache/
|
|
166
|
+
$ just whenadded math.lcm # what each source says, and whether they agree
|
|
167
|
+
$ just propose math.lcm math.isqrt # entries with evidence, ready to paste
|
|
168
|
+
$ just verify-dataset # re-derive every claim in the dataset
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`just verify-dataset` also runs in CI, so a pull request that edits a version without editing its evidence fails.
|
|
172
|
+
|
|
173
|
+
Evidence has five `method` values, four of which a machine can recheck:
|
|
174
|
+
|
|
175
|
+
| method | what it means |
|
|
176
|
+
|---|---|
|
|
177
|
+
| `objects.inv` | the symbol is absent from one release's Sphinx inventory and present in the next |
|
|
178
|
+
| `archive` | the same diff over the module lists and built-in function pages in the pre-Sphinx doc builds, back to the 0.9.1 LaTeX |
|
|
179
|
+
| `annotation` | the documentation dates it itself, in an "Added in version" marker quoted in the entry |
|
|
180
|
+
| `grammar` | the token is absent from one release's grammar and present in the next, which is what shipped rather than what a PEP intended |
|
|
181
|
+
| `pep` | the feature's PEP carries a `Python-Version` header |
|
|
182
|
+
| `manual` | a human read the archives and wrote down what they found, and why the other four do not settle it |
|
|
183
|
+
|
|
184
|
+
`manual` is for the cases where the sources genuinely disagree, and every one of them is printed on every `verify-dataset` run so the override stays visible.
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
## Releasing
|
|
188
|
+
|
|
189
|
+
Bump the version, then tag and push:
|
|
190
|
+
|
|
191
|
+
```console
|
|
192
|
+
$ just bump patch
|
|
193
|
+
$ just release
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Pushing a `v*` tag runs the release workflow, which publishes to PyPI with trusted publishing and creates a GitHub release.
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
`sincewhen` is distributed under the terms of the [MIT license](LICENSE.txt).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.11.7,<0.12.0"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sincewhen"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Find out which Python version added each feature your code uses"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.14"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE.txt"]
|
|
13
|
+
keywords = [
|
|
14
|
+
"python-version",
|
|
15
|
+
"compatibility",
|
|
16
|
+
"ast",
|
|
17
|
+
"whatsnew",
|
|
18
|
+
"history",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 3 - Alpha",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
25
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
26
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
27
|
+
]
|
|
28
|
+
dependencies = []
|
|
29
|
+
|
|
30
|
+
[[project.authors]]
|
|
31
|
+
name = "Trey Hunner"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Documentation = "https://github.com/treyhunner/sincewhen#readme"
|
|
35
|
+
Issues = "https://github.com/treyhunner/sincewhen/issues"
|
|
36
|
+
Source = "https://github.com/treyhunner/sincewhen"
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
sincewhen = "sincewhen.cli:main"
|
|
40
|
+
|
|
41
|
+
[dependency-groups]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=8.0.0",
|
|
44
|
+
"pytest-cov>=5.0.0",
|
|
45
|
+
"ruff>=0.14.0",
|
|
46
|
+
"ty>=0.0.64",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.uv.build-backend]
|
|
50
|
+
module-name = "sincewhen"
|
|
51
|
+
source-include = ["tests/**"]
|
|
52
|
+
|
|
53
|
+
[tool.pytest.ini_options]
|
|
54
|
+
testpaths = ["tests"]
|
|
55
|
+
|
|
56
|
+
[tool.ruff]
|
|
57
|
+
target-version = "py314"
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint]
|
|
60
|
+
select = [
|
|
61
|
+
"E",
|
|
62
|
+
"W",
|
|
63
|
+
"F",
|
|
64
|
+
"I",
|
|
65
|
+
"UP",
|
|
66
|
+
"B",
|
|
67
|
+
"C4",
|
|
68
|
+
]
|
|
69
|
+
ignore = ["E501"]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.format]
|
|
72
|
+
quote-style = "double"
|
|
73
|
+
indent-style = "space"
|
|
74
|
+
|
|
75
|
+
[tool.coverage.run]
|
|
76
|
+
source = [
|
|
77
|
+
"sincewhen",
|
|
78
|
+
"tests",
|
|
79
|
+
]
|
|
80
|
+
branch = true
|
|
81
|
+
omit = ["src/sincewhen/__main__.py"]
|
|
82
|
+
|
|
83
|
+
[tool.coverage.report]
|
|
84
|
+
fail_under = 100
|
|
85
|
+
exclude_lines = [
|
|
86
|
+
"no cov",
|
|
87
|
+
"if __name__ == .__main__.:",
|
|
88
|
+
"if TYPE_CHECKING:",
|
|
89
|
+
]
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.11.7,<0.12.0"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sincewhen"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Find out which Python version added each feature your code uses"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.14"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE.txt"]
|
|
13
|
+
keywords =["python-version", "compatibility", "ast", "whatsnew", "history"]
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "Trey Hunner" },
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
22
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
23
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
24
|
+
]
|
|
25
|
+
dependencies = []
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Documentation = "https://github.com/treyhunner/sincewhen#readme"
|
|
29
|
+
Issues = "https://github.com/treyhunner/sincewhen/issues"
|
|
30
|
+
Source = "https://github.com/treyhunner/sincewhen"
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
sincewhen = "sincewhen.cli:main"
|
|
34
|
+
|
|
35
|
+
[dependency-groups]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=8.0.0",
|
|
38
|
+
"pytest-cov>=5.0.0",
|
|
39
|
+
"ruff>=0.14.0",
|
|
40
|
+
"ty>=0.0.64",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[tool.uv.build-backend]
|
|
44
|
+
module-name = "sincewhen"
|
|
45
|
+
source-include = ["tests/**"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
target-version = "py314"
|
|
52
|
+
|
|
53
|
+
[tool.ruff.lint]
|
|
54
|
+
select = [
|
|
55
|
+
"E", # pycodestyle errors
|
|
56
|
+
"W", # pycodestyle warnings
|
|
57
|
+
"F", # pyflakes
|
|
58
|
+
"I", # isort
|
|
59
|
+
"UP", # pyupgrade
|
|
60
|
+
"B", # flake8-bugbear
|
|
61
|
+
"C4", # flake8-comprehensions
|
|
62
|
+
]
|
|
63
|
+
ignore = [
|
|
64
|
+
"E501", # line too long (handled by formatter)
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[tool.ruff.format]
|
|
68
|
+
quote-style = "double"
|
|
69
|
+
indent-style = "space"
|
|
70
|
+
|
|
71
|
+
[tool.coverage.run]
|
|
72
|
+
source = ["sincewhen", "tests"]
|
|
73
|
+
branch = true
|
|
74
|
+
# `python -m sincewhen` is verified by a subprocess test, which coverage
|
|
75
|
+
# cannot measure from the parent process. Two lines of delegation.
|
|
76
|
+
omit = ["src/sincewhen/__main__.py"]
|
|
77
|
+
|
|
78
|
+
[tool.coverage.report]
|
|
79
|
+
fail_under = 100
|
|
80
|
+
exclude_lines = [
|
|
81
|
+
"no cov",
|
|
82
|
+
"if __name__ == .__main__.:",
|
|
83
|
+
"if TYPE_CHECKING:",
|
|
84
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Find out which Python version added each feature your code uses."""
|
|
2
|
+
|
|
3
|
+
from .detect import Detection, detect, minimum_version
|
|
4
|
+
from .features import DatasetError, Feature, load_features, lookup
|
|
5
|
+
from .versions import Version
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"DatasetError",
|
|
9
|
+
"Detection",
|
|
10
|
+
"Feature",
|
|
11
|
+
"Version",
|
|
12
|
+
"detect",
|
|
13
|
+
"load_features",
|
|
14
|
+
"lookup",
|
|
15
|
+
"minimum_version",
|
|
16
|
+
]
|