Open huonw opened 1 month ago
I particularly like this idea as it would mean non-breaking changes when features become stable - which is one gripe I have with the current system. As in, a CLI command you used (or a target) might no longer be that thing (automatic migrations aside).
Rust and Cargo only allow using experimental features in nightly builds Yep, HARD pass here - for a language, I can see it. For a library/tool - it would be rough.
What happens when the a feature goes stable, and the "opt_in" flag is still present? I assume it will run, but just mention that flag is redundant?
I like it a lot! Upvote from me .
This isn't directly related, something I've wanted a few times is "experimental flags". I don't think there is anything stopping this today, but it would be nice to have a pattern that was --experimental-super-long-string
Is your feature request related to a problem? Please describe.
Currently features that aren't ready for prime time have names that indicate this, e.g.
experimental_test_shell_command
target.environments-preview
subsystem,pants.backend.experimental.tools.semgrep
backend.This has good attributes:
But, it has a few downsides:
experimental_test_shell_command
vs.test_shell_command
,environments-preview
vs.environments
)Describe the solution you'd like
Something like
cargo-feature
flags in Rust's Cargo: a configuration variable that indicates which unstable features the user has opted in to. (This is also similar to the `#![feature(...)] attribute for unstable feature flags in Rust code itself: 1, 2). In particular, one adds a single element to the list to acknowledge "I understand this is unstable" and then can forge ahead using that feature in Cargo as normal. When the feature is stabilised, the only update required is to remove the element from the list, no matter how many times the code uses the feature in question.A similar thing could work in Pants:
preview_features_opt_in = [...]
GLOBAL
option that accepts a list of feature namesThis leads to a few behaviours:
Example
Suppose we've implemented this feature, and renamed the experimental features above. Then we might have a repo with configuration like:
Running pants against that configuration might emit errors like:
(The (optional?) link could be to a https://github.com/pantsbuild/pants/labels/stablization tracking issue.)
Then, as prompted, the user could adjust their
pants.toml
to:This is of course normal TOML, so users can add comments with more discussion about each feature as required.
Describe alternatives you've considered
experimental_features
orunstable_features
.Additional context
N/A