pypa / pypa/setuptools

[Docs] Misleading: MANIFEST.in affects the files in the Wheel

Open
#3,732 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Needs Triage
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

setuptools version

setuptools==65.6.3

Python version

Python 3.11

OS

Ubuntu 22.10

Additional environment information

No response

Description

According to the documentation of setuptools, the MANIFEST.in should only affect the source distribution:

MANIFEST.in

A MANIFEST.in is needed when you need to package additional files that are not automatically included in a source distribution. For details on writing a MANIFEST.in file, including a list of what’s included by default, see “Including files in source distributions with MANIFEST.in”.

However, you may not have to use a MANIFEST.in. For an example, the PyPA sample project has removed its manifest file, since all the necessary files have been included by setuptools 43.0.0 and newer.

Note MANIFEST.in does not affect binary distributions such as wheels.

https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#manifest-in

But I've created a minimal test project to demonstrate, that the contents of the MANIFEST.in affect the contents of the wheel built. The project can be found here https://github.com/hansingt/setuptools_manifest_affects_wheels.

In this Project, there exists a demo file fuu/test´ which is not a python source file and should not be included in the wheel according to the setup.py`.

But, if I have a graft fuu in the MANIFEST.in file in combination with a include_package_data=True in the setup.py, this file gets included in the wheel when building.

Expected behavior

I would have expected, that the fuu/test file would be included in the source distribution, but not in the wheel.

My Question would be whether this is intended behaviour or not? Depending on this, this is either a Bug report to adjust
the documentation or to change the behaviour.

How to Reproduce
  1. git clone https://github.com/hansingt/setuptools_manifest_affects_wheels
  2. cd setuptools_manifest_affects_wheels
  3. python -m venv venv
  4. ./venv/bin/pip install -r requirements.txt
  5. ./venv/bin/pyproject-build .

Now a dist folder has been created which contains a .tar.gz source distribution and a .whl wheel. If you open the wheel, you can see, that there exists a fuu/test file, which is not a python source file and is not included in the package data in the setup.py.

  1. To verify, that it really is the MANIFEST.in file including this file, just delete it and rebuild the wheel
    rm MANIFEST.in && ./venv/bin/pyproject-build .
    

Now you can see, that the fuu/test file is not included in the wheel.

Output
> python -m venv venv                                                                                                                         
> ./venv/bin/pip install -r requirements.txt                                                                                                  
Collecting setuptools>=65.6.3                                                                                                                 
  Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)                                                                                    
Collecting build                                                                                                                              
  Using cached build-0.9.0-py3-none-any.whl (17 kB)                                                                                           
Collecting tomli>=1.0.0                                                                                                                       
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)                                                                                           
Collecting pep517>=0.9.1                                                                                                                      
  Using cached pep517-0.13.0-py3-none-any.whl (18 kB)                                                                                         
Collecting packaging>=19.0                                                                                                                    
  Using cached packaging-22.0-py3-none-any.whl (42 kB)                                                                                        
Installing collected packages: tomli, setuptools, packaging, pep517, build                                                                    
  Attempting uninstall: setuptools                                                                                                            
    Found existing installation: setuptools 59.6.0                                                                                            
    Uninstalling setuptools-59.6.0:                                                                                                           
      Successfully uninstalled setuptools-59.6.0                                                                                              
Successfully installed build-0.9.0 packaging-22.0 pep517-0.13.0 setuptools-65.6.3 tomli-2.0.1
> ./venv/bin/pyproject-build .
* Creating venv isolated environment...                                                                                                       
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)                                                                
* Getting build dependencies for sdist...                                                                                                     
running egg_info                                                                                                                              
writing fuu.egg-info/PKG-INFO                                                                                                                 
writing dependency_links to fuu.egg-info/dependency_links.txt                                                                                 
writing top-level names to fuu.egg-info/top_level.txt                                                                                         
reading manifest file 'fuu.egg-info/SOURCES.txt'                                                                                              
reading manifest template 'MANIFEST.in'                                                                                                       
writing manifest file 'fuu.egg-info/SOURCES.txt'                                                                                              
* Building sdist...                                                                                                                           
running sdist                                                                                                                                 
running egg_info                                                                                                                              
writing fuu.egg-info/PKG-INFO                                                                                                                 
writing dependency_links to fuu.egg-info/dependency_links.txt                                                                                 
writing top-level names to fuu.egg-info/top_level.txt                                                                                         
reading manifest file 'fuu.egg-info/SOURCES.txt'                                                                                              
reading manifest template 'MANIFEST.in'                                                                                                       
writing manifest file 'fuu.egg-info/SOURCES.txt'                                                                                              
running check                                                                                                                                 
creating fuu-0.0.0                                                                                                                            
creating fuu-0.0.0/fuu                                                                                                                        
creating fuu-0.0.0/fuu.egg-info                                                                                                               
copying files to fuu-0.0.0...                                                                                                                 
copying MANIFEST.in -> fuu-0.0.0                                                                                                              
copying README.md -> fuu-0.0.0
copying setup.py -> fuu-0.0.0
copying fuu/__init__.py -> fuu-0.0.0/fuu
copying fuu/test -> fuu-0.0.0/fuu
copying fuu.egg-info/PKG-INFO -> fuu-0.0.0/fuu.egg-info
copying fuu.egg-info/SOURCES.txt -> fuu-0.0.0/fuu.egg-info
copying fuu.egg-info/dependency_links.txt -> fuu-0.0.0/fuu.egg-info
copying fuu.egg-info/top_level.txt -> fuu-0.0.0/fuu.egg-info
Writing fuu-0.0.0/setup.cfg
Creating tar archive
removing 'fuu-0.0.0' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting build dependencies for wheel...
running egg_info
writing fuu.egg-info/PKG-INFO
writing dependency_links to fuu.egg-info/dependency_links.txt
writing top-level names to fuu.egg-info/top_level.txt
reading manifest file 'fuu.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'fuu.egg-info/SOURCES.txt'
* Installing packages in isolated environment... (wheel)
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/fuu
copying fuu/__init__.py -> build/lib/fuu
running egg_info
writing fuu.egg-info/PKG-INFO
writing dependency_links to fuu.egg-info/dependency_links.txt
writing top-level names to fuu.egg-info/top_level.txt
reading manifest file 'fuu.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'fuu.egg-info/SOURCES.txt'
copying fuu/test -> build/lib/fuu
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/fuu
copying build/lib/fuu/__init__.py -> build/bdist.linux-x86_64/wheel/fuu
copying build/lib/fuu/test -> build/bdist.linux-x86_64/wheel/fuu
running install_egg_info
Copying fuu.egg-info to build/bdist.linux-x86_64/wheel/fuu-0.0.0-py3.10.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/fuu-0.0.0.dist-info/WHEEL
creating '/home/tha/temp/setuptools_manifest_in_wheels/dist/.tmp-2e9tojnu/fuu-0.0.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'fuu/__init__.py'
adding 'fuu/test'
adding 'fuu-0.0.0.dist-info/METADATA'
adding 'fuu-0.0.0.dist-info/WHEEL'
adding 'fuu-0.0.0.dist-info/top_level.txt'
adding 'fuu-0.0.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built fuu-0.0.0.tar.gz and fuu-0.0.0-py3-none-any.whl

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal project and reproduce the wheel build using MANIFEST.in, setup.py, and pyproject-build. Compare the observed wheel contents with the MANIFEST.in documentation and determine whether the intended resolution is a documentation correction or a behavior change; the issue is done when the behavior and documentation agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.