You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Updating MANIFEST.in does not correctly update the package sdist creates #436
The behaviour of sdist depends on previous contents of MANIFEST.in, not just the current. This is not fixed even by running setup.py clean or setup.py clean --all (although this should not be necessary).
This is very surprising behaviour, and potentially dangerous too - if someone accidentally adds a MANIFEST.in rule that includes a file that must not be distributed and notice the problem, they would expect that removing the rule will remove the file, but it does not.
I've attached a bash script that demonstrates the problem.
Reacted by Alexandre Morignot, Angelo Peronio, Osama Dar, Oliver Mannion, Philip Woelfel, Sebastian Meyer, Abhinav Khanna, Maximilian Knespel, Patrick Roddy, Kevin Murphy and 1 more
The problema appears to be in the logic with which the SOURCES.txt file is updated by python setup.py egg_info:
$ python setup.py egg_info
running egg_info
writing sample.egg-info/PKG-INFO
writing dependency_links to sample.egg-info/dependency_links.txt
writing entry points to sample.egg-info/entry_points.txt
writing requirements to sample.egg-info/requires.txt
writing top-level names to sample.egg-info/top_level.txt
reading manifest file 'sample.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sample.egg-info/SOURCES.txt'
Files already in SOURCES.txt are preserved across subsequent runs of python setup.py egg_info. Could please one of the developers clarify if this is intended behaviour and why?
is now clear: in the develop tree (under SCM control) the files to be installed are determined from the SCM system (walk_revctrl()); in an sdist install the files are to be determined from the existing manifest file, which was previously generated in the develop tree + setuptools_scm
This logic is broken for packages that do not use setuptools_scm, for which there is no guarantee that the current manifest file (in the development tree) is correct.
Unfortunately my PR #1014 badly brokes this intended behaviour, so that pip install of sdist packages under SCM control and include_package_data=True is not more possible, see #1016 .
Hi I am running into the same issue, but I haven't quite figured out
how to get only the code in the package "src" folder be added to the final package.
@miccoli@rsyring could you help me with a bit more explanations? I don't have a MANIFEST.in file and I am not quite sure what steps I should follow to have python setup.py sdist create the package only with the desired files.
The only thing that you should be aware, regarding this specific bug, is that after each change to MANIFEST.in you should delete the <package>.egg-info directory to be sure that the SOURCES.txt is regenerated appropriately.
Thanks a lot @miccoli, I managed to get the "data" in my package by adding a Manifest.in.
I don't quite understand what happens to "data" that resides outside of the "package" folder (I know it's not the preferred way, and in the end I moved the folder within the package), because if I add it to the Manifest.in, in the resulting archive I see those folders, but then they don't get copied to the site-packages folder (or any other folder I looked).
I think the documentation could be a bit more clear on what's going on under the hood, but in the end I found a way that works for me :)
Many thanks for your answer, I really appreciated it!
The only thing that you should be aware, regarding this specific bug, is that after each change to MANIFEST.in you should delete the .egg-info directory to be sure that the SOURCES.txt is regenerated appropriately.
So annoying this bug... I tried to delete the .egg-info directory as @miccoli suggested but I can not update the files included in my python package by updating the MANIFEST.in. Even if I delete the whole MANIFEST.in file, when I rerun "$ python setup.py sdist" the SOURCE.txt include all the old files I included in the MANIFEST.in.
@MangelFdz do you have a reproduction? This does not seem to be quite the same problem described previously in this issue (for that problem things should work when you remove the .egg-info/build directories).
I can confirm that deleting the .egg_info directory helps. I thought I was going insane. It kept adding files even though I removed those from the manifest...
I don't know why I thought that build would always build from a copy of the sources and not the actual directory.
I think what I'd like to see is for setuptools not to write an .egg-info at all when doing a build. I know it's unnecessary in general (not required by the specs or created by other backends). I wonder if there are any setuptools-specific behaviors that depend on that egg-info directory (in the working directory or the sdist).
I can confirm this bug still exists in setuptools 80.9.0.
As you can see in the output below: When running the egg_info command a second time, the file egg_info/SOURCES.txt is read as a manifest file. Thus all files which have been included in the last run, will be included again – even if MANIFEST.in no lpnger lists them.
Attached please find a shell-script demonstrating the issue test-st-bug-436.txt and below please find a (shortened, pseudo) output from this script. The script is based on the "details" from the last comment, but using plain setuptools.
Activity
miccoli commentedon Feb 27, 2017
I have been hit by this same bug. My current remedy is to delete the
*.egg-infodirectory before runningsetup.py sdist.miccoli commentedon Feb 27, 2017
The problema appears to be in the logic with which the
SOURCES.txtfile is updated bypython setup.py egg_info:Files already in
SOURCES.txtare preserved across subsequent runs ofpython setup.py egg_info. Could please one of the developers clarify if this is intended behaviour and why?miccoli commentedon Feb 28, 2017
See also
setuptools/setuptools/command/egg_info.py
Lines 560 to 570 in d4c215a
where the actual reading of SOURCES.txt takes place:
I cannot understand the reason for this logic.
miccoli commentedon Apr 12, 2017
@jaraco I think I nailed down this old (annoying bug), but nobody cares of these old bugs. Should I reopen or provide a pull request?
jaraco commentedon Apr 12, 2017
@miccoli: If this ticket describes the issue, it's still open. A PR would be most appreciated.
miccoli commentedon Apr 13, 2017
@jaraco yes: this ticket is accurate. Since there is no discussion active, I assume that I should provide my own PR.
Merge pull request #1014 from miccoli/issue-436
PiDelport commentedon Apr 18, 2017
I think this change may have broken sdist installs with package data: #1016
miccoli commentedon Apr 18, 2017
The reason for
is now clear: in the develop tree (under SCM control) the files to be installed are determined from the SCM system (
walk_revctrl()); in an sdist install the files are to be determined from the existing manifest file, which was previously generated in the develop tree +setuptools_scmThis logic is broken for packages that do not use
setuptools_scm, for which there is no guarantee that the current manifest file (in the development tree) is correct.Unfortunately my PR #1014 badly brokes this intended behaviour, so that
pip installof sdist packages under SCM control andinclude_package_data=Trueis not more possible, see #1016 .Revert "addresses pypa#436: Updating MANIFEST.in does not correctly u…
Revert "addresses #436". Fixes #1016.
3 remaining items
setup.py: fix sdist if files are removed
setup.py: fix sdist if files are removed
setup.py: fix sdist if files are removed
lucacerone commentedon Apr 21, 2020
Hi I am running into the same issue, but I haven't quite figured out
how to get only the code in the package "src" folder be added to the final package.
@miccoli @rsyring could you help me with a bit more explanations? I don't have a MANIFEST.in file and I am not quite sure what steps I should follow to have
python setup.py sdistcreate the package only with the desired files.Thanks a lot for the help!
miccoli commentedon Apr 24, 2020
@lucacerone This issue is specific to a setup with
MANIFEST.in: please first check the docs at https://packaging.python.org/guides/using-manifest-in/ and see if following those instruction you are able to obtain the desired source distribution.The only thing that you should be aware, regarding this specific bug, is that after each change to
MANIFEST.inyou should delete the<package>.egg-infodirectory to be sure that theSOURCES.txtis regenerated appropriately.lucacerone commentedon Apr 24, 2020
Thanks a lot @miccoli, I managed to get the "data" in my package by adding a
Manifest.in.I don't quite understand what happens to "data" that resides outside of the "package" folder (I know it's not the preferred way, and in the end I moved the folder within the package), because if I add it to the Manifest.in, in the resulting archive I see those folders, but then they don't get copied to the
site-packagesfolder (or any other folder I looked).I think the documentation could be a bit more clear on what's going on under the hood, but in the end I found a way that works for me :)
Many thanks for your answer, I really appreciated it!
tekumara commentedon Aug 30, 2020
@miccoli I've also encountered this without a MANIFEST.in, see the repro case in #2347
alena-bartosh commentedon Aug 10, 2021
For me this
from @miccoli works fine 😉.
MangelFdz commentedon Jan 18, 2022
So annoying this bug... I tried to delete the .egg-info directory as @miccoli suggested but I can not update the files included in my python package by updating the MANIFEST.in. Even if I delete the whole MANIFEST.in file, when I rerun "$ python setup.py sdist" the SOURCE.txt include all the old files I included in the MANIFEST.in.
Is not there any fix for this bug yet?
abravalheri commentedon Jan 18, 2022
@MangelFdz do you have a reproduction? This does not seem to be quite the same problem described previously in this issue (for that problem things should work when you remove the
.egg-info/builddirectories).microprediction commentedon Feb 2, 2022
I have this issue. I have fallen back to just adding back in empty directories corresponding to those that were once in the MANIFEST.in
Not a great solution, but moving on I guess.
mxmlnkn commentedon Jul 11, 2022
I can confirm that deleting the
.egg_infodirectory helps. I thought I was going insane. It kept adding files even though I removed those from the manifest...Skylark0924 commentedon Jul 3, 2024
Thx! That really solved the problem.
jaraco commentedon Jul 11, 2024
I can confirm the issue still exists, even when building using the PEP 517 builder:
Details
I don't know why I thought that
buildwould always build from a copy of the sources and not the actual directory.I think what I'd like to see is for setuptools not to write an .egg-info at all when doing a build. I know it's unnecessary in general (not required by the specs or created by other backends). I wonder if there are any setuptools-specific behaviors that depend on that egg-info directory (in the working directory or the sdist).
htgoebel commentedon Jul 30, 2025
I can confirm this bug still exists in setuptools 80.9.0.
As you can see in the output below: When running the
egg_infocommand a second time, the fileegg_info/SOURCES.txtis read as a manifest file. Thus all files which have been included in the last run, will be included again – even if MANIFEST.in no lpnger lists them.Attached please find a shell-script demonstrating the issue test-st-bug-436.txt and below please find a (shortened, pseudo) output from this script. The script is based on the "details" from the last comment, but using plain setuptools.