zopefoundation / fanstatic

Canonical fanstatic repository
BSD 3-Clause "New" or "Revised" License
11 stars 4 forks source link

Avoid bundling tests in binary wheels #19

Open stefan6419846 opened 2 months ago

stefan6419846 commented 2 months ago

BUG/PROBLEM REPORT / FEATURE REQUEST

What I did:

  1. python3.9 -m pip download --no-deps fanstatic --only-binary :all:
  2. unzip fanstatic-1.4-py3-none-any.whl

What I expect to happen:

Archive:  fanstatic-1.4-py3-none-any.whl
  inflating: fanstatic/__init__.py   
  inflating: fanstatic/checksum.py   
  inflating: fanstatic/compiler.py   
  inflating: fanstatic/config.py     
  inflating: fanstatic/core.py       
  inflating: fanstatic/inclusion.py  
  inflating: fanstatic/injector.py   
  inflating: fanstatic/publisher.py  
  inflating: fanstatic/registry.py   
  inflating: fanstatic/wsgi.py        
  inflating: fanstatic-1.4.dist-info/LICENSE.txt  
  inflating: fanstatic-1.4.dist-info/METADATA  
  inflating: fanstatic-1.4.dist-info/WHEEL  
  inflating: fanstatic-1.4.dist-info/entry_points.txt  
  inflating: fanstatic-1.4.dist-info/top_level.txt  
  inflating: fanstatic-1.4.dist-info/RECORD  

What actually happened:

Archive:  fanstatic-1.4-py3-none-any.whl
  inflating: fanstatic/__init__.py   
  inflating: fanstatic/checksum.py   
  inflating: fanstatic/compiler.py   
  inflating: fanstatic/config.py     
  inflating: fanstatic/core.py       
  inflating: fanstatic/inclusion.py  
  inflating: fanstatic/injector.py   
  inflating: fanstatic/publisher.py  
  inflating: fanstatic/registry.py   
  inflating: fanstatic/wsgi.py       
  inflating: fanstatic/tests/__init__.py  
  inflating: fanstatic/tests/conftest.py  
  inflating: fanstatic/tests/test_bundle.py  
  inflating: fanstatic/tests/test_checksum.py  
  inflating: fanstatic/tests/test_compiler.py  
  inflating: fanstatic/tests/test_config.py  
  inflating: fanstatic/tests/test_core.py  
  inflating: fanstatic/tests/test_injector.py  
  inflating: fanstatic/tests/test_injectorplugin.py  
  inflating: fanstatic/tests/test_publisher.py  
  inflating: fanstatic/tests/test_registry.py  
  inflating: fanstatic/tests/test_slot.py  
  inflating: fanstatic/tests/test_topbottominjector.py  
  inflating: fanstatic/tests/test_wsgi.py  
  inflating: fanstatic-1.4.dist-info/LICENSE.txt  
  inflating: fanstatic-1.4.dist-info/METADATA  
  inflating: fanstatic-1.4.dist-info/WHEEL  
  inflating: fanstatic-1.4.dist-info/entry_points.txt  
  inflating: fanstatic-1.4.dist-info/top_level.txt  
  inflating: fanstatic-1.4.dist-info/RECORD  

The tests usually are not required for non-source downloads and just bloat the distribution size (in this case, they require over 50 % of the distribution size).

What version of Python and Zope/Addons I am using:

Python 3.9.18 with fanstatic==1.4.

icemac commented 2 months ago

@stefan6419846 Thank you for your report. Do you have a suggestion how this request can be achived just for wheels? – We have the strong demand from upstream users (Linux distros) to include the tests in the sdist, so we cannot omit them from there.

stefan6419846 commented 2 months ago

It should work by modifying https://github.com/zopefoundation/fanstatic/blob/f27d7f1f627c5014e4065c83773b1b93328ce7a8/setup.py#L45 to use the exclude parameter accordingly: https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#finding-simple-packages

AFAIK sdists will still ship all source files and ignore this line, but you can of course verify the results when looking at the log or output files after running the build with python -m build . to generate both the sdist and binary wheel.

icemac commented 2 months ago

I'll put it onto my list to experiment with this.