

pydistcheck คืออะไร? pydistcheck เป็นอินเทอร์เฟซบรรทัดคำสั่ง (CLI) ที่คุณทำงานบนแพ็คเกจ Python ซึ่งสามารถ:
มันได้รับแรงบันดาลใจจาก R CMD check ของ R
รูปแบบที่รองรับ:
conda (ทั้ง .conda และ .tar.bz2 ).tar.bz2 , .tar.gz หรือ .zip archive ดู "การอ้างอิงการตรวจสอบ" สำหรับรายการที่สมบูรณ์ของประเภทของปัญหา pydistcheck สามารถจับได้
ดู "วิธีทดสอบการกระจาย Python" เพื่อเรียนรู้วิธี pydistcheck และเครื่องมือที่คล้ายกันเช่น auditwheel , check-wheel-contents และ twine check พอดีกับเวิร์กโฟลว์การพัฒนา Python
สำหรับพื้นหลังเพิ่มเติมเกี่ยวกับค่าของเครื่องมือดังกล่าวให้ดูที่ Scipy 2022 Talk "CSV อยู่ใน PYPI หรือไม่อาจไม่ใช่" (ลิงก์วิดีโอ)
ติดตั้งด้วย pip
pip install pydistcheck หรือ conda
conda install -c conda-forge pydistcheckสำหรับรายละเอียดเพิ่มเติมโปรดดู "การติดตั้ง" (ลิงก์)
ลองใช้กับแพ็คเกจที่คุณชอบ ...
pip download
--no-deps
-d ./downloads
pyarrow
pydistcheck --inspect ./downloads/ * .whl... เพื่อดูว่ามันมีอะไรบ้าง
----- package inspection summary -----
file size
* compressed size: 25.9M
* uncompressed size: 94.0M
* compression space saving: 72.4%
contents
* directories: 0
* files: 809 (30 compiled)
size by extension
* .dylib - 73.2M (77.9%)
* .so - 10.8M (11.4%)
* .h - 4.5M (4.8%)
* .py - 2.4M (2.5%)
* .pyx - 0.8M (0.8%)
* .pxi - 0.7M (0.8%)
* .cc - 0.4M (0.5%)
* .cmake - 0.4M (0.4%)
* .pxd - 0.3M (0.3%)
* .gz - 0.2M (0.2%)
* .hpp - 0.1M (0.1%)
* .txt - 0.1M (0.1%)
* no-extension - 77.4K (0.1%)
* .orc - 48.4K (0.1%)
* .parquet - 14.0K (0.0%)
* .sh - 7.8K (0.0%)
* .md - 3.6K (0.0%)
* .yml - 1.5K (0.0%)
* .ubuntu - 1.3K (0.0%)
* .fedora - 1.0K (0.0%)
* .diff - 1.0K (0.0%)
* .feather - 0.6K (0.0%)
largest files
* (49.1M) pyarrow/libarrow.1700.dylib
* (10.7M) pyarrow/libarrow_flight.1700.dylib
* (3.8M) pyarrow/lib.cpython-311-darwin.so
* (3.8M) pyarrow/libparquet.1700.dylib
* (2.9M) pyarrow/libarrow_substrait.1700.dylib
==================== done running pydistcheck ===============
หรือบนข้อมูลการทดสอบใน repo นี้ ...
pydistcheck tests/data/problematic-package- *... เพื่อดูประเภทของปัญหาที่ตรวจสอบ
------------ check results -----------
1. [files-only-differ-by-case] Found files which differ only by case. Files: problematic-package-0.1.0/problematic_package/Question.py,problematic-package-0.1.0/problematic_package/question.PY,problematic-package-0.1.0/problematic_package/question.py
2. [mixed-file-extensions] Found a mix of file extensions for the same file type: .NDJSON (1), .jsonl (1), .ndjson (1)
3. [mixed-file-extensions] Found a mix of file extensions for the same file type: .yaml (2), .yml (1)
4. [path-contains-non-ascii-characters] Found file path containing non-ASCII characters: 'problematic-package-0.1.0/problematic_package/?veryone-loves-python.py'
5. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/beep boop.ini'
6. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/'
7. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/__init__.py'
8. [path-contains-spaces] Found path with spaces: 'problematic-package-0.1.0/problematic_package/bad code/ship-it.py'
9. [unexpected-files] Found unexpected directory 'problematic-package-0.1.0/.git/'.
10. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/.gitignore'.
11. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/.hadolint.yaml'.
12. [unexpected-files] Found unexpected file 'problematic-package-0.1.0/problematic_package/.gitignore'.
errors found while checking: 12
และในการกระจายที่สร้างขึ้นซึ่งมีวัตถุที่รวบรวม ...
pydistcheck tests/data/debug-baseballmetrics * .whl ... pydistcheck สามารถตรวจจับการรวมสัญลักษณ์การดีบัก (ซึ่งเพิ่มขนาดการกระจาย)
checking 'tests/data/debug-baseballmetrics-0.1.0-py3-none-macosx_10_15_x86_64.macosx_11_6_x86_64.macosx_12_5_x86_64.whl'
------------ check results -----------
1. [compiled-objects-have-debug-symbols] Found compiled object containing debug symbols. For details, extract the distribution contents and run 'dsymutil -s "lib/lib_baseballmetrics.dylib"'.
errors found while checking: 1
checking 'tests/data/debug-baseballmetrics-py3-none-manylinux_2_28_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl'
------------ check results -----------
1. [compiled-objects-have-debug-symbols] Found compiled object containing debug symbols. For details, extract the distribution contents and run 'objdump --all-headers "lib/lib_baseballmetrics.so"'.
errors found while checking: 1
ดู https://pydistcheck.readthedocs.io/en/latest/ เพื่อเรียนรู้เพิ่มเติม