Skip to content

feat: Support remote URLs in inject, fetch-file, and inspect commands - #2538

Draft
pavelzw wants to merge 4 commits into
mainfrom
claude/rattler-bin-package-support-d3oerk
Draft

feat: Support remote URLs in inject, fetch-file, and inspect commands#2538
pavelzw wants to merge 4 commits into
mainfrom
claude/rattler-bin-package-support-d3oerk

Conversation

@pavelzw

@pavelzw pavelzw commented Jun 26, 2026

Copy link
Copy Markdown
Member
🤖 yap

Description

Extends the rattler-bin commands to accept remote URLs in addition to local file paths:

  • inject command: Now accepts both local paths and remote URLs for conda package archives. Remote packages are downloaded to a temporary directory and their archives are cached to avoid re-downloading during installation.
  • fetch-file command: Now accepts both local paths and remote URLs for conda packages when extracting files.
  • inspect command: Now accepts both local paths and remote URLs for conda packages when reading metadata.

The implementation includes:

  • A shared parse_remote_url() helper function to distinguish between remote URLs and local paths (treating file:// URLs as local)
  • New resolve_local_package() and resolve_remote_package() functions in the inject command to handle both cases
  • A download_archive() function that streams remote packages to disk
  • Integration with the package cache to avoid redundant downloads during installation
  • Support for reading package files from local archives using rattler_package_streaming::seek

All three commands now have consistent behavior: they accept a package argument that can be either a local file path or a remote URL (http/https).

How Has This Been Tested?

  • Existing unit tests updated to work with the new string-based package arguments
  • The inject command tests continue to pass with local paths converted to strings
  • Changes maintain backward compatibility with local file paths

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (help text updated)
  • Existing tests pass with the changes

https://claude.ai/code/session_01QkUDTwKbtUcLCwrnuzwYn5

prompt:

In rattler bin Give me an overview of subcommands that only support local file system conda packages and which only support remote conda packages. Is it feasible to support both?

image

lets add url support to inject-into-prefix and local fs support for inspect + fetch-file

Make the single-archive subcommands accept both local paths and remote
URLs instead of only one or the other:

- `inspect` and `fetch-file` now accept a local file path in addition to
  a URL, reading the requested member directly from the archive via
  `rattler_package_streaming::seek`.
- `inject-into-prefix` now accepts remote URLs in addition to local
  paths. Remote archives are downloaded to a temporary directory, their
  package record is derived locally, and the shared package cache is
  pre-seeded so the installer does not download them a second time. The
  recorded URL is the original remote URL (file:// for local archives).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QkUDTwKbtUcLCwrnuzwYn5
@pavelzw pavelzw changed the title Support remote URLs in inject, fetch-file, and inspect commands feat: Support remote URLs in inject, fetch-file, and inspect commands Jun 26, 2026
claude added 3 commits June 26, 2026 08:02
…ckage-support-d3oerk

# Conflicts:
#	crates/rattler-bin/src/commands/fetch_file.rs
#	crates/rattler-bin/src/commands/inspect.rs
Resolves clippy::single_match_else on the local/remote branch in the
inspect command's read_file helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QkUDTwKbtUcLCwrnuzwYn5
`Url::parse` parses a path like `C:\pkgs\foo.conda` as a URL with the
single-character scheme `c`, so parse_remote_url misclassified Windows
local paths as remote and tried to download them. This broke the inject
tests on Windows and would mishandle real `C:\...` arguments to inject,
inspect and fetch-file.

Require a scheme longer than one character (alongside the existing
file:// exclusion) so drive letters are treated as local paths. Adds a
cross-platform unit test for the classification.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QkUDTwKbtUcLCwrnuzwYn5
@wolfv

wolfv commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@pavelzw ready to undraft?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants