Skip to content
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

Feature request: return the size of the sdist or the wheel #719

Open
agriyakhetarpal opened this issue Jan 10, 2024 · 0 comments
Open

Feature request: return the size of the sdist or the wheel #719

agriyakhetarpal opened this issue Jan 10, 2024 · 0 comments

Comments

@agriyakhetarpal
Copy link

agriyakhetarpal commented Jan 10, 2024

Hi! I was wondering if it's possible to include the size of the wheels or the sdists built by build in bytes/kilobytes, say, in the message that build displays after a successful invocation of the build command.

Motivation

  1. It's usually difficult to ascertain what files I have been putting into the wheel with include_package_data or into the sdist with MANIFEST.in – perhaps I'm copying the wrong files or not putting compiled binaries into the wheel, in error
  2. The other alternative to a build frontend that is currently available, i.e., pip wheel, does this and returns both the size and also the SHA-256 hash of the wheel

A workaround for now

To get through this and for further features (i.e, returning a recursive tree of the contents) – I am using https://github.com/hynek/build-and-inspect-python-package/ which uses the wheel unpack and the tar commands under the hood, but even that doesn't return the size of the sdist or the wheel, I need to compute that manually or through the file system implementation of the OS

Possible methods for implementation

The tarfile and the zipfile modules from the standard library are fairly usable and can provide an API for determining the size of a tarball or a .whl file. They can be imported in __main__.py and further used on artifact_list, which I suspect from an overview of the code, is a string containing the name of the files. It can be parsed to construct a Path for them, which zipfile and tarfile can use (unless there is a better way).

Footnotes

I am happy to do this and write a PR shall this end up being a valid suggestion; would appreciate some pointers if it does, thanks!

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

No branches or pull requests

1 participant