Skip to content

feat: add variants to the lock-file (v6)#1854

Merged
baszalmstra merged 5 commits intoconda:mainfrom
baszalmstra:claude/add-lock-file-variants-017dT1ZgxPRKYHJQEsFyt3GW
Nov 27, 2025
Merged

feat: add variants to the lock-file (v6)#1854
baszalmstra merged 5 commits intoconda:mainfrom
baszalmstra:claude/add-lock-file-variants-017dT1ZgxPRKYHJQEsFyt3GW

Conversation

@baszalmstra
Copy link
Collaborator

Add variants to source packages in the lock-file. In the future, we want to make this mandatory, but we want to make sure we don't break compatibility with v6.

This commit adds support for optional `variants` field in lock-file format v6
for source packages, avoiding breaking changes while enabling disambiguation
of multiple source packages at the same location.

Changes:
- Added `VariantValue` enum to represent variant values (String, Int, Bool)
- Added optional `variants` field to `CondaSourceData` structure
- Updated v6 serialization to include variants when present
- Updated v6 deserialization to parse and match variants
- Updated package selectors to include optional variants field
- Added test cases for v6 lock files with variants

The variants feature was originally added in lock-file v7 as a required field,
but this implementation makes it optional in v6 to maintain backward compatibility
while still allowing users to disambiguate between source packages.
Variants should only appear in package definitions, not in package
selectors within environments. Including them in selectors would be
a breaking change for older versions that don't understand the variants
field.

Changes:
- Removed variants field from SerializablePackageSelector
- Removed variants field from DeserializablePackageSelector
- Updated test files to only include variants in package definitions
- Variants remain as optional metadata in package definitions
- Packages must be distinguishable by other means (location, name, etc.)

This ensures backward compatibility while still allowing variants to be
stored as optional metadata for future use.
- Remove unused VariantValue imports from serialize/deserialize modules
- Apply cargo fmt formatting changes
@baszalmstra baszalmstra merged commit 58427eb into conda:main Nov 27, 2025
17 checks passed
@github-actions github-actions bot mentioned this pull request Nov 27, 2025
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.

2 participants