-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Stable build does not make git tag available during build #10715
Comments
I'm not sure if this solves exactly what you are reporting, but have you read https://docs.readthedocs.io/en/latest/build-customization.html#avoid-having-a-dirty-git-index? |
@humitos Good guess and that may be needed in the future as I notice that the version number in our actual stable build is different from produced locally. On the RTD build:
And after re-reading the setuptools-scm README we can see the different variations of the version number: https://github.com/pypa/setuptools_scm/#default-versioning-scheme The above version would be the "distance and not clean". So git/setuptools-scm seems to be finding a "0.1" tag somewhere and detecting that our current commit is 1407 ahead of that and then it has the date of that commit. But it doesn't have any regular git tag information otherwise. I'll triple check on the 0.1 git tag and see where that is coming from. Any other guesses? Has anything changed in the last ~6 months with how RTD gets code with git? |
Actually, yes.
Take a look at the Git commands, they a little different. Do you think this may be related to your case? From those two different builds, I noticed that the build from 2 months ago uses the exact same commit than the build from an hour ago 🤷🏼 |
That looks like it. Using that Side note: I've created a pull request that follows the docs you linked to and it doesn't seem to solve the dirty git state. |
FYI I'm debugging why I was still getting a dirty git environment even after doing what the RTD docs suggest and it looks like I needed to add an explicit install of my package as a
which has the following output:
This shows it uninstalled a version of the package from a dirty environment (note the |
@stsewd I think you had a similar issue some time ago and open a PR to fix this and ran a small migration code (I think it was this one: #10606). Do you think this could be related? Maybe we missed some of the affected projects? |
@humitos the commit looks correct https://github.com/pytroll/satpy/commits/v0.43.0 |
Yes, the
Whereas the
|
I'm confused now. It seems that |
We are now facing the same issue for this doc. As already noticed above, the git commands have changed and now the tags are absent which causes tools like setuptools-scm to no longer be able to determine the version. It seems that the following git command
could be replaced by
and the tags are back. |
This is something that users can achieve with |
@humitos This does not only affect projects using setuptools-scm. It affects any project using git tags for versioning. Another example would be projects using versioneer or hatch-vcs. Anything that looks at the git tags won't find them. And just because a tag and the "stable" version point to the same commit doesn't mean that RTD runs the same commands to get the git repository. It treats them as different things which I don't disagree with, but yeah git tags/history should almost always be checked out/fetched when getting a git repository. |
Here's a project of mine using https://pyresample.readthedocs.io/en/stable/ So part of that is just the RTD change to modify the git repository (making it "dirty") which I'm still not sure I understand. Would RTD be open to a pull request to make RTD work without modifying the git repository? |
I think this is what we want to avoid on the general use case because it penalizes all the projects by downloading more data than the one they need to build. I'd say that projects requiring tags/history to be available for usage should use version: 2
build:
jobs:
post_checkout:
- git fetch --tags
This can be solved by https://docs.readthedocs.io/en/latest/build-customization.html#avoid-having-a-dirty-git-index
Yes, we are getting there and hopefully this will happen sooner than what we thought due to https://blog.readthedocs.com/addons-flyout-menu-beta/. We are working on a way to opt-in into this while keeping the same configuration and without requiring using |
This is also kind of problem with stable storing just the commit instead of the tag name, this is because we store "stable" as the name instead of the tag (similar situation happens with latest...). |
In #10738 we fixed this situation in latest by tracking the name of the tag as the identifier, I think we can do the same for stable. But we should check if there are other parts of our code that depend on it being a commit (would be surprised if this was the case TBH). |
I think I just hit a similar problem over at astropy: astropy/astropy#15954 |
Details
Expected Result
The "stable" build of my project is accurately grabbing the commit SHA associated with the most recent tag. I expect that during the build process there is enough git context for git commands to determine the name of the tag that is currently checked out. This is used heavily by dynamic version software (ex.
setuptools-scm
,versioneer
, etc).Actual Result
During the
git checkout
process of getting the repository it does not actually have any of the tag information. So when my python package calls intosetuptools-scm
to determine the version number it uses a fallback (nonsense) version number.CC @gerritholl who identified the issue in our documentation.
If I run the same git commands as in the linked build above locally and then run setuptools-scm manually I get:
If I instead checkout all commits (just as a test), then checkout the specific SHA, then run it I get:
Am I maybe breaking something with my
.readthedocs.yaml
?The text was updated successfully, but these errors were encountered: