deptime 0.2.2__tar.gz → 0.2.3__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.
- {deptime-0.2.2 → deptime-0.2.3}/PKG-INFO +3 -3
- {deptime-0.2.2 → deptime-0.2.3}/README.md +2 -2
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/.claude-plugin/plugin.json +1 -1
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/.mcp.json +1 -1
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/commands/fix-upgrade.md +11 -8
- {deptime-0.2.2 → deptime-0.2.3}/pyproject.toml +1 -1
- {deptime-0.2.2 → deptime-0.2.3}/server.json +2 -2
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/__init__.py +1 -1
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/ingest/snapshot.py +23 -7
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/upgrade.py +15 -6
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_snapshot.py +15 -1
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_upgrade.py +36 -0
- {deptime-0.2.2 → deptime-0.2.3}/.gitignore +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/LICENSE +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/.claude-plugin/icon.png +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/README.md +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/hooks/hooks.json +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/scripts/suggest_deptime.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/integrations/claude-code/skills/deptime/SKILL.md +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/integrations/snippets/agents-md-deptime.md +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/integrations/snippets/cursor-deptime.mdc +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/bench.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/cli.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/config.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/coverage.toml +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/curated.toml +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/index/__init__.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/index/distribution.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/index/location.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/index/schema.sql +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/index/store.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/ingest/__init__.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/ingest/curated.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/ingest/diff.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/ingest/pipeline.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/ingest/pypi.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/ingest/replacements.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/lockfiles.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/models.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/query.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/server/__init__.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/server/http_app.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/server/mcp_app.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/server/metering.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/site.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/snippet.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/stdlib.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/stdlib_names.txt +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/stdlib_versions.txt +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/suppressions.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/tracebacks.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/src/deptime/untrusted.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/__init__.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/conftest.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/golden/tier_a.toml +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_bench.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_curated.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_diff.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_distribution.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_docs.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_golden.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_holdout.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_lockfiles.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_model_alone.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_model_alone_upgrades.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_network.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_own_members.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_pipeline.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_plugin_hook.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_query.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_replacements.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_server.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_site.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_stdio.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_stdlib.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_tracebacks.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_untrusted.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_upgrade_bench.py +0 -0
- {deptime-0.2.2 → deptime-0.2.3}/tests/test_version_policy.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: deptime
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: API time machine for Python libraries: tells coding agents what changed, in which release, and what to use instead. Local-first MCP server.
|
|
5
5
|
Project-URL: Homepage, https://github.com/cschmertz/deptime
|
|
6
6
|
Project-URL: Repository, https://github.com/cschmertz/deptime
|
|
@@ -79,14 +79,14 @@ jobs:
|
|
|
79
79
|
runs-on: ubuntu-latest
|
|
80
80
|
steps:
|
|
81
81
|
- uses: actions/checkout@v7 # pin to a commit in your own workflows
|
|
82
|
-
- uses: cschmertz/deptime@v0.2.
|
|
82
|
+
- uses: cschmertz/deptime@v0.2.3
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
From a terminal, `uvx deptime check-upgrade` compares the pinned versions at `HEAD` with your working tree, or `--package httpx --to 0.28.1` checks one update. An agent can call the `check_upgrade` tool with the code instead, and the Claude Code plugin's `/deptime:fix-upgrade` runs the check and has Claude fix the lines it reports as broken and check the ones it can't tell about. A break is a use the index shows failing at the new version and not at the old one; the report ends with a block a coding agent can act on.
|
|
86
86
|
|
|
87
87
|
**On 264 real Dependabot and Renovate update pull requests** (247 projects, scored once before any fix, [results](https://github.com/cschmertz/deptime/blob/main/bench/upgrade-check/prs/results-2026-11-16.md)), the check failed all 13 whose update breaks the project's code, found 46 of the 48 breaking uses, and flagged 1 of 3,291 uses that still work. 2 of the 264 failed with no real break.
|
|
88
88
|
|
|
89
|
-
**An agent fixing the breaks** (Claude Code on Sonnet 5.5, 25 real broken updates, [results](https://github.com/cschmertz/deptime/blob/main/bench/agent-fix/results-2026-11-16.md)): alone it left the code working in 80% of sessions; with `/deptime:fix-upgrade` in 64%, in a third of the turns; with the plugin installed and not named, 80%.
|
|
89
|
+
**An agent fixing the breaks** (Claude Code on Sonnet 5.5, 25 real broken updates, [results](https://github.com/cschmertz/deptime/blob/main/bench/agent-fix/results-2026-11-16.md)): alone it left the code working in 80% of sessions; with `/deptime:fix-upgrade` in 64%, in a third of the turns; with the plugin installed and not named, 80%. On 66 new broken updates ([results](https://github.com/cschmertz/deptime/blob/main/bench/agent-fix/qa26/results-2026-11-16.md)), the reworked command: 72.7% against 69.7% alone, in about half the turns. It is being improved and measured again on new updates before 1.0.
|
|
90
90
|
|
|
91
91
|
## Install
|
|
92
92
|
|
|
@@ -49,14 +49,14 @@ jobs:
|
|
|
49
49
|
runs-on: ubuntu-latest
|
|
50
50
|
steps:
|
|
51
51
|
- uses: actions/checkout@v7 # pin to a commit in your own workflows
|
|
52
|
-
- uses: cschmertz/deptime@v0.2.
|
|
52
|
+
- uses: cschmertz/deptime@v0.2.3
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
From a terminal, `uvx deptime check-upgrade` compares the pinned versions at `HEAD` with your working tree, or `--package httpx --to 0.28.1` checks one update. An agent can call the `check_upgrade` tool with the code instead, and the Claude Code plugin's `/deptime:fix-upgrade` runs the check and has Claude fix the lines it reports as broken and check the ones it can't tell about. A break is a use the index shows failing at the new version and not at the old one; the report ends with a block a coding agent can act on.
|
|
56
56
|
|
|
57
57
|
**On 264 real Dependabot and Renovate update pull requests** (247 projects, scored once before any fix, [results](https://github.com/cschmertz/deptime/blob/main/bench/upgrade-check/prs/results-2026-11-16.md)), the check failed all 13 whose update breaks the project's code, found 46 of the 48 breaking uses, and flagged 1 of 3,291 uses that still work. 2 of the 264 failed with no real break.
|
|
58
58
|
|
|
59
|
-
**An agent fixing the breaks** (Claude Code on Sonnet 5.5, 25 real broken updates, [results](https://github.com/cschmertz/deptime/blob/main/bench/agent-fix/results-2026-11-16.md)): alone it left the code working in 80% of sessions; with `/deptime:fix-upgrade` in 64%, in a third of the turns; with the plugin installed and not named, 80%.
|
|
59
|
+
**An agent fixing the breaks** (Claude Code on Sonnet 5.5, 25 real broken updates, [results](https://github.com/cschmertz/deptime/blob/main/bench/agent-fix/results-2026-11-16.md)): alone it left the code working in 80% of sessions; with `/deptime:fix-upgrade` in 64%, in a third of the turns; with the plugin installed and not named, 80%. On 66 new broken updates ([results](https://github.com/cschmertz/deptime/blob/main/bench/agent-fix/qa26/results-2026-11-16.md)), the reworked command: 72.7% against 69.7% alone, in about half the turns. It is being improved and measured again on new updates before 1.0.
|
|
60
60
|
|
|
61
61
|
## Install
|
|
62
62
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deptime",
|
|
3
3
|
"displayName": "DepTime",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"description": "Explains Python ImportError / AttributeError / TypeError caused by library API changes: what changed, in which release, and what to use instead. Runs locally; your code and errors never leave your machine.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "cschmertz",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Find what a dependency update breaks in this project's Python code with DepTime, then fix those lines
|
|
3
3
|
argument-hint: "[package version [old-version]] (empty: compare the lockfiles at HEAD with the working tree)"
|
|
4
|
-
allowed-tools: Bash(uvx deptime==0.2.
|
|
4
|
+
allowed-tools: Bash(uvx deptime==0.2.3 check-upgrade:*), Bash(rm .deptime-report.md)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
DepTime finds the uses an update breaks; you write the fix. Its breaks are confirmed: fix them
|
|
8
|
-
|
|
7
|
+
DepTime finds the uses an update breaks; you write the fix. Its breaks are confirmed: fix them. Leave working code
|
|
8
|
+
as it is, but if you find another use this update breaks, fix that too.
|
|
9
9
|
|
|
10
10
|
1. Run the check from the project's root. Arguments: `$ARGUMENTS`. It writes its report to `.deptime-report.md`;
|
|
11
11
|
read that file with the Read tool (it can be longer than the shell shows). Run each command here exactly as
|
|
12
12
|
written, on its own: no `;`, `&&`, `echo`, pipe or redirect (the shell already shows the exit code, and a
|
|
13
13
|
command with more in it may be refused).
|
|
14
|
-
- With a package and a version: `uvx deptime==0.2.
|
|
14
|
+
- With a package and a version: `uvx deptime==0.2.3 check-upgrade . --package <package> --to <version> --format markdown --output .deptime-report.md`.
|
|
15
15
|
Add `--from <old-version>` when it was given.
|
|
16
|
-
- With none: `uvx deptime==0.2.
|
|
16
|
+
- With none: `uvx deptime==0.2.3 check-upgrade . --format markdown --output .deptime-report.md`. It compares the
|
|
17
17
|
pinned versions at `HEAD` (`uv.lock`, `poetry.lock`, `pyproject.toml`, `requirements*.txt`) with the working
|
|
18
18
|
tree, so update the lockfile first. On a branch, add `--base <the branch's base>`.
|
|
19
19
|
2. Exit code 2 is an error, printed in the shell. If it says to pass `--from`, the project pins the package somewhere
|
|
@@ -22,12 +22,15 @@ code it didn't report as broken or unsure.
|
|
|
22
22
|
3. Exit code 1 means breaks. The report's "For a coding agent" block lists each one with every line it reaches:
|
|
23
23
|
- "the index proves `old` -> `new`": use `new` where the code uses `old`.
|
|
24
24
|
- "try X": the best replacement the index found; check how X is called at the new version before rewriting.
|
|
25
|
-
- No replacement:
|
|
26
|
-
|
|
25
|
+
- No replacement: find how the new version does the same thing, in its source, release notes or migration guide,
|
|
26
|
+
and rewrite the code to that, even when it takes more than a rename (a new class, a new way to build or call
|
|
27
|
+
it). Leave a line only when the new version has no way to do what it did; then say why, and offer to pin the
|
|
28
|
+
package to the last version that had it (the report says which).
|
|
27
29
|
- For the full detail of a break (each replacement's signature and confidence, release links), run the check
|
|
28
30
|
again with `--format json --output .deptime-report.md` and read the file.
|
|
29
31
|
4. Uses under "DepTime can't tell" may or may not break: DepTime couldn't follow them. Check each one yourself in
|
|
30
|
-
the new version's source or release notes, and fix it if it's broken. Do this even when the check
|
|
32
|
+
the new version's source or release notes, and fix it the same way if it's broken. Do this even when the check
|
|
33
|
+
exits 0.
|
|
31
34
|
Deprecations still work, and uses flagged at the old version too aren't caused by this update: leave both.
|
|
32
35
|
5. Run the same command again, and repeat until it exits 0 or only breaks you couldn't fix remain. Then delete the
|
|
33
36
|
report (`rm .deptime-report.md`), and report each line you changed, each unsure use you checked and what you
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "deptime"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.3"
|
|
4
4
|
description = "API time machine for Python libraries: tells coding agents what changed, in which release, and what to use instead. Local-first MCP server."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"sizes": ["any"]
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
|
-
"version": "0.2.
|
|
17
|
+
"version": "0.2.3",
|
|
18
18
|
"packages": [
|
|
19
19
|
{
|
|
20
20
|
"registryType": "pypi",
|
|
21
21
|
"registryBaseUrl": "https://pypi.org",
|
|
22
22
|
"identifier": "deptime",
|
|
23
|
-
"version": "0.2.
|
|
23
|
+
"version": "0.2.3",
|
|
24
24
|
"runtimeHint": "uvx",
|
|
25
25
|
"transport": {
|
|
26
26
|
"type": "stdio"
|
|
@@ -38,7 +38,7 @@ from deptime.ingest.replacements import (
|
|
|
38
38
|
if TYPE_CHECKING:
|
|
39
39
|
from deptime.config import ServedRule
|
|
40
40
|
|
|
41
|
-
SNAPSHOT_FORMAT =
|
|
41
|
+
SNAPSHOT_FORMAT = 28 # bump when extraction changes: cached snapshots in another format are rebuilt
|
|
42
42
|
MAX_DEPTH = 12 # guards pathological re-export cycles
|
|
43
43
|
|
|
44
44
|
DEPRECATED_DECORATOR_RE = re.compile(r"^(?:[\w.]+\.)?deprecated\b(?:\(.*\))?$", re.S)
|
|
@@ -4172,8 +4172,10 @@ def _bound_class(attr: griffe.Object) -> griffe.Class | None:
|
|
|
4172
4172
|
def _bound_method(attr: griffe.Object) -> griffe.Function | None:
|
|
4173
4173
|
"""The method a module-level name is bound to through a module-level instance of one of the package's classes
|
|
4174
4174
|
(DT-DATA-66): huggingface_hub's `api = HfApi()` then `list_models = api.list_models`. Python finds the bound
|
|
4175
|
-
method under the name, which takes the method's parameters but `self`.
|
|
4176
|
-
|
|
4175
|
+
method under the name, which takes the method's parameters but `self`. The instance's class is the one it calls,
|
|
4176
|
+
else the one its annotation names (DT-DATA-83): streamlit 1.33+'s `_main: _DeltaGenerator =
|
|
4177
|
+
_dg_singleton._main_dg` then `pyplot = _main.pyplot`, and so on for 103 top-level `st.<name>`. None for any
|
|
4178
|
+
other value, an instance whose class neither says, or a member that isn't a function (a property)."""
|
|
4177
4179
|
value = getattr(attr, "value", None)
|
|
4178
4180
|
if (
|
|
4179
4181
|
not isinstance(value, griffe.ExprAttribute)
|
|
@@ -4188,18 +4190,32 @@ def _bound_method(attr: griffe.Object) -> griffe.Function | None:
|
|
|
4188
4190
|
holder = _resolve(attr.modules_collection[instance.canonical_path]) # type: ignore[union-attr]
|
|
4189
4191
|
if holder is None or not holder.is_attribute or holder.parent is None or not holder.parent.is_module:
|
|
4190
4192
|
return None
|
|
4193
|
+
cls = None
|
|
4191
4194
|
call = getattr(holder, "value", None)
|
|
4192
|
-
if
|
|
4195
|
+
if isinstance(call, griffe.ExprCall) and isinstance(
|
|
4193
4196
|
call.function, (griffe.ExprName, griffe.ExprAttribute)
|
|
4194
4197
|
):
|
|
4195
|
-
|
|
4196
|
-
cls
|
|
4197
|
-
|
|
4198
|
+
cls = _class_at(holder, call.function)
|
|
4199
|
+
if cls is None:
|
|
4200
|
+
cls = _class_at(holder, getattr(holder, "annotation", None))
|
|
4201
|
+
found = _member(cls, method.name, inherited=True) if cls is not None else None
|
|
4198
4202
|
except Exception: # outside the package, not loaded, or an alias griffe can't resolve
|
|
4199
4203
|
return None
|
|
4200
4204
|
return found if isinstance(found, griffe.Function) else None
|
|
4201
4205
|
|
|
4202
4206
|
|
|
4207
|
+
def _class_at(obj: griffe.Object, expr: object) -> griffe.Class | None:
|
|
4208
|
+
"""The package's class a plain name or dotted name (not a subscript, a string or a call) resolves to from
|
|
4209
|
+
`obj`'s module; None for anything else, or a name outside the package."""
|
|
4210
|
+
if not isinstance(expr, (griffe.ExprName, griffe.ExprAttribute)):
|
|
4211
|
+
return None
|
|
4212
|
+
try:
|
|
4213
|
+
found = _resolve(obj.modules_collection[expr.canonical_path])
|
|
4214
|
+
except Exception: # outside the package, not loaded, or an alias griffe can't resolve
|
|
4215
|
+
return None
|
|
4216
|
+
return found if found is not None and found.is_class else None # type: ignore[return-value]
|
|
4217
|
+
|
|
4218
|
+
|
|
4203
4219
|
def _metaclass(cls: griffe.Class) -> griffe.Class | None:
|
|
4204
4220
|
"""The package's class `cls` declares as its metaclass: `class Retry(metaclass=_RetryMeta)`, or six's
|
|
4205
4221
|
`@six.add_metaclass(_RetryMeta)`, as urllib3 1.26 writes it (DT-DATA-69). None when it declares none, or one
|
|
@@ -488,8 +488,6 @@ def _handoff(result: UpgradeCheckResult) -> list[str]:
|
|
|
488
488
|
step += f"; try {_plain(f.replacements[0].target)}"
|
|
489
489
|
where = ", ".join(f"{_plain(loc.file)}:{loc.line}" for loc in locs) or "(no line recorded)"
|
|
490
490
|
items.append(f"- {where}: {step}")
|
|
491
|
-
if not items:
|
|
492
|
-
return []
|
|
493
491
|
# DT-GTM-08: an `unknown` is a use DepTime can't rule out, not one it cleared (DT-QA-05 lost 4 sessions on it)
|
|
494
492
|
unsure = [
|
|
495
493
|
f"- {', '.join(f'{_plain(loc.file)}:{loc.line}' for loc in x.locations) or '(no line recorded)'}: "
|
|
@@ -498,6 +496,8 @@ def _handoff(result: UpgradeCheckResult) -> list[str]:
|
|
|
498
496
|
for x in p.notices
|
|
499
497
|
if x.status == "unknown"
|
|
500
498
|
]
|
|
499
|
+
if not items and not unsure:
|
|
500
|
+
return []
|
|
501
501
|
more = "- and {} more: run `deptime check-upgrade --format json` for all"
|
|
502
502
|
shown = items[:MAX_HANDOFF_LINES]
|
|
503
503
|
if len(items) > len(shown):
|
|
@@ -512,12 +512,21 @@ def _handoff(result: UpgradeCheckResult) -> list[str]:
|
|
|
512
512
|
"<details><summary>For a coding agent</summary>",
|
|
513
513
|
"",
|
|
514
514
|
"```text",
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
*
|
|
515
|
+
# DT-GTM-09 (from DT-QA-26): the block also shows when DepTime confirmed no break but can't tell about
|
|
516
|
+
# some uses, and says what to do without a replacement (the agent left 3 breaks it found as "not clear")
|
|
517
|
+
*(
|
|
518
|
+
[
|
|
519
|
+
"DepTime confirmed these uses break with this update (failing at the new version, not at the old).",
|
|
520
|
+
"Fix these lines. Where no replacement is given, find how the new version does the same thing (its"
|
|
521
|
+
" source, release notes or migration guide) and rewrite the code to it.",
|
|
522
|
+
*shown,
|
|
523
|
+
]
|
|
524
|
+
if shown
|
|
525
|
+
else ["DepTime confirmed no break in this update."]
|
|
526
|
+
),
|
|
518
527
|
*tail,
|
|
519
528
|
"Deprecations still work, and uses that fail at the old version too aren't caused by this update.",
|
|
520
|
-
"Then run deptime check-upgrade again: it should find no breaks.",
|
|
529
|
+
*(["Then run deptime check-upgrade again: it should find no breaks."] if shown else []),
|
|
521
530
|
"```",
|
|
522
531
|
"",
|
|
523
532
|
"</details>",
|
|
@@ -3417,7 +3417,9 @@ def test_a_name_bound_to_a_module_level_instances_method_takes_its_signature(tmp
|
|
|
3417
3417
|
"""DT-DATA-66: huggingface_hub binds its top-level functions as `api = HfApi()` then `list_models =
|
|
3418
3418
|
api.list_models`; `list_models(model_name=...)` breaks where `HfApi.list_models` has no such parameter."""
|
|
3419
3419
|
files = {
|
|
3420
|
-
"hub/__init__.py":
|
|
3420
|
+
"hub/__init__.py": (
|
|
3421
|
+
"from hub.api import HfApi, list_models, upload, whoami, size, made, other, typed, typed_made, maybe\n"
|
|
3422
|
+
),
|
|
3421
3423
|
"hub/base.py": ("class Base:\n def whoami(self, token=None):\n pass\n"),
|
|
3422
3424
|
"hub/api.py": (
|
|
3423
3425
|
"import warnings\n"
|
|
@@ -3437,6 +3439,13 @@ def test_a_name_bound_to_a_module_level_instances_method_takes_its_signature(tmp
|
|
|
3437
3439
|
"made = factory().list_models\n"
|
|
3438
3440
|
"_made = factory()\n"
|
|
3439
3441
|
"other = _made.list_models\n"
|
|
3442
|
+
"from typing import Optional\n"
|
|
3443
|
+
"_typed: HfApi = _holder.api\n"
|
|
3444
|
+
"typed = _typed.list_models\n"
|
|
3445
|
+
"_typed_made: HfApi = factory()\n"
|
|
3446
|
+
"typed_made = _typed_made.upload\n"
|
|
3447
|
+
"_maybe: Optional[HfApi] = None\n"
|
|
3448
|
+
"maybe = _maybe.list_models\n"
|
|
3440
3449
|
),
|
|
3441
3450
|
}
|
|
3442
3451
|
snap = build_snapshot("hub", "1.0", ["hub"], _write(tmp_path, files))
|
|
@@ -3454,6 +3463,11 @@ def test_a_name_bound_to_a_module_level_instances_method_takes_its_signature(tmp
|
|
|
3454
3463
|
# A property's value, and an instance not made by calling the class, stay attributes.
|
|
3455
3464
|
assert symbols["hub.size"].kind == "attribute"
|
|
3456
3465
|
assert symbols["hub.made"].kind == "attribute" and symbols["hub.other"].kind == "attribute"
|
|
3466
|
+
# DT-DATA-83: an instance its annotation types (streamlit 1.33+'s `_main: _DeltaGenerator = ...`), whatever its
|
|
3467
|
+
# value; not one typed through a subscript.
|
|
3468
|
+
assert [p["name"] for p in symbols["hub.typed"].params] == ["search", "limit"]
|
|
3469
|
+
assert [p["name"] for p in symbols["hub.typed_made"].params] == ["repo_id", "folder", "run_as_future"]
|
|
3470
|
+
assert symbols["hub.maybe"].kind == "attribute"
|
|
3457
3471
|
|
|
3458
3472
|
|
|
3459
3473
|
def test_a_modules_version_is_public_however_it_is_bound(tmp_path):
|
|
@@ -305,6 +305,42 @@ def test_the_hand_off_asks_the_agent_to_check_unknown_uses():
|
|
|
305
305
|
j = lines.index("- b.py:7: httpx.Maybe in httpx 2")
|
|
306
306
|
assert i < j and "check each one yourself" in lines[j - 1]
|
|
307
307
|
assert "httpx.Old" not in hand # a deprecation still works: nothing to do for this update
|
|
308
|
+
assert "Where no replacement is given" in hand # DT-GTM-09: rewrite it, don't leave it
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def test_agent_block_lists_unknowns_without_breaks():
|
|
312
|
+
"""DT-GTM-09: with no confirmed break, the uses DepTime can't tell about still reach the agent."""
|
|
313
|
+
from deptime.models import PackageUpgrade, UpgradeCheckResult, UpgradeNotice, UseLocation
|
|
314
|
+
|
|
315
|
+
notices = [
|
|
316
|
+
UpgradeNotice(
|
|
317
|
+
path="httpx.Maybe",
|
|
318
|
+
status="unknown",
|
|
319
|
+
detail="namespace package",
|
|
320
|
+
locations=[UseLocation(file="b.py", line=7)],
|
|
321
|
+
)
|
|
322
|
+
]
|
|
323
|
+
res = UpgradeCheckResult(
|
|
324
|
+
project="p",
|
|
325
|
+
breaks=0,
|
|
326
|
+
checked=[
|
|
327
|
+
PackageUpgrade(
|
|
328
|
+
change=_change("1", "2"),
|
|
329
|
+
resolved_version="2",
|
|
330
|
+
exact=True,
|
|
331
|
+
uses=1,
|
|
332
|
+
files=1,
|
|
333
|
+
breaks=[],
|
|
334
|
+
notices=notices,
|
|
335
|
+
)
|
|
336
|
+
],
|
|
337
|
+
)
|
|
338
|
+
hand = to_markdown(res).split("For a coding agent", 1)[1]
|
|
339
|
+
assert "DepTime confirmed no break in this update." in hand
|
|
340
|
+
assert "- b.py:7: httpx.Maybe in httpx 2" in hand
|
|
341
|
+
assert "run deptime check-upgrade again" not in hand
|
|
342
|
+
res.checked[0].notices = []
|
|
343
|
+
assert "For a coding agent" not in to_markdown(res)
|
|
308
344
|
|
|
309
345
|
|
|
310
346
|
def test_project_files_follow_gitignore(tmp_path):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|