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

get release / version info from setuptools_scm #1674

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

andrewkern
Copy link
Member

this changes the doc/conf.py to pull the version and release info automatically from the setuptools_scm interface as requested in #680

will close #680

@andrewkern andrewkern requested a review from nspope January 29, 2025 21:29
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.85%. Comparing base (bf1fb81) to head (1bddb25).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1674   +/-   ##
=======================================
  Coverage   99.85%   99.85%           
=======================================
  Files         136      136           
  Lines        4690     4690           
  Branches      470      470           
=======================================
  Hits         4683     4683           
  Misses          3        3           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@nspope nspope left a comment

Choose a reason for hiding this comment

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

Looks good but a couple points to clarify on the actual display

@@ -93,7 +98,10 @@
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Show the version number in the navigation bar
Copy link
Collaborator

Choose a reason for hiding this comment

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

Version doesn't seem to be printed anywhere in local doc build. Seems like how versioning is handled may have changed: https://stackoverflow.com/a/79192065

and in particular, that it may now be only via a version selector that is only available if docs are hosted by RTD. Guess we could merge and see if this is the case (?)

I think we want the version information printed somewhere. One option would be to manually print the version somewhere, by putting :Version: |version| into the rst

# get the release version from the setuptools_scm
try:
release = get_version(root="..", relative_to=__file__)
version = ".".join(release.split(".")[:2])
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the [:2] intended to chop out here? (Note that I can't get the version number to display anywhere in a local docs build). But, if I run this via the REPL, I get that release == '0.2.1a2.dev65+g2d5ba65' and version == 0.2.

I don't think we want to chop off this much, if anything? That is, stable builds should have a nice looking version number (so no need to chop anything off). Unstable builds will have the commit hash, which looks ugly but is providing necessary information IMO (so also don't want to chop that off).

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah that's what i was intending-- that version would be version == 0.2 and release would be that blob. I've pushed a commit that manually adds a footer with all this info displayed. also I think once we merge the version selector business will appear on RTD

@andrewkern
Copy link
Member Author

okay i've added a custom footer now which adds this to the bottom of the RTD pages:

image

@nspope note that the version / release is now correct. when I showed you this earlier my feature branch did not have the tags properly fetched on to it, which is what setuptools_scm looks at.

I'm guessing that when we merge this the version selector option of the sphinx_rtd_theme will also just work, so I think this is ready to merge

@nspope nspope merged commit d877cf3 into popsim-consortium:main Jan 31, 2025
11 checks passed
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.

docs/conf.py has a hardcoded (and wrong) version string
2 participants