Skip to main content

Rust-native packaging tool for Python virtual environments

Project description

crabpack

This package was written 100% by AI.

crabpack is a Rust-native, high-performance reimplementation of the venv-pack tool for packaging Python virtual environments. It provides a drop-in compatible command line interface as well as optional Python bindings powered by PyO3.

The crate produces portable .tar, .tar.gz, .tar.bz2, or .zip archives of existing Python virtual environments. During packing, crabpack rewrites shebangs for executables, optionally relinks Python interpreters, and injects a portable activate script (sourced from CPython).

Command line usage

Package an existing virtual environment into an archive file.

Usage: crabpack [OPTIONS]

Options:
  -p, --prefix <PATH>           Full path to environment prefix. Default is
                                current environment.
  -o, --output <PATH>           The path of the output file. Defaults to the
                                environment name with a `.tar.gz` suffix.
      --format <FORMAT>         The archival format to use. [default: infer]
                                [possible values: infer, zip, tar.gz, tgz,
                                tar.bz2, tbz2, tar]
      --python-prefix <PATH>    New prefix path for linking python in the
                                packaged environment.
      --compress-level <INT>    Compression level to use (0-9). Ignored for zip
                                archives. [default: 4]
      --compressor <COMPRESSOR>
                                Compressor to use for .tar.gz archives.
                                [default: auto] [possible values: auto, gzip,
                                pigz]
      --pigz-threads <INT>      Number of threads to use with pigz compression.
      --zip-symlinks            Store symbolic links in the zip archive instead
                                of the linked files.
      --no-zip-64               Disable ZIP64 extensions.
      --exclude <PATTERN>       Exclude files matching this pattern (can be
                                repeated).
      --include <PATTERN>       Re-add excluded files matching this pattern.
  -f, --force                   Overwrite any existing archive at the output
                                path.
  -q, --quiet                   Do not report progress.
      --version                 Show version then exit.
      --help                    Print help information.

Example:

crabpack --prefix /opt/envs/my-env --output my-env.tar.gz --format tar.gz \
  --exclude "*.pyc" --force

Python package

crabpack can also be distributed as a Python package backed by the Rust implementation. The project uses maturin as its build backend and publishes a module compatible with venv_pack.pack.

To work with the Python bindings locally, create a virtual environment and install the extension in development mode:

python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
maturin develop --release -F python

After installation, the package can be imported from Python:

import crabpack

crabpack.pack(prefix="/opt/envs/my-env", output="my-env.tar.gz", format="tar.gz")

To build distributable wheels and an sdist for publishing, run:

maturin build --release -F python

Development

cargo fmt
cargo check
cargo test
pytest -q

The repository includes integration assets under assets/scripts that are embedded into produced archives. The script is derived from CPython's venv implementation and distributed under the PSF license (see assets/scripts/CPYTHON_LICENSE.txt).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crabpack-1.0.1.tar.gz (30.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

crabpack-1.0.1-cp37-abi3-win_amd64.whl (973.5 kB view details)

Uploaded CPython 3.7+Windows x86-64

crabpack-1.0.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

crabpack-1.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

crabpack-1.0.1-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.2 MB view details)

Uploaded CPython 3.7+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file crabpack-1.0.1.tar.gz.

File metadata

  • Download URL: crabpack-1.0.1.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for crabpack-1.0.1.tar.gz
Algorithm Hash digest
SHA256 284b73c1c51d60687287e20d035342cdf48e4101cd7c3a1f48dbd52fdb34dc65
MD5 648d3558b41c839083d06f01664d9d7b
BLAKE2b-256 c16494bb05103b91d47eb8676f82a9fd5c2679557a08d5d982c54e6ef30f309a

See more details on using hashes here.

Provenance

The following attestation bundles were made for crabpack-1.0.1.tar.gz:

Publisher: release.yml on jantzent/crabpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crabpack-1.0.1-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: crabpack-1.0.1-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 973.5 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for crabpack-1.0.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ea04b2152cc5090e1391f7fcb841d028268d566a8ff5f8ed0fa8203fc08f4493
MD5 a2fb6844ed722f7ec093a33163eea5f5
BLAKE2b-256 a72582a826cfa10cb12e8771c7d71c9c30bc258ffcd29be9f533d04f28cbc43f

See more details on using hashes here.

Provenance

The following attestation bundles were made for crabpack-1.0.1-cp37-abi3-win_amd64.whl:

Publisher: release.yml on jantzent/crabpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crabpack-1.0.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for crabpack-1.0.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 73d66e8f535bf966f8bd2ced33c269b775429c098f45f12493e6d7a1e9933e34
MD5 0c3d795230dcc265b17e8873c59d9659
BLAKE2b-256 3f756751a10675efffa03453e48adf1677392be388f20ac26bf7869e449edcd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for crabpack-1.0.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on jantzent/crabpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crabpack-1.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for crabpack-1.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5e19f7c6f4c97e3e5968be29854a2648d9af36d76fbfc9852312a7e658ad4cc8
MD5 c2874c3a7354a5c41d767884ab0f6cd6
BLAKE2b-256 baf6110059eb2371e59d5cc0cf65f23e2d640bd939cdac16515836b4d2e81594

See more details on using hashes here.

Provenance

The following attestation bundles were made for crabpack-1.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on jantzent/crabpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crabpack-1.0.1-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for crabpack-1.0.1-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7820da914f02155e25dbeb049aaa3bbe527cf486ac6bed7a594ac03c604602b1
MD5 7f72ae59e9025b03f24030eac0c3818f
BLAKE2b-256 658af662bf51b28663994540bd71385161db764ab1948b92c386c4b6384ebe25

See more details on using hashes here.

Provenance

The following attestation bundles were made for crabpack-1.0.1-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on jantzent/crabpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page