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

make output file size precision configurable #305

Merged
merged 1 commit into from
Feb 11, 2025
Merged

Conversation

jameslamb
Copy link
Owner

Closes #297

Makes the precision of file sizes appearing in output from --inspect and in log messages / errors configurable.

For example:

mkdir -p ./delete-me
pip download \
  --no-deps \
  -d ./delete-me \
  'pandas>2.0'

Default behavior:

pydistcheck \
    --inspect \
    --max-allowed-size-compressed '500K' \
    ./delete-me/pandas*.whl
==================== running pydistcheck ====================

checking './delete-me/pandas-2.2.3-cp312-cp312-macosx_11_0_arm64.whl'
----- package inspection summary -----
file size
  * compressed size: 10.837M
  * uncompressed size: 38.545M
  * compression space saving: 71.9%
contents
  * directories: 154
  * files: 1509 (44 compiled)
size by extension
  * .py - 19.428M (50.4%)
  * .so - 18.699M (48.5%)
  * no-extension - 0.285M (0.7%)
  * .pyi - 0.101M (0.3%)
  * .toml - 23.883K (0.1%)
  * .tpl - 8.287K (0.0%)
  * .txt - 69.0B (0.0%)
largest files
  * (1.923M) pandas/_libs/groupby.cpython-312-darwin.so
  * (1.78M) pandas/_libs/hashtable.cpython-312-darwin.so
  * (1.626M) pandas/_libs/algos.cpython-312-darwin.so
  * (1.106M) pandas/_libs/interval.cpython-312-darwin.so
  * (1.015M) pandas/_libs/join.cpython-312-darwin.so
------------ check results -----------
1. [distro-too-large-compressed] Compressed size 10.837M is larger than the allowed size (0.488M).
errors found while checking: 1

==================== done running pydistcheck ===============

Configurable output size:

pydistcheck \
    --inspect \
    --max-allowed-size-compressed '500K' \
    --output-file-size-precision 5 \
    ./delete-me/pandas*.whl
==================== running pydistcheck ====================

checking './delete-me/pandas-2.2.3-cp312-cp312-macosx_11_0_arm64.whl'
----- package inspection summary -----
file size
  * compressed size: 10.83705M
  * uncompressed size: 38.54525M
  * compression space saving: 71.9%
contents
  * directories: 154
  * files: 1509 (44 compiled)
size by extension
  * .py - 19.42828M (50.4%)
  * .so - 18.69949M (48.5%)
  * no-extension - 0.28504M (0.7%)
  * .pyi - 0.10095M (0.3%)
  * .toml - 23.88281K (0.1%)
  * .tpl - 8.28711K (0.0%)
  * .txt - 69.0B (0.0%)
largest files
  * (1.92252M) pandas/_libs/groupby.cpython-312-darwin.so
  * (1.77986M) pandas/_libs/hashtable.cpython-312-darwin.so
  * (1.62634M) pandas/_libs/algos.cpython-312-darwin.so
  * (1.10629M) pandas/_libs/interval.cpython-312-darwin.so
  * (1.01499M) pandas/_libs/join.cpython-312-darwin.so
------------ check results -----------
1. [distro-too-large-compressed] Compressed size 10.83705M is larger than the allowed size (0.48828M).
errors found while checking: 1

==================== done running pydistcheck ===============

@jameslamb jameslamb added the enhancement New feature or request label Feb 11, 2025
self._num = num
self._unit_str = unit_str
self._output_unit_str = output_unit_str
Copy link
Owner Author

Choose a reason for hiding this comment

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

This was left behind in #303

@jameslamb jameslamb merged commit 802a9a8 into main Feb 11, 2025
26 checks passed
@jameslamb jameslamb deleted the file-size-precision branch February 11, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] make file size precision configurable
1 participant