Skip to content

Add no-fetch lockfile transcoding - #161

Open
jezdez wants to merge 8 commits into
fix/rattler-v6-build-numberfrom
fix/no-fetch-lockfile-records
Open

jezdez wants to merge 8 commits into
fix/rattler-v6-build-numberfrom
fix/no-fetch-lockfile-records

Conversation

@jezdez

@jezdez jezdez commented Jul 21, 2026

Copy link
Copy Markdown
Member

Description

Add an atomic transcode() method to the conda-lock v1 and rattler-lock v6 loaders. It reconstructs export-only records from package URLs and embedded metadata, renders the selected lockfile format, and returns serialized content without reading the package cache or downloading package archives.

The existing env and env_for() paths remain fetch-backed so installation callers still receive complete package metadata. Invalid URLs, malformed wheel filenames, unsupported wheel tags, dangling or mismatched rattler references, and unsupported source package types produce controlled conda errors.

Build on #175 so embedded build_number values, including zero, survive rattler-lock v6 transcoding. No-fetch records retain the existing zero default when the source omits the field. Installation loaders continue to use cached package metadata for omitted fields. Conversion emits the metadata supported by the selected output format, and conda-lock v1 has no standalone build-number field.

Use the public installer wheel filename parser and conda-pypi's current pure-wheel identity. Accept the standard manager: pip value in conda-lock v1 and align the conda runtime requirement with the EnvironmentFormat API used by the plugin.

This lets conda-presto transcode uploaded lockfiles without package downloads or exposing incomplete Environment objects to callers.

Closes #179. Related to #176.

Checklist - did you ...

  • Add a file to the news directory for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@github-project-automation github-project-automation Bot moved this to 🆕 New in 🔎 Review Jul 21, 2026
@jezdez
jezdez requested a review from travishathaway July 21, 2026 17:02
@jezdez
jezdez force-pushed the fix/no-fetch-lockfile-records branch from 1ff3ad1 to a634524 Compare July 21, 2026 18:11
@jezdez
jezdez requested a review from a team July 21, 2026 18:42
Comment thread conda_lockfiles/conda_lock/v1.py Outdated
Comment on lines +227 to +228
:param fetch: Fetch complete package records for installation. Environments
created with ``fetch=False`` must only be passed to lockfile exporters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a bit of a warning sign that we're defining an invariant in the comments here. Once we've returned this Environment object, we don't necessarily have a way of tracking of how we created it and can use it unless we're tracking that at the caller level.

Have you thought through the implications of this and possible ways around it? I know it's not as simple as adding a new property to Environment (that's probably not the best place for it either). I also wouldn't want to change the function signature here either 🤔.

This isn't a show stopper for me. Just want to make sure we're thinking through the implications of this sort of API design.

Comment thread news/161-no-fetch-lockfile-export.md Outdated
Comment on lines +1 to +7
### Enhancements

* Add an export mode to `env_for()` so callers can export lockfiles without downloading package artifacts.

### Bug fixes

* Align the conda package runtime requirement with the EnvironmentFormat API used by the plugin.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Enhancements
* Add an export mode to `env_for()` so callers can export lockfiles without downloading package artifacts.
### Bug fixes
* Align the conda package runtime requirement with the EnvironmentFormat API used by the plugin.
### Enhancements
* Add an export mode to `env_for()` so callers can export lockfiles without downloading package artifacts. (#161)
### Bug fixes
* Align the conda package runtime requirement with the EnvironmentFormat API used by the plugin. (#161)

Comment thread conda_lockfiles/rattler_lock/v6.py Outdated
None,
)
if pkg is None:
raise CondaValueError(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bugfix that deserves its news item.

Comment thread conda_lockfiles/rattler_lock/v6.py Outdated
if conda_pypi_channel and ref.url.startswith(PYTHONHOSTED_URL_PREFIX):
overrides["channel"] = conda_pypi_channel
if not fetch:
overrides.update(build="py3_none_any_0", subdir="noarch")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure these are always true? Do pypi-converted packages exhibit build numbers (e.g. the converter bumps them after a change in the implementation or a 2nd run)? You should also double check that the subdir is noarch because maybe in the future this is also shipping non-noarch packages.

are filled from the package cache.

When ``fetch`` is false, package artifacts and cache entries are not read.
The metadata-only records use zero for the required ``build_number`` field

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fragile 🤔

@jezdez
jezdez force-pushed the fix/no-fetch-lockfile-records branch from a634524 to a88a385 Compare July 22, 2026 13:13
@jezdez jezdez changed the title Add no-fetch lockfile export path Add no-fetch lockfile transcoding Jul 22, 2026
@jezdez
jezdez force-pushed the fix/no-fetch-lockfile-records branch from 26529ff to bb2b3df Compare September 15, 2026 07:59
@jezdez
jezdez changed the base branch from main to fix/rattler-v6-build-number September 15, 2026 07:59
@jezdez
jezdez added this pull request to stack #177 September 15, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

Transcode lockfiles without fetching package artifacts

4 participants