Skip to content

Build: report install provenance in dl --version #84

Description

@blooop

Work

Make dl --version report install provenance, and have aid --version inherit it.

Current behavior. Both installs print dl 0.0.9. The version comes from importlib.metadata.version (devlaunch/dl.py:30), which is identical for the released build and an editable install of the same commit.

Wanted. The version string distinguishes them, and the dev build names the tree it resolves to. Exact wording is the implementer's call; the discriminating content is what matters. Something like:

$ dl --version
dl 0.0.9

$ dl-next --version
dl 0.0.9 (dev, editable from /home/ags/projects/devlaunch)

How. Read PEP 610 direct_url.json from the installed dist via importlib.metadata — do not stat paths or pattern-match against ~/.pixi or ~/.local, and do not hardcode any /home/<user> path (see CLAUDE.md). dir_info.editable == true is the discriminator; url supplies the tree to name.

Edge cases that must not crash --version:

  • no direct_url.json at all (a plain wheel/sdist install) — fall back to the current bare output
  • direct_url.json present but malformed or missing keys
  • package metadata absent entirely — PackageNotFoundError is already handled at the existing call site; keep that behavior

Provenance detection is strictly additive: it must never make --version fail, since a broken --version is worse than an ambiguous one.

Done when

  • A test asserts an editable install (dir_info.editable == true) yields output naming it as dev and containing the tree path from url.
  • A test asserts a non-editable install yields the current bare dl <version> output, unchanged.
  • Tests cover the three degradation cases above, each falling back to bare output rather than raising.
  • pixi run ci is green (pytest, pylint, ruff, ty).
  • README updated if it shows --version output (per CLAUDE.md's docs rule).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions