Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no-default-feature = true to environment definition #1067

Closed
pavelzw opened this issue Mar 27, 2024 · 4 comments · Fixed by #1092
Closed

Add no-default-feature = true to environment definition #1067

pavelzw opened this issue Mar 27, 2024 · 4 comments · Fixed by #1092
Labels
✨ enhancement Feature request

Comments

@pavelzw
Copy link
Contributor

pavelzw commented Mar 27, 2024

Problem description

[project]
channels = ["conda-forge", "nvidia"]
platforms = ["linux-64", "win-64"]

[dependencies]
pytorch = "*"

[feature.lint]
channels = ["conda-forge"]
platforms = ["linux-64"]
[feature.lint.dependencies]
pre-commit = "*"

[feature.ruff]
platforms = ["linux-aarch64"]
[feature.ruff.dependencies]
ruff = "*"

[environments]
default = ["test"]
lint = {features = ["lint", "ruff"], no-default-feature = true}

This results in the following lint environment:

  • channels = ["conda-forge"] (union of channels from used features) (maybe there is a better solution for this?)
  • dependencies: ruff = "*", pre-commit = "*"
  • platforms = ["linux-aarch64", "linux-64"] (union of all platforms from used features) (maybe there is a better solution for this?)

I know originally I was opposed to this idea since you can represent this using an empty default feature set but I came to realize that this use actually happens quite often and restricting myself to an empty default feature set just because of this is annoying 😅

WDYT? cc @0xbe7a

@pavelzw pavelzw added the ✨ enhancement Feature request label Mar 27, 2024
@baszalmstra
Copy link
Contributor

Haha I like it.

@0xbe7a
Copy link
Contributor

0xbe7a commented Mar 27, 2024

Yes, I think the use case is pretty common and the "no default feature(s)" behavior is pretty intuitive. I don't understand why it's called "no-default-feature_s_" though? As far as I understand it, it only excludes the single implicit "default" feature from the environment, not multiple features, right?

@pavelzw
Copy link
Contributor Author

pavelzw commented Mar 27, 2024

Yes, you're right. no-default-feature would be better :)

@pavelzw pavelzw changed the title Add no-default-features = true to environment definition Add no-default-feature = true to environment definition Mar 27, 2024
@tdejager
Copy link
Contributor

There's a reason cargo has it 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants