Skip to content

Feature: pixi-unpack --from-extracted <dir> to run post-processing only #267

@joe-cho

Description

@joe-cho

Feature request: pixi-unpack --from-extracted <dir> to run post-processing only

Problem

On Windows, when antivirus software is enabled, pixi-unpack can be very slow because it:

  1. Creates a system temp directory (tempfile::tempdir() → typically %TEMP% / %TMP%), which antivirus often scans.
  2. Extracts the tar archive into that temp dir.
  3. Runs post-processing (validate metadata, create conda cache, install packages, write activation script) — all under that same temp path.

Plain tar extraction (e.g. with 7-zip or another tool) in a user-chosen directory is fast; the slowdown is largely from doing extraction and post-processing under a system temp path that is heavily monitored.

Proposed solution

Add a mode that skips tar extraction and uses an already-extracted pack directory as input. This allows callers to:

  • Extract the tar with a fast method (e.g. Node tar, 7-zip, or system tar) into a directory they control (e.g. app-local, outside system temp).
  • Run pixi-unpack only for the post-processing step, with all I/O under that directory (or another app-local path).

Suggested interface

pixi-unpack --from-extracted <dir> -o <output_dir>

Behavior:

  • Do not create a temp dir or unarchive anything.
  • Treat <dir> as the already-extracted pack root (same layout as after tar -xf environment.tar: pixi-pack.json, channel/, optional pypi/, etc.).
  • Run only:
    1. Validate metadata (pixi-pack.json).
    2. Create prefix: read repodata, build cache (e.g. under <dir>/cache or a configurable path), install conda packages into output_dir/env.
    3. If present, install PyPI packages from <dir>/pypi/.
    4. Write activate.sh / activate.bat under output_dir.

The tar format and pack layout stay the same; this is purely a different “entry point” that assumes the tar has already been extracted.

Example usage (caller side)

# 1. Extract with any fast tool (e.g. tar, 7-zip, Node tar)
tar -xf env-win-64.tar -C .pixi-src

# 2. Run post-processing only
pixi-unpack --from-extracted .pixi-src -o .

Benefits

  • Performance on Windows: Avoids system temp for extraction; callers can extract to an app-local directory that antivirus may not scan as aggressively.
  • Flexibility: Callers can choose their own extractor (e.g. for speed or to avoid touching system temp at all).
  • Same format: The pack remains the same conda-packed tar; no change to how pixi-pack produces it.

Possible implementation notes

  • In unpack.rs, the new code path would skip tempfile::tempdir() and unarchive(), and would set unpack_dir = PathBuf::from(<dir>) (and optionally keep cache under that dir or under -o).
  • The rest of the pipeline (validate metadata → create_prefix → install_pypi_packages → create_activation_script) can likely be reused as-is, with the only difference being the source of unpack_dir.

Alternative names

  • --extract-to could mean “extract the tar into this dir, then run post-processing there” (extract + post-process in one shot, but to a chosen path instead of system temp). That would also help with the antivirus issue. The request above is specifically “post-processing only” so that extraction can be done by an external tool.

Thank you for considering this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions