Skip to content

feat: Add feature CLI commands and add remove_feature to pixi_api#5086

Merged
ruben-arts merged 11 commits intoprefix-dev:mainfrom
haecker-felix:pixi_api_features
Dec 10, 2025
Merged

feat: Add feature CLI commands and add remove_feature to pixi_api#5086
ruben-arts merged 11 commits intoprefix-dev:mainfrom
haecker-felix:pixi_api_features

Conversation

@haecker-felix
Copy link
Collaborator

@haecker-felix haecker-felix commented Dec 9, 2025

Description

Adds a new remove_feature to pixi_api WorkspaceContext, which removes a feature from a manifest (and also removes it from environments as well, if necessary).

Also adds new pixi workspace feature rm/ls CLI commands.

pixi % pixi workspace feature rm build
Feature 'build' gets used by the following environment(s): default, lint, test-native-certs. Do you want to remove it anyway? yes
✔ Removed feature build
pixi % pixi workspace feature ls
Features:
- default:
    dependencies: cargo-insta, git, python
    tasks: insta, test-all-extra-slow, install-as, generate-cli-docs, test, install, test-fast, test-all-fast, install-debug-as, build-debug, pypi-proxy, build-release, test-slow, run-all-examples, test-all-slow, release, bump
- pytest:
    dependencies: dirty-equals, filelock, inline-snapshot, py-rattler, pytest, pytest-rerunfailures, pytest-timeout, pytest-xdist, pyyaml, rattler-build, rich, tomli-w, types-pyyaml
    tasks: test-specific-test, test-integration-ci, test-integration-extra-slow-ci, test-specific-test-debug, test-integration-slow, test-integration-extra-slow, update-test-channel, test-common-wheels, test-integration-fast, test-common-wheels-ci
- dev:
    dependencies: cargo-edit, cargo-nextest, cffconvert, tbump
    tasks: switch-to-remote-rattler, switch-to-local-uv, snapshot-update, switch-to-local-rattler, insta-review, update-rattler, switch-to-remote-uv
- lint:
    dependencies: actionlint, basedpyright, cargo-deny, cargo-shear, dprint, go-shfmt, lefthook, ruff, shellcheck, taplo, typos
    tasks: toml-lint, pre-commit-install, typecheck-python, cargo-fmt, shell-format, dprint-fmt, ruff-format, lint-fast, lefthook, dprint-check, pre-commit-install-minimal, cargo-clippy, cargo-deny, typos, cargo-shear, lint-slow, lint, ruff-lint, check-openssl, actionlint, toml-format
- rust:
    dependencies: rust
- build:
    dependencies: compilers, git, openssl, pkg-config, rust-src
- docs:
    dependencies: cairosvg, git-cliff, mdx_truly_sane_lists, mike, mkdocs-llmstxt, mkdocs-material, mkdocs-redirects, pillow
    tasks: mike-serve, deploy-latest, docs, deploy-dev, bump-changelog, build-docs
- schema:
    dependencies: jsonschema, pydantic, pyyaml
    tasks: test-schema, generate-schema
- pypi-gen:
    dependencies: hatchling, python-build
    tasks: pypi-gen-indexes
- micromamba:
    dependencies: micromamba
    tasks: test-export
- trampoline:
    dependencies: python, zstd
    tasks: build-trampoline
- recipes:
    dependencies: rattler-build
    tasks: build-backends
- dist:
    dependencies: zig
- native-certs-test:
    dependencies: mkcert, pip, rich, testcontainers
    tasks: test-native-certs

Closes #1999

  • The issue also mentions a feature add command, which doesn't make much sense, since it would add an empty TOML table and features are getting added / edited implicitly via other commands, like pixi add / remove --feature foo

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Claude code

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added sufficient tests to cover my changes.

@haecker-felix haecker-felix marked this pull request as draft December 9, 2025 08:09
@haecker-felix haecker-felix marked this pull request as ready for review December 9, 2025 12:58
@haecker-felix haecker-felix changed the title feat: Add remove_feature to pixi_api feat: Add feature CLI commands and add remove_feature to pixi_api Dec 9, 2025
Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I had a few comments and questions :)

Comment on lines +50 to +51
writeln!(
std::io::stdout(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you not use println! here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure, I just used environment here as reference, so it's consistent between different commands.

https://github.com/prefix-dev/pixi/blob/main/crates/pixi_cli/src/workspace/environment.rs#L77

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can check who introduced that and ask them. I am curious now. But no blocker for merging it then :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to do with broken pipes without it.

Comment on lines +95 to +99
.inspect_err(|e| {
if e.kind() == std::io::ErrorKind::BrokenPipe {
std::process::exit(0);
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure, I just used environment here as reference, so it's consistent between different commands.

https://github.com/prefix-dev/pixi/blob/main/crates/pixi_cli/src/workspace/environment.rs#L95

haecker-felix and others added 3 commits December 10, 2025 10:01
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, not big changes required. Would love to see my nitpick but I'm not keeping it from being merged because of that so I'm approving it!

let mut details = Vec::new();

if !deps.is_empty() {
details.push(format!(" dependencies: {}", deps.join(", ")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nitpicky but I always like colors to read more quickly, we use green for conda deps and blue for pypi deps. Would you want to add that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your wish shall be granted ✅ a4615b8

image

@ruben-arts ruben-arts enabled auto-merge (squash) December 10, 2025 09:47
@ruben-arts ruben-arts merged commit 941fdb2 into prefix-dev:main Dec 10, 2025
74 of 75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a pixi project feature to add, remove, list, and edit features.

3 participants