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

Remove Warning/Error messages when using build #1034

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LecrisUT
Copy link
Contributor

@LecrisUT LecrisUT commented Apr 17, 2024

Basically when running python3 -m build on a perfectly valid project, we find ourselves surprised by unnecessary warning and error messages, namely:

UserWarning: git archive did not support describe output
UserWarning: unprocessed git archival found (no export subst applied)
ERROR setuptools_scm._file_finders.git listing git files failed - pretending there aren't any

See the linked issue for more context on why these messages occur. This PR is trying to eliminate those messages, but first I am writing a test to reproduce a common environment. Thanks to @Mr0grog for the help debugging this issue

TODO:

  • Add test to check build messages
  • Resolve the git_archival.txt warning issue
  • Resolve the setuptools_scm._file_finders.git error issue

Closes #987

Comment on lines +139 to +146
res_build = subprocess.run(
[sys.executable, "-m", "build", "-nx"],
cwd=wd.cwd,
capture_output=True,
)
assert res_build.returncode == 0
# Maybe there is a cleaner way to use caplog?
assert not res_build.stderr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to run and check this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A hack that might be reasonable would be a fake object directly passed to the integration function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean instead of python3 -m build? I don't think that will end up well because what we want to test here is how build creates the sdist and from the sdist creates the wheel, and in both steps setuptools-scm is called with different "sources".

Another option I was thinking is calling build.__main__.main directly? Then all of the context should be preserved and the caplog should in principle work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as i remember, build has to start sub-processes for a build
so currently have no idea for a clean solution

testing/test_regressions.py Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

Provide more guidance on how to use .git_archival.txt
2 participants