depsense 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.
depsense-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yogvid Wankhede
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: depsense
3
+ Version: 0.1.0
4
+ Summary: Detect the Python version and exact library versions a script needs, then run it.
5
+ Keywords: dependencies,python-version,uv,pep723,requirements,benchmark,compatibility
6
+ Author: Yogvid Wankhede
7
+ Author-email: Yogvid Wankhede <yogvidwankhede@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
22
+ Classifier: Topic :: Software Development :: Build Tools
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Requires-Dist: packaging>=23.0
25
+ Requires-Python: >=3.10
26
+ Project-URL: Homepage, https://github.com/yogvidwankhede/depsense
27
+ Project-URL: Issues, https://github.com/yogvidwankhede/depsense/issues
28
+ Project-URL: Changelog, https://github.com/yogvidwankhede/depsense/blob/main/CHANGELOG.md
29
+ Description-Content-Type: text/markdown
30
+
31
+ # depsense
32
+
33
+ Figure out which Python version and which library versions a script actually needs, by reading the code.
34
+
35
+ I kept running into old scripts that broke because `np.float` is gone, or `load_boston` was removed, or the code used `match` and I was on 3.9. Pinning everything by hand got old, so this reads the code and works it out.
36
+
37
+ ```
38
+ $ depsense scan examples/legacy_numpy.py
39
+ Python: <3.12
40
+ <3.12 line 3: scikit-learn<1.2 has no wheels for Python 3.12+
41
+ <3.12 line 6: numpy<1.24 has no wheels for Python 3.12+
42
+
43
+ Packages:
44
+ numpy<1.24 (import numpy, line 1)
45
+ <1.24 line 6: `numpy.float` was removed in NumPy 1.24 (use the builtin type)
46
+ <2.0 line 7: `numpy.NaN` was removed in NumPy 2.0
47
+ scikit-learn<1.2 (import sklearn, line 3)
48
+ <1.2 line 3: `sklearn.datasets.load_boston` was removed in scikit-learn 1.2
49
+ ...
50
+ ```
51
+
52
+ ## Commands
53
+
54
+ ```
55
+ depsense scan script.py # explain what it needs and why
56
+ depsense scan script.py --json # same, machine readable
57
+ depsense pin script.py # write a PEP 723 "# /// script" block into the file
58
+ depsense run script.py [args] # run it with uv in an environment that fits
59
+ depsense run --dry-run script.py # just print the uv command
60
+ depsense bench script.py # time it across Python/library versions
61
+ depsense suggest script.py # faster libraries and patterns for this code
62
+ depsense suggest script.py --verify # ...and measure the drop-in swaps on your script
63
+ ```
64
+
65
+ It also takes notebooks and whole folders:
66
+
67
+ ```
68
+ depsense scan analysis.ipynb # code cells only; %magics and !shell lines are ignored
69
+ depsense run analysis.ipynb # open it in JupyterLab with matching versions
70
+ depsense scan myproject/ --exclude tests --exclude "legacy/*"
71
+ depsense pin myproject/ # writes myproject/requirements.txt
72
+ ```
73
+
74
+ Locations in reports point to `src/app/util.py:12` or `analysis.ipynb cell 3, line 2`. Folder scans skip virtualenvs, build output and hidden directories, treat the project's own modules (flat or `src/` layout) as local, and list files that don't parse as warnings instead of stopping.
75
+
76
+ Options go anywhere; arguments meant for your script go after `--`:
77
+ `depsense run script.py -- --input data.csv`.
78
+
79
+ `--high-only` skips the guess-y rules (ones that match on a method name like `.iteritems()` instead of a fully resolved `module.attr` path).
80
+
81
+ ## What it detects
82
+
83
+ - **Packages**: absolute imports minus stdlib and local modules, with import→PyPI name mapping (`cv2` → `opencv-python`, `sklearn` → `scikit-learn`, ...).
84
+ - **Library versions**: APIs that were added or removed in specific releases (numpy, pandas, scikit-learn, scipy, pydantic, SQLAlchemy, Pillow, matplotlib, networkx, tensorflow), resolved through import aliases, so `np.float` and `from numpy import float` both count. Some rules look at keyword arguments, like `read_csv(error_bad_lines=...)`.
85
+ - **Python version**: syntax (walrus, `match`, `except*`, `type` aliases, generics `[T]`, t-strings, ...), stdlib additions (`tomllib`, `itertools.batched`, ...), and stdlib removals (`distutils`, `imp`, `collections.Mapping`, ...).
86
+ - **Cross constraints**: an old library pins Python too. depsense asks PyPI which release uv will actually install and which CPython versions that release has wheels for, so `numpy<1.24` resolves to 1.23.5 and caps Python at `<3.12`. Responses are cached for a day in `~/.cache/depsense`. With `--offline`, or if PyPI can't be reached, it falls back to a small built-in table.
87
+ - **Optional imports**: `try: import ujson / except ImportError: import json` is treated as either-or, so a Python 2 fallback like `cStringIO` doesn't cap anything.
88
+ - **Conflicts**: if the code needs `numpy>=2.0` in one place and `<1.24` in another, it says so and points to both lines.
89
+
90
+ ## Where the rules come from
91
+
92
+ Most rules are generated, not written by hand. `tools/genrules.py` installs the latest patch of every minor release of a library (and every Python from 3.8 to 3.15) in throwaway uv environments, records the public API of each one (module attributes, class members including inherited ones, and the keyword arguments each callable accepts), and diffs consecutive releases. A name that appears in numpy 2.0 becomes `numpy>=2.0`; a keyword that disappears from `read_csv` in pandas 2.0 becomes `pandas<2.0`. Only names that changed are stored, in `src/depsense/data/`.
93
+
94
+ The generator skips anything it can't be sure about: modules that imported in some releases but not others, keywords of callables whose signature isn't visible everywhere, and member names that also exist in the standard library. Hand-written rules in `knowledge.py` cover what the generator can't see and replace generated rules for the same name, since their messages are clearer.
95
+
96
+ Current data: the stdlib (3.8 to 3.15) plus numpy, pandas, scikit-learn, scipy, matplotlib, pydantic, SQLAlchemy, networkx and Pillow. It was generated on Apple Silicon, so releases without arm64 macOS wheels (numpy before 1.21, for example) aren't sampled yet; their rules start at the oldest release that installs. If a release in the middle can't be installed, rules next to it keep a safe bound and say which versions weren't checked.
97
+
98
+ ## How well it works
99
+
100
+ `tools/evaluate.py` takes the example galleries shipped with old releases (scikit-learn 0.22.2 and 0.24.2, matplotlib 3.3.4, networkx 2.4), resolves each script with depsense, builds that environment with uv, and checks that every library API the script references actually exists there. Scripts are never executed. The baseline is what you get from a plain `pip install` today: the latest versions on Python 3.12.
101
+
102
+ | examples from | scripts | baseline | depsense |
103
+ |---|---|---|---|
104
+ | scikit-learn 0.22.2 | 252 | 204 (81%) | 231 (92%) |
105
+ | scikit-learn 0.24.2 | 270 | 239 (89%) | 254 (94%) |
106
+ | matplotlib 3.3.4 | 509 | 425 (83%) | 437 (86%) |
107
+ | networkx 2.4 | 51 | 44 (86%) | 45 (88%) |
108
+ | **total** | 1082 | 912 (84%) | **967 (89%)** |
109
+
110
+ depsense fixed 55 scripts the baseline breaks and broke none that the baseline handles. Most of what's left fails both ways: names re-exported from another package (`scipy.interp` was numpy's), and methods on objects whose type depsense can't infer. The first run of this check is what found the NumPy 2 binary break below, so it's worth rerunning after rule changes.
111
+
112
+ Old compiled libraries (scikit-learn before 1.4.2, matplotlib before 3.8.4, scipy, pandas, ...) were built against NumPy 1.x and crash on import under NumPy 2, and nothing in their metadata says so. When the code needs one of those, depsense also pins `numpy<2.0`.
113
+
114
+ ## Benchmarking
115
+
116
+ ```
117
+ $ depsense bench examples/bench_demo.py --python 3.11,3.12,3.13,3.14 --try "numpy==1.26.4" --repeat 3
118
+ # python variant warm (median) cold vs best packages
119
+ 1 3.11.15 numpy==1.26.4 86.3 ms 1.41 s x1.00 numpy==1.26.4
120
+ 2 3.12.13 numpy==1.26.4 91.5 ms 1.50 s x1.06 numpy==1.26.4
121
+ 3 3.11.15 detected 132.5 ms 407.7 ms x1.54 numpy==2.4.6
122
+ ...
123
+ - python 3.13 numpy==1.26.4 SKIPPED skipped: numpy==1.26.4 has no wheels for Python 3.13
124
+ ```
125
+
126
+ Each combination gets its own uv environment. The script runs once cold (imports included) and then `--repeat` more times warm in the same process; the ranking uses the warm median. Combinations PyPI says can't install from wheels are skipped up front instead of failing slowly in a source build. Gaps under 5% are reported as noise. `--pin` writes the winner into the script with exact versions.
127
+
128
+ Without `--python`, it tries every installed Python that fits the detected range (`uv python list --only-installed`).
129
+
130
+ Caveats: warm runs re-execute the whole script, so scripts with side effects (writing files, network calls) aren't good bench targets. Timings on a laptop are noisy, so use a bigger `--repeat` before trusting small differences.
131
+
132
+ ## Suggestions
133
+
134
+ `depsense suggest` looks for code with a known faster alternative:
135
+
136
+ | Pattern | Suggestion | Auto-verified |
137
+ |---|---|---|
138
+ | `json.dumps/loads/dump/load` | orjson | yes |
139
+ | `asyncio.run(...)` | uvloop | yes |
140
+ | `pd.read_csv(...)` | `engine="pyarrow"` | yes, unless it uses options pyarrow lacks |
141
+ | `df.iterrows()` | vectorize / `itertuples()` / polars | no |
142
+ | `requests.get` in a loop | one `requests.Session()` | no |
143
+ | `list.pop(0)` in a loop | `collections.deque` | no |
144
+ | `s += "..."` in a loop | `"".join(parts)` | no |
145
+ | `difflib.SequenceMatcher` | rapidfuzz | no |
146
+ | `np.vectorize` | real array operations | no |
147
+
148
+ With `--verify`, each auto-verifiable swap is applied to a temp copy of the script (your file is never touched) and benchmarked against the original on the same Python. It also compares stdout from the first run, so a swap that changes behavior is flagged:
149
+
150
+ ```
151
+ $ depsense suggest examples/slow_patterns.py --verify
152
+ ...
153
+ Verified on Python 3.15.2, median of 5 warm runs:
154
+ original 196.3 ms
155
+ json-orjson 46.8 ms 4.19x faster, OUTPUT DIFFERS, check before switching
156
+ asyncio-uvloop 197.9 ms no real difference, same output
157
+ ```
158
+
159
+ Here orjson is 4x faster, but it writes compact JSON, so the printed length changed. uvloop doesn't help because the script does no network I/O. Both are the kind of answer you only get by measuring on your own code.
160
+
161
+ ## Development
162
+
163
+ ```
164
+ uv sync
165
+ uv run pytest
166
+ ```
167
+
168
+ Rules live in `src/depsense/knowledge.py`. Each rule carries the reason shown to the user, so adding one is a one-liner.
169
+
170
+ ## Known gaps / next up
171
+
172
+ - Generate rules on Linux in CI so releases without arm64 macOS wheels get sampled too, and add more libraries.
173
+ - Method calls on unknown objects (`df.append`) can't be resolved without type inference.
174
+ - Names a library re-exports from another one (`scipy.interp` was numpy's) aren't seen by the generator.
175
+ - Bench whole projects, not just single scripts, and let you mark the function to time.
176
+ - More swaps (polars for simple pandas pipelines, msgspec, rapidfuzz rewrites) and an `--apply` that edits the file once you accept a suggestion.
@@ -0,0 +1,146 @@
1
+ # depsense
2
+
3
+ Figure out which Python version and which library versions a script actually needs, by reading the code.
4
+
5
+ I kept running into old scripts that broke because `np.float` is gone, or `load_boston` was removed, or the code used `match` and I was on 3.9. Pinning everything by hand got old, so this reads the code and works it out.
6
+
7
+ ```
8
+ $ depsense scan examples/legacy_numpy.py
9
+ Python: <3.12
10
+ <3.12 line 3: scikit-learn<1.2 has no wheels for Python 3.12+
11
+ <3.12 line 6: numpy<1.24 has no wheels for Python 3.12+
12
+
13
+ Packages:
14
+ numpy<1.24 (import numpy, line 1)
15
+ <1.24 line 6: `numpy.float` was removed in NumPy 1.24 (use the builtin type)
16
+ <2.0 line 7: `numpy.NaN` was removed in NumPy 2.0
17
+ scikit-learn<1.2 (import sklearn, line 3)
18
+ <1.2 line 3: `sklearn.datasets.load_boston` was removed in scikit-learn 1.2
19
+ ...
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ ```
25
+ depsense scan script.py # explain what it needs and why
26
+ depsense scan script.py --json # same, machine readable
27
+ depsense pin script.py # write a PEP 723 "# /// script" block into the file
28
+ depsense run script.py [args] # run it with uv in an environment that fits
29
+ depsense run --dry-run script.py # just print the uv command
30
+ depsense bench script.py # time it across Python/library versions
31
+ depsense suggest script.py # faster libraries and patterns for this code
32
+ depsense suggest script.py --verify # ...and measure the drop-in swaps on your script
33
+ ```
34
+
35
+ It also takes notebooks and whole folders:
36
+
37
+ ```
38
+ depsense scan analysis.ipynb # code cells only; %magics and !shell lines are ignored
39
+ depsense run analysis.ipynb # open it in JupyterLab with matching versions
40
+ depsense scan myproject/ --exclude tests --exclude "legacy/*"
41
+ depsense pin myproject/ # writes myproject/requirements.txt
42
+ ```
43
+
44
+ Locations in reports point to `src/app/util.py:12` or `analysis.ipynb cell 3, line 2`. Folder scans skip virtualenvs, build output and hidden directories, treat the project's own modules (flat or `src/` layout) as local, and list files that don't parse as warnings instead of stopping.
45
+
46
+ Options go anywhere; arguments meant for your script go after `--`:
47
+ `depsense run script.py -- --input data.csv`.
48
+
49
+ `--high-only` skips the guess-y rules (ones that match on a method name like `.iteritems()` instead of a fully resolved `module.attr` path).
50
+
51
+ ## What it detects
52
+
53
+ - **Packages**: absolute imports minus stdlib and local modules, with import→PyPI name mapping (`cv2` → `opencv-python`, `sklearn` → `scikit-learn`, ...).
54
+ - **Library versions**: APIs that were added or removed in specific releases (numpy, pandas, scikit-learn, scipy, pydantic, SQLAlchemy, Pillow, matplotlib, networkx, tensorflow), resolved through import aliases, so `np.float` and `from numpy import float` both count. Some rules look at keyword arguments, like `read_csv(error_bad_lines=...)`.
55
+ - **Python version**: syntax (walrus, `match`, `except*`, `type` aliases, generics `[T]`, t-strings, ...), stdlib additions (`tomllib`, `itertools.batched`, ...), and stdlib removals (`distutils`, `imp`, `collections.Mapping`, ...).
56
+ - **Cross constraints**: an old library pins Python too. depsense asks PyPI which release uv will actually install and which CPython versions that release has wheels for, so `numpy<1.24` resolves to 1.23.5 and caps Python at `<3.12`. Responses are cached for a day in `~/.cache/depsense`. With `--offline`, or if PyPI can't be reached, it falls back to a small built-in table.
57
+ - **Optional imports**: `try: import ujson / except ImportError: import json` is treated as either-or, so a Python 2 fallback like `cStringIO` doesn't cap anything.
58
+ - **Conflicts**: if the code needs `numpy>=2.0` in one place and `<1.24` in another, it says so and points to both lines.
59
+
60
+ ## Where the rules come from
61
+
62
+ Most rules are generated, not written by hand. `tools/genrules.py` installs the latest patch of every minor release of a library (and every Python from 3.8 to 3.15) in throwaway uv environments, records the public API of each one (module attributes, class members including inherited ones, and the keyword arguments each callable accepts), and diffs consecutive releases. A name that appears in numpy 2.0 becomes `numpy>=2.0`; a keyword that disappears from `read_csv` in pandas 2.0 becomes `pandas<2.0`. Only names that changed are stored, in `src/depsense/data/`.
63
+
64
+ The generator skips anything it can't be sure about: modules that imported in some releases but not others, keywords of callables whose signature isn't visible everywhere, and member names that also exist in the standard library. Hand-written rules in `knowledge.py` cover what the generator can't see and replace generated rules for the same name, since their messages are clearer.
65
+
66
+ Current data: the stdlib (3.8 to 3.15) plus numpy, pandas, scikit-learn, scipy, matplotlib, pydantic, SQLAlchemy, networkx and Pillow. It was generated on Apple Silicon, so releases without arm64 macOS wheels (numpy before 1.21, for example) aren't sampled yet; their rules start at the oldest release that installs. If a release in the middle can't be installed, rules next to it keep a safe bound and say which versions weren't checked.
67
+
68
+ ## How well it works
69
+
70
+ `tools/evaluate.py` takes the example galleries shipped with old releases (scikit-learn 0.22.2 and 0.24.2, matplotlib 3.3.4, networkx 2.4), resolves each script with depsense, builds that environment with uv, and checks that every library API the script references actually exists there. Scripts are never executed. The baseline is what you get from a plain `pip install` today: the latest versions on Python 3.12.
71
+
72
+ | examples from | scripts | baseline | depsense |
73
+ |---|---|---|---|
74
+ | scikit-learn 0.22.2 | 252 | 204 (81%) | 231 (92%) |
75
+ | scikit-learn 0.24.2 | 270 | 239 (89%) | 254 (94%) |
76
+ | matplotlib 3.3.4 | 509 | 425 (83%) | 437 (86%) |
77
+ | networkx 2.4 | 51 | 44 (86%) | 45 (88%) |
78
+ | **total** | 1082 | 912 (84%) | **967 (89%)** |
79
+
80
+ depsense fixed 55 scripts the baseline breaks and broke none that the baseline handles. Most of what's left fails both ways: names re-exported from another package (`scipy.interp` was numpy's), and methods on objects whose type depsense can't infer. The first run of this check is what found the NumPy 2 binary break below, so it's worth rerunning after rule changes.
81
+
82
+ Old compiled libraries (scikit-learn before 1.4.2, matplotlib before 3.8.4, scipy, pandas, ...) were built against NumPy 1.x and crash on import under NumPy 2, and nothing in their metadata says so. When the code needs one of those, depsense also pins `numpy<2.0`.
83
+
84
+ ## Benchmarking
85
+
86
+ ```
87
+ $ depsense bench examples/bench_demo.py --python 3.11,3.12,3.13,3.14 --try "numpy==1.26.4" --repeat 3
88
+ # python variant warm (median) cold vs best packages
89
+ 1 3.11.15 numpy==1.26.4 86.3 ms 1.41 s x1.00 numpy==1.26.4
90
+ 2 3.12.13 numpy==1.26.4 91.5 ms 1.50 s x1.06 numpy==1.26.4
91
+ 3 3.11.15 detected 132.5 ms 407.7 ms x1.54 numpy==2.4.6
92
+ ...
93
+ - python 3.13 numpy==1.26.4 SKIPPED skipped: numpy==1.26.4 has no wheels for Python 3.13
94
+ ```
95
+
96
+ Each combination gets its own uv environment. The script runs once cold (imports included) and then `--repeat` more times warm in the same process; the ranking uses the warm median. Combinations PyPI says can't install from wheels are skipped up front instead of failing slowly in a source build. Gaps under 5% are reported as noise. `--pin` writes the winner into the script with exact versions.
97
+
98
+ Without `--python`, it tries every installed Python that fits the detected range (`uv python list --only-installed`).
99
+
100
+ Caveats: warm runs re-execute the whole script, so scripts with side effects (writing files, network calls) aren't good bench targets. Timings on a laptop are noisy, so use a bigger `--repeat` before trusting small differences.
101
+
102
+ ## Suggestions
103
+
104
+ `depsense suggest` looks for code with a known faster alternative:
105
+
106
+ | Pattern | Suggestion | Auto-verified |
107
+ |---|---|---|
108
+ | `json.dumps/loads/dump/load` | orjson | yes |
109
+ | `asyncio.run(...)` | uvloop | yes |
110
+ | `pd.read_csv(...)` | `engine="pyarrow"` | yes, unless it uses options pyarrow lacks |
111
+ | `df.iterrows()` | vectorize / `itertuples()` / polars | no |
112
+ | `requests.get` in a loop | one `requests.Session()` | no |
113
+ | `list.pop(0)` in a loop | `collections.deque` | no |
114
+ | `s += "..."` in a loop | `"".join(parts)` | no |
115
+ | `difflib.SequenceMatcher` | rapidfuzz | no |
116
+ | `np.vectorize` | real array operations | no |
117
+
118
+ With `--verify`, each auto-verifiable swap is applied to a temp copy of the script (your file is never touched) and benchmarked against the original on the same Python. It also compares stdout from the first run, so a swap that changes behavior is flagged:
119
+
120
+ ```
121
+ $ depsense suggest examples/slow_patterns.py --verify
122
+ ...
123
+ Verified on Python 3.15.2, median of 5 warm runs:
124
+ original 196.3 ms
125
+ json-orjson 46.8 ms 4.19x faster, OUTPUT DIFFERS, check before switching
126
+ asyncio-uvloop 197.9 ms no real difference, same output
127
+ ```
128
+
129
+ Here orjson is 4x faster, but it writes compact JSON, so the printed length changed. uvloop doesn't help because the script does no network I/O. Both are the kind of answer you only get by measuring on your own code.
130
+
131
+ ## Development
132
+
133
+ ```
134
+ uv sync
135
+ uv run pytest
136
+ ```
137
+
138
+ Rules live in `src/depsense/knowledge.py`. Each rule carries the reason shown to the user, so adding one is a one-liner.
139
+
140
+ ## Known gaps / next up
141
+
142
+ - Generate rules on Linux in CI so releases without arm64 macOS wheels get sampled too, and add more libraries.
143
+ - Method calls on unknown objects (`df.append`) can't be resolved without type inference.
144
+ - Names a library re-exports from another one (`scipy.interp` was numpy's) aren't seen by the generator.
145
+ - Bench whole projects, not just single scripts, and let you mark the function to time.
146
+ - More swaps (polars for simple pandas pipelines, msgspec, rapidfuzz rewrites) and an `--apply` that edits the file once you accept a suggestion.
@@ -0,0 +1,71 @@
1
+ [project]
2
+ name = "depsense"
3
+ version = "0.1.0"
4
+ description = "Detect the Python version and exact library versions a script needs, then run it."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "dependencies",
11
+ "python-version",
12
+ "uv",
13
+ "pep723",
14
+ "requirements",
15
+ "benchmark",
16
+ "compatibility",
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 3 - Alpha",
20
+ "Environment :: Console",
21
+ "Intended Audience :: Developers",
22
+ "Intended Audience :: Science/Research",
23
+ "Operating System :: OS Independent",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.10",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Programming Language :: Python :: 3.13",
29
+ "Programming Language :: Python :: 3.14",
30
+ "Programming Language :: Python :: 3.15",
31
+ "Topic :: Software Development :: Build Tools",
32
+ "Topic :: Software Development :: Quality Assurance",
33
+ ]
34
+ dependencies = ["packaging>=23.0"]
35
+
36
+ [[project.authors]]
37
+ name = "Yogvid Wankhede"
38
+ email = "yogvidwankhede@gmail.com"
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/yogvidwankhede/depsense"
42
+ Issues = "https://github.com/yogvidwankhede/depsense/issues"
43
+ Changelog = "https://github.com/yogvidwankhede/depsense/blob/main/CHANGELOG.md"
44
+
45
+ [project.scripts]
46
+ depsense = "depsense.cli:main"
47
+
48
+ [build-system]
49
+ requires = ["uv_build>=0.13.5,<0.14.0"]
50
+ build-backend = "uv_build"
51
+
52
+ [dependency-groups]
53
+ dev = ["pytest>=9.2.0"]
54
+
55
+ [tool.ruff]
56
+ line-length = 120
57
+ target-version = "py310"
58
+
59
+ [tool.ruff.lint]
60
+ select = [
61
+ "E",
62
+ "F",
63
+ "I",
64
+ "B",
65
+ "UP",
66
+ "SIM",
67
+ ]
68
+ ignore = ["SIM108"]
69
+
70
+ [tool.pytest.ini_options]
71
+ testpaths = ["tests"]
@@ -0,0 +1,59 @@
1
+ [project]
2
+ name = "depsense"
3
+ version = "0.1.0"
4
+ description = "Detect the Python version and exact library versions a script needs, then run it."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Yogvid Wankhede", email = "yogvidwankhede@gmail.com" }
8
+ ]
9
+ requires-python = ">=3.10"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ keywords = ["dependencies", "python-version", "uv", "pep723", "requirements", "benchmark", "compatibility"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Intended Audience :: Science/Research",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
25
+ "Programming Language :: Python :: 3.15",
26
+ "Topic :: Software Development :: Build Tools",
27
+ "Topic :: Software Development :: Quality Assurance",
28
+ ]
29
+ dependencies = [
30
+ "packaging>=23.0",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/yogvidwankhede/depsense"
35
+ Issues = "https://github.com/yogvidwankhede/depsense/issues"
36
+ Changelog = "https://github.com/yogvidwankhede/depsense/blob/main/CHANGELOG.md"
37
+
38
+ [project.scripts]
39
+ depsense = "depsense.cli:main"
40
+
41
+ [build-system]
42
+ requires = ["uv_build>=0.13.5,<0.14.0"]
43
+ build-backend = "uv_build"
44
+
45
+ [dependency-groups]
46
+ dev = [
47
+ "pytest>=9.2.0",
48
+ ]
49
+
50
+ [tool.ruff]
51
+ line-length = 120
52
+ target-version = "py310"
53
+
54
+ [tool.ruff.lint]
55
+ select = ["E", "F", "I", "B", "UP", "SIM"]
56
+ ignore = ["SIM108"]
57
+
58
+ [tool.pytest.ini_options]
59
+ testpaths = ["tests"]
@@ -0,0 +1,3 @@
1
+ """depsense: detect what Python and library versions your code needs."""
2
+
3
+ __version__ = "0.1.0"