Skip to content

feat(rattler_lock): add prerelease-mode support for PyPI dependencies#1889

Merged
baszalmstra merged 1 commit intomainfrom
feat/prerelease-mode-lock
Nov 26, 2025
Merged

feat(rattler_lock): add prerelease-mode support for PyPI dependencies#1889
baszalmstra merged 1 commit intomainfrom
feat/prerelease-mode-lock

Conversation

@tdejager
Copy link
Collaborator

@tdejager tdejager commented Nov 26, 2025

Summary

Add support for storing PyPI prerelease mode per environment in lock files. This enables tools like pixi to persist their prerelease configuration.

Related to: prefix-dev/pixi#4984

Changes

  • Add PypiPrereleaseMode enum to SolveOptions with 5 variants:
    • Disallow - Disallow all pre-release versions
    • Allow - Allow all pre-release versions
    • IfNecessary - Allow pre-release versions if necessary to satisfy requirements
    • Explicit - Allow pre-release versions for packages explicitly requested
    • IfNecessaryOrExplicit - Default mode (allow if necessary or explicitly requested)
  • Add optional pypi_prerelease_mode field to SolveOptions struct
  • Add builder methods: set_pypi_prerelease_mode() and with_pypi_prerelease_mode()
  • Add Environment::pypi_prerelease_mode() getter method
  • Add tests for serialization roundtrip of all prerelease modes

Lock File Format

The prerelease mode is stored at the environment level within the options section:

version: 6
environments:
  default:
    channels: []
    options:
      pypi-prerelease-mode: allow
    packages:
      linux-64:
      - conda: https://...

Backwards Compatibility

The implementation is fully backwards compatible:

  • The pypi_prerelease_mode field is optional (Option<PypiPrereleaseMode>)
  • Uses skip_serializing_if = "Option::is_none" so old lock files without this field will parse correctly
  • Uses default attribute so missing field deserializes to None
  • Existing roundtrip tests all pass, confirming no breaking changes

Add support for storing PyPI prerelease mode per environment in lock files.
This enables tools like pixi to persist their prerelease configuration.

Changes:
- Add PypiPrereleaseMode enum with 5 variants (Disallow, Allow, IfNecessary,
  Explicit, IfNecessaryOrExplicit)
- Add optional pypi_prerelease_mode field to SolveOptions struct
- Add builder methods: set_pypi_prerelease_mode() and with_pypi_prerelease_mode()
- Add Environment::pypi_prerelease_mode() getter method
- Add tests for serialization roundtrip of all prerelease modes

The implementation is backwards compatible - the field is optional and
skipped during serialization when None.
@baszalmstra baszalmstra merged commit 8824594 into main Nov 26, 2025
18 checks passed
@baszalmstra baszalmstra deleted the feat/prerelease-mode-lock branch November 26, 2025 15:50
@github-actions github-actions bot mentioned this pull request Nov 26, 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