-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Provide more guidance on how to use .git_archival.txt
#987
Comments
$ git describe --tags --match=... If the above command does not create appropriate output of the tags, check what tags you have and their naming schema. I often forget to add an initial
|
Yes, I understand that part. There is no issue with git or tags or anything, and no issue with how To put it more concisely, if you are using this package and follow the directions in the usage docs, running The solution to this is either:
I realize there are other build frontends that might not run afoul of these issues and that this package shouldn’t be too concerned with whatever frontend you are using, but given that |
Hmm that is odd, looking at the order above, you should not be getting any messages related to git-archive. Maybe it is an older version of
Should not be necessary since The
Following the steps, |
It might help if I explain what’s happening here step-by-step: When
There’s not really an issue with the fallback order or anything else. You get working sdists and wheels at the end, and things function. These are just annoying/confusing warnings for most people. Hopefully that makes it clear how excluding the Does that make sense? It’s been several months since I filed this issue, but I’m pretty sure that’s what was happening when I investigated. |
(Also possible some changes with ordering make this all work fine now; I just know this is how it worked with whatever was the latest release back in December.) |
Ok, I've had a bit more navigation and realized the snippet I've shared was only used by the setuptools-scm itself and not the projects. And I guess you are not setting I am failing to navigate further at this time of day. I haven't run But I agree such messages should not appear, and it's weird that the order is defined in |
Actually, I am setting that. I dug around and found the old minimal test-case repo I made for this last year and just added it to GitHub: https://github.com/Mr0grog/setuptools_scm_issue_987_demo Trying it out again, I just noticed that even with |
Ah, after messing around a bit with the source locally, it looks like:
So really there aren’t any warnings building the sdist because That explains the warnings, although I’m not sure about the history/correctness/edge cases around the current way things are ordered for the This doesn’t explain the It looks to me like that’s because I definitely don’t have enough context to say why it might be that way or if it’s a mistake. But at first glance it looks like just an oversight or typo. |
Anyway, it’s probably good to fix the above so errors and warnings aren’t logged, but it also seems odd to me for sdists to have the template version of |
Nice, thanks for checking. I kinda understand the preference for Also |
Oh, good point!
You clearly have a much better sense of the right approaches, impacts of the ordering, and edge cases this project has had to deal with, so I’m happy to leave that to you.
I’m not sure I follow this part. If I understand correctly, the file finder stuff is a totally separate entrypoint into setuptools_scm from the version stuff, so it doesn’t have any context about the other fallback things are happening. I don’t understand what would be used to set a new |
I have started the work on it with #1034, not sure how much I will have time to work on it this week |
I was working on switching a package from Versioneer to setuptools_scm, and wound up scratching my head over warnings about “unprocessed git archival found” when running
python -m build .
. It took me a while to understand what was going on, and I think some more guidance in the docs about how one should build a package when.git_archival.txt
is present would have been helpful.Specifically, if you add a
.git_archival.txt
file to a repository as suggested indocs/usage.md
and then runpython -m build .
, you’ll see output like:I’ve cut some of the extra log lines to make the two warnings and errors clearer.
I’m pretty certain what’s happening here is that
build
creates an sdist, which works fine, but then unpacks that sdist in a temp directory to build the wheel from it, which is not fine. The unpacked sdist is not in a git repo, so setuptools-scm can’t find version info that way, and the sdist, which was build from my repo’s working directory, has a.git_archival.txt
file that is just a template/unprocessed, so setuptools-scm is warning about that and then failing to get any useful versioning info.That took me a little while to understand, and suggested to me that the right way to build a package when you have a
.git_archival.txt
file present is to do one of two things:Ensure the file is not included in the build via
MANIFEST.in
or some config setting for whatever build backend the project is using, orAlways build from an actual archive. That is, a build process should do something like:
Do I have that right? If so, I think it would be helpful to add to the docs. I’m happy to make those changes in a PR if my understanding is correct.
(Obviously these specific results are caused by how
build
does its work, and other font-ends might or might not cause this warning. But I think the problem and solutions above are fairly generic and helpful to clarify. A lot of front-ends or build techniques would still wind up with the unprocessed.git_archival.txt
file in an sdist if you don’t take one of the two above steps, and that doesn’t seem good.)As a side note, I also found the dual warnings confusing:
And it wasn’t until I started searching the source here that I realized the first warning is not really correct and is kind of redundant. It would be clearer if only the second warning (“unprocessed git archival found”) was logged and the first (“git archive did not support describe output”) was suppressed in this case.
The text was updated successfully, but these errors were encountered: