Skip to content

Allow --rm to remove a virtualenv by its dependencies#455

Open
gilgamezh wants to merge 1 commit into
masterfrom
worktree-rm-by-deps
Open

Allow --rm to remove a virtualenv by its dependencies#455
gilgamezh wants to merge 1 commit into
masterfrom
worktree-rm-by-deps

Conversation

@gilgamezh

Copy link
Copy Markdown
Contributor

What

--rm now accepts either a UUID or nothing. When given as a bare flag it removes the virtualenv matching the indicated dependencies, so this:

fades --rm $(fades --where -d django | awk -F "/" '{print $NF}')

becomes simply:

fades --rm -d django

How

  • --rm uses nargs='?' with a REMOVE_BY_DEPS sentinel as const, distinguishing "not passed" / "passed with UUID" / "passed bare".
  • The removal block was moved below the dependency/interpreter/options setup. With the sentinel it resolves the venv via get_venv(indicated_deps, interpreter, options=options) — the same matching used to run a venv — otherwise it uses the existing UUID lookup. Both share the destroy + warning logic.
  • Backward compatible: fades --rm <uuid> behaves exactly as before.

Tests

There were no tests for the --rm flow in go(). Added RemoveVenvTestCase covering removal by UUID (found / not found / invalid env_path) and by dependencies (found / not found).

  • Full suite: 296 passed
  • flake8: clean

Docs

Updated man/fades.1 and README.rst (usage synopsis + command examples).

🤖 Generated with Claude Code

'--rm' now takes an optional UUID: when passed a UUID it removes that
virtualenv as before, but when given as a bare flag it removes the
virtualenv matching the indicated dependencies (e.g. 'fades --rm -d django'),
saving the round-trip through '--where' to look up the UUID.

Add tests for the '--rm' flow in go() (by UUID and by dependencies), and
update the man page and README accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant