refactor: make extras and conditionals runtime-configurable#1816
Merged
wolfv merged 12 commits intoconda:mainfrom Nov 20, 2025
Merged
Conversation
extras and conditionals runtime-configurable
Collaborator
Author
|
@jaimergp Once this is merged, the python bindings also expose conditionals and extras. |
e4b05a5 to
810a2fe
Compare
Replace compile-time feature flags with runtime parsing options for experimental extras and conditionals syntax in matchspecs. ## Core Changes - Replace ParseStrictness parameter with ParseMatchSpecOptions struct - Add ParseMatchSpecOptions with: - ::strict() and ::lenient() constructors - allow_experimental_extras and allow_experimental_conditionals fields - with_* and set_* builder methods for configuration - Remove experimental_extras and experimental_conditionals cargo features - Remove all cfg feature guards from extras and conditionals code - Extras and conditionals are now always available but controlled via options ## Rattler Binary - Enable experimental features by default in rattler-bin create command ## Python Bindings - Add optional experimental_extras and experimental_conditionals parameters to MatchSpec and NamelessMatchSpec constructors (default: False) - Expose extras and condition fields via getter methods - Add comprehensive test suite for experimental features ## Benefits - Runtime configuration instead of compile-time features - Better flexibility for users to enable features per-call - Backward compatible - features disabled by default - Python bindings maintain compatibility while adding new functionality
6de7637 to
d592fb1
Compare
Resolved conflicts by integrating both changes: - Kept ParseMatchSpecOptions with experimental features (extras, conditionals) - Added exact_names_only parameter from upstream - Updated all import statements to include both old and new types - Updated Python bindings to support all parameters - Accepted upstream Cargo.lock and will regenerate if needed All conflicts resolved in: - crates/rattler_conda_types/src/lib.rs - crates/rattler_conda_types/src/match_spec/mod.rs - crates/rattler_conda_types/src/match_spec/parse.rs - crates/rattler_solve/src/resolvo/mod.rs - crates/rattler_solve/tests/backends.rs - py-rattler/Cargo.lock - py-rattler/rattler/match_spec/match_spec.py - py-rattler/src/match_spec.rs
- Added exact_names_only field to ParseMatchSpecOptions - Added with_exact_names_only() and exact_names_only() methods - Removed experimental_conditionals feature gates (now runtime config) - Cleaned up unused imports in parse.rs - MatchSpecCondition is now always available (not feature-gated)
…pecOptions This adds the missing From implementation to convert ParseStrictnessWithNameMatcher to ParseMatchSpecOptions, which was causing compilation errors in tests.
Removed unused ParseStrictness and ParseStrictnessWithNameMatcher imports from py-rattler match_spec.rs.
This adds the missing `normalized` property to PyPackageNameMatcher that returns the normalized string representation. For exact matches, it returns the normalized package name. For glob and regex patterns, it returns the pattern string. This fixes the Python test failures where tests were accessing `m.name.normalized`.
This adds the normalized property to the Python wrapper class for PackageNameMatcher, which delegates to the underlying Rust PyPackageNameMatcher.normalized property. This allows Python code and type checkers (mypy) to access the normalized attribute.
Contributor
|
Nice clean up! |
Merged
baszalmstra
pushed a commit
to baszalmstra/rattler
that referenced
this pull request
Nov 20, 2025
Integrate changes from main where feature flags for experimental_extras and experimental_conditionals have been removed in favor of runtime configuration through ParseMatchSpecOptions. **Changes:** - Remove all `#[cfg(feature = "experimental_conditionals")]` and `#[cfg(feature = "experimental_extras")]` feature gates - Update MatchSpec parsing to use `ParseMatchSpecOptions::lenient()` with `.with_experimental_conditionals(true)` and `.with_experimental_extras(true)` - Update libsolv_c to work with new `PackageNameMatcher` type instead of `PackageName` (use `as_exact()` to get exact package names for extras) - Remove conditional compilation from test helpers and test modules - All extras and conditionals support is now always compiled and enabled at runtime through parse options **Testing:** - All extras tests pass for both libsolv_c and resolvo backends - All conditional tests pass for both backends - Tests updated to enable experimental features through parse options This aligns the codebase with the refactoring done in PR conda#1816 which made these features runtime-configurable instead of compile-time gated.
Contributor
|
Thank you!! |
Collaborator
Author
|
Your welcome! And as always, let me know if you run into issues! |
Contributor
|
Trying this in conda-incubator/conda-rattler-solver#19, but I'm not sure it works. I do see the conditional dependencies being passed, but I'm not obtaining errors where I thought I would. Do I need to pass a flag to the solver too? I don't see any 🤔 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace compile-time feature flags with runtime parsing options for experimental extras and conditionals syntax in matchspecs. Conditions and extras are not yet parsed from repodata.json.
Core Changes
ParseStrictnessparameter withParseMatchSpecOptionsstructParseMatchSpecOptionswith:::strict()and::lenient()constructorsallow_experimental_extrasandallow_experimental_conditionalsfieldsexperimental_extrasandexperimental_conditionalscargo featurescfgfeature guards fromextrasand conditionals codeRattler Binary
Python Bindings
experimental_extrasandexperimental_conditionalsparameters toMatchSpecandNamelessMatchSpecconstructors (default:False)extrasandconditionfields via getter methodsAI Disclosure
Written by Claude Code Web