Skip to content

Re-add cli library interface #682

Description

@CarliJoy

Hi,

first of all, thank you for providing and maintaining this project.

I have been using wheel.cli.[pack|unpack] inside some internal tooling that patches wheels. Since it is available on PyPI and the documentation refers to it as a "library", I was a bit surprised to see the following change:

Made the wheel.cli package private (no deprecation warning)

I only noticed this while trying to update the dependency lock for my tooling.

I tried to understand the motivation behind this change by looking through the related issues, but I may be missing some context. Perhaps someone could clarify the reasoning?

I saw the attempt in #472 to define a public API, which later continued in the packaging discussion here: pypa/packaging#697. As far as I understand, that discussion aimed at defining a more comprehensive API for manipulating wheel files beyond simply packing and unpacking them.

This made me wonder whether pack and unpack could still exist as a small, straightforward Python API mirroring the CLI/argparse interface. That would allow tools to reuse the functionality directly without needing to call the CLI via subprocess.

For example, something like:

def unpack(path: StrPath, dest: StrPath = ".") -> Path: ...
def pack(directory: StrPath, dest_dir: StrPath, build_number: str | None) -> Path: ...

I noticed that the packaging discussion also mentioned a Sans-IO approach. However, users of this functionality are already working with files and IO, so a small convenience API around the existing behavior might still be useful.

Is there a specific reason why this functionality is intentionally CLI-only now, or am I overlooking something?

Thank you for any clarification.

Improved, not generated by LLM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions