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

wheel from sdist leads to nuisance error messages in backend #742

Open
jaraco opened this issue Apr 2, 2024 · 4 comments
Open

wheel from sdist leads to nuisance error messages in backend #742

jaraco opened this issue Apr 2, 2024 · 4 comments

Comments

@jaraco
Copy link
Member

jaraco commented Apr 2, 2024

In pypa/setuptools_scm#997, I observed that setuptools_scm was complaining about not being able to discover files when building from a git repo. As it turns out, the issue occurred when the pep517 build infrastructure was building a wheel from the sdist (so git metadata wouldn't be expected).

Because of the way setuptools is engineered, it will necessarily involve setuptools_scm at both phases of the build, during the sdist and then again at the wheel. It's okay to see the error message during the wheel build because it no longer needs the SCM metadata because that's been embedded in the sdist during the sdist phase. In short, I don't think there is currently a way for Setuptools or setuptools_scm to know that it's doing a "wheel from sdist" and thus to disable features like "search for files using git metadata". Therefore, I don't think there's a way to get rid of the error message. Perhaps there's something that could be done, but it would require coordination between build and the backends (setuptools) and their plugins (setuptools_scm).

Originally posted by @jaraco in pypa/setuptools_scm#997 (comment)

@jaraco
Copy link
Member Author

jaraco commented Apr 2, 2024

Perhaps there's something that should be added to the build infrastructure to let the backends (and their plugins) know that it's working from an sdist, so it can make assumptions about the source code.

@pfmoore
Copy link
Member

pfmoore commented Apr 2, 2024

This is something that's come up a few times recently. My first question would be, what does it mean to be "working from a sdist"?

  1. Build frontend downloads sdist, unpacks it, and passes the directory to the backend.
  2. User downloads sdist, unpacks it, passes the directory to the build tool, which passes it to the backend.
  3. User downloads sdist, unpacks it, modifies it, then passes the directory to the build tool, which passes it to the backend.

If we only want (1) to count as "building from the sdist", then maybe we could add a new flag to the build_wheel backend flag that says "this is an unpacked sdist".

I don't see any way of detecting (2), and more specifically, I see no way of distinguishing (2) and (3).

Unfortunately, because of (3), we can't reasonably rely on anything in the source directory to mark it as a sdist - checking for PKG-INFO doesn't work, as was recently discussed here.

@bulletmark
Copy link

Note the opening comment here says "setuptools_scm was complaining" but let's be clear what the message is:

ERROR setuptools_scm._file_finders.git listing git files failed - pretending there aren't any

It is unnerving as a user to see that ERROR message reported. I spent ages trying to track down what I was doing wrong until I discovered this bug which now refers to here.

@RonnyPfannschmidt
Copy link

i consider this particular issue a setuptools problem - other build tools cache file details in the sdist (like hatch)

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