Skip to content

Allow specifying compression method and level, in both build and develop modes. #2625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

corentin-ant
Copy link
Contributor

This is a follow-up to #2566 that adds the ability to

--compression-method <COMPRESSION_METHOD>
    Zip compresson method. Only Stored and Deflated are currently compatible with all package managers

    [default: deflated]

    Possible values:
    - deflated: Deflate compression
    - stored:   No compression
    - bzip2:    BZIP2 compression
    - zstd:     Zstandard compression (supported from Python 3.14)

--compression-level <COMPRESSION_LEVEL>
    Zip compresson level

    [default: 6]

Note that additional compression methods were added in uv 0.7.3 in astral-sh/uv#13285 but adding local whl is broken until astral-sh/uv#13781 is merged.

I tested the change locally by setting

        compression: maturin::CompressionOptions {
            compression_method: maturin::CompressionMethod::Bzip2,
            compression_level: 6,
        },

in the tests, which is supported by pip. I can do a follow-up PR to update the tests after uv is updated, possibly with a version check.

…evelop` modes

This is a follow-up to PyO3#2566 that adds the ability to
- Specify other compression methods
- Control compression in the `develop` mode, not only `build`. Solves PyO3#2622

```
--compression-method <COMPRESSION_METHOD>
    Zip compression method. Only Stored and Deflated are currently compatible with all package managers

    [default: deflated]

    Possible values:
    - deflated: Deflate compression
    - stored:   No compression
    - bzip2:    BZIP2 compression
    - zstd:     Zstandard compression (supported from Python 3.14)

--compression-level <COMPRESSION_LEVEL>
    Zip compresson level

    [default: 6]
```

Note that additional compression methods were added in `uv` 0.7.3 in astral-sh/uv#13285 but adding local `whl` is broken until astral-sh/uv#13781 is merged.

I tested the change locally by setting
```
        compression: maturin::CompressionOptions {
            compression_method: maturin::CompressionMethod::Bzip2,
            compression_level: 6,
        },
```
in the tests, which is supported by `pip`. I can do a follow-up PR to update the tests after `uv` is updated, possibly with a version check.
Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

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

Thanks!

@messense messense merged commit 0d81546 into PyO3:main Jun 3, 2025
42 checks passed
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Jun 11, 2025
https://build.opensuse.org/request/show/1284232
by user mia + anag_factory
- Update to 1.8.7
  * Allow specifying compression method and level, in both `build`
    and `develop` modes
    gh#PyO3/maturin#2625
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.

maturin develop hardcodes compression level which adds signifinicant latency to the development loop
2 participants