Skip to content

fix(deps): drop platformdirs, which is never imported - #4675

Open
fer1994 wants to merge 1 commit into
github:mainfrom
fer1994:fix/remove-unused-platformdirs
Open

fer1994 wants to merge 1 commit into
github:mainfrom
fer1994:fix/remove-unused-platformdirs

Conversation

@fer1994

@fer1994 fer1994 commented Sep 22, 2026

Copy link
Copy Markdown

Problem

platformdirs is declared as a runtime dependency in pyproject.toml and in the PEP 723 header of src/specify_cli/__init__.py, but nothing in the repository imports it.

$ grep -rn "import platformdirs\|from platformdirs\|platformdirs\." src tests scripts templates extensions presets
(no matches)

The only two occurrences in the whole tree are the two declarations themselves. There is no dynamic import either — nothing reaches it through importlib.import_module or __import__.

Every user who installs specify-cli pulls a package the CLI never touches.

Evidence

Verified by actually removing it rather than by reading alone. After uv sync --extra test:

$ uv run python -c "import importlib.util; print(importlib.util.find_spec('platformdirs') is not None)"
False

With the package genuinely absent from the interpreter:

  • specify --help, specify check, specify --version — all work
  • Full suite — 8176 passed, 208 skipped, identical to main

Run on macOS 15 (arm64), CPython 3.13.15, against a2c1843.

Scope

Three files, six deleted lines:

  • removes the dependency from pyproject.toml
  • removes it from the PEP 723 header so the two declarations stay in agreement
  • regenerates .github/security-audit-requirements.txt with the command CONTRIBUTING.md documents:
uv pip compile pyproject.toml --extra test --universal --generate-hashes --quiet --no-header --output-file .github/security-audit-requirements.txt

Regenerated without --upgrade deliberately, so the diff is only the four platformdirs lines rather than an unrelated bump of every pinned package.

AI disclosure

Found and written with Claude Code (Opus 5). The claim was verified empirically rather than by inspection alone — the package was removed from the environment and the CLI and full suite were run against its absence. I reviewed the change and re-validated it against current main before opening this.

platformdirs is declared as a runtime dependency in pyproject.toml and
in the PEP 723 header of src/specify_cli/__init__.py, but nothing in the
repository imports it — no static import in src/, tests/, scripts/,
templates/, extensions/ or presets/, and no dynamic import either:

    $ grep -rn "import platformdirs\|platformdirs\." src tests scripts
    (no matches)

Verified by removing it rather than by reading alone: after
`uv sync --extra test` the interpreter has no platformdirs, and the CLI
and the suite are unaffected — `specify --help`, `specify check` and
`specify --version` all work, and pytest reports 8176 passed, 208
skipped, identical to main.

Every user installing specify-cli currently pulls a package the CLI
never touches.

Regenerates .github/security-audit-requirements.txt with the documented
command so the committed audit snapshot stays in sync.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fer1994
fer1994 requested a review from mnriem as a code owner September 22, 2026 13:40
@mnriem mnriem added the triage-nice-to-have Verdict: evidence-backed fix or greenlit feature — land after review label Sep 22, 2026

This branch has not been deployed

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

Labels

triage-nice-to-have Verdict: evidence-backed fix or greenlit feature — land after review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants