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

Build includes an old file that had been removed from the souce code #291

Closed
aendie opened this issue May 7, 2021 · 5 comments
Closed

Comments

@aendie
Copy link

aendie commented May 7, 2021

My environment:
Operating System: Windows 10 Pro, Version 20H2, OS Build 19042.964
Python version: 3.9.4
Build installed via: python -m pip install --upgrade build
Build version: 0.3.1.post1
Published PyPI containing the build error: https://pypi.org/project/pyalmanac/1.2/

Problem description:
I recently noticed an incorrect build - the build included a file that I had deleted from the sources.

In my app/pyalmanac/lib folder I had 8 files, however one was a older copy that was not needed:

  • alma_ephem.py
  • alma_ephem - Copy.py

The last file should not be part of the built distribution. So I deleted it (also deleting the two files in app/dist) and re-ran "python -m build". I did not notice until later that "alma_ephem - Copy.py" was still part of the distribution. In fact I found it cached in app/build/lib/pyalmanac/lib folder. ONLY AFTER DELETING THE app/build FOLDER entirely did the build run correctly.

I hope you have enough information to detect the issue, if not, I'll gladly be of further assistance. My suspicion is that only the first 10 characters (alma_ephem) are compared, which also matches "alma_ephem - Copy" so it thinks it should remain in the distribution set. Just guessing! Thanks for your assistance.

@layday
Copy link
Member

layday commented May 7, 2021

Thanks for reporting. This is not an issue with build, which is just a frontend for other build tools - in this case, setuptools. The setuptools wheel builder merges the contents of the package folder it keeps in the "build" folder with every consecutive run (see pypa/wheel#147). To ensure that this does not happen in the future, delete your "build" folder before rebuilding.

@FFY00
Copy link
Member

FFY00 commented May 7, 2021

Exactly, pypa/build only invokes the backend, which is the one responsible for building the the actual distribution archives.

@aendie
Copy link
Author

aendie commented May 7, 2021

Thanks for the fast response. Okay, so if deleting the 'build' folder before running "python -m build" is required, why doesn't the "build" package do it for you? Is there a reason why we should do this manually?

@henryiii
Copy link
Contributor

henryiii commented May 7, 2021

Setuptools decides this, how is build supposed to know it's safe to delete some folder? And this is setuptools specific, other build tools do different things, and build cannot/should not be in the business of manually "improving" them.

In general, you should be running build on a fresh checkout, probably in CI. Or always do a full git clean before running. Setuptools is really bad about picking up files that are not supposed to be there. Also I recommend running check-manifest.

@layday
Copy link
Member

layday commented May 7, 2021

build doesn't even know the "build" folder exists.

@aendie aendie closed this as completed May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants