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

automate docs discovery of iris and python versions #3981

Merged
merged 5 commits into from
Feb 8, 2021

Conversation

bjlittle
Copy link
Member

@bjlittle bjlittle commented Feb 4, 2021

🚀 Pull Request

Description

This PR automates the discovery of the iris version for the whatsnew, and also the python version used to build the documentation via the sphinx rst_epilog.

These are available in all rst files via |iris_version| and |python_version| directives.

The rendered version of the whatsnew generated by this PR is available here.

The rendered version of the release documentation changes from this PR are available here.

P.S. the |build_date| directive is now also available to automate the whatsnew release/build date.


Consult Iris pull request check list

@trexfeathers
Copy link
Contributor

Did you intend some use of |python_version| or is this just flexibility for the future?

Copy link
Member

@jamesp jamesp left a comment

Choose a reason for hiding this comment

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

Looks ok to me, question inline

docs/src/conf.py Outdated
# Create a variable that can be insterted in the rst "|copyright_years|".
# You can add more vairables here if needed
# Create a variable that can be inserted in the rst "|copyright_years|".
# You can add more variables here if needed.
rst_epilog = """
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for using format strings in the .format method, rather than having a single format string

f"""
|copyright_years| replace:: 2010 - {upper_copy_year}
[...etc]
"""

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, could do, thanks.

I was lazily following what was there before... I'll tidy it up 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Nice, that's way tidier, thanks.

@bjlittle
Copy link
Member Author

bjlittle commented Feb 5, 2021

@trexfeathers The |python_version| is a hook for @tkknight later on...

As part of #3976, I was forced to make the decision to only build the documentation for the latest supported version of python for iris i.e., 3.8, simply due to changes in some doc-tests output which differs based on the python version.

This poses a problem, as we don't want to be in the situation of having different doc-tests based on the underlying python version. To keep this simple we should only build and publish the latest supported version of python for Iris. In doing so, we should make it clear to users what version of python the documentation is built against, hence the need for |python_version|.

@tkknight will push a follow-on PR to propose how we highlight this information.

docs/src/conf.py Outdated
build_date=f"({datetime.datetime.now().strftime('%d %b %Y')})",
)
rst_epilog = f"""
.. |copyright_years| replace:: {2010 - upper_copy_year}
Copy link
Member

Choose a reason for hiding this comment

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

I think this should probably be: 2010 - {upper_copy_year}?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oopsie... good spot 👀

@tkknight
Copy link
Contributor

tkknight commented Feb 7, 2021

can we get this merged now @jamesp & @bjlittle ?

Copy link
Member

@jamesp jamesp 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 to me 👍

@jamesp jamesp merged commit 1c62f07 into SciTools:master Feb 8, 2021
tkknight added a commit to tkknight/iris that referenced this pull request Feb 9, 2021
* master: (23 commits)
  Added text to state the Python version used to build the docs. (SciTools#3989)
  add nox session conda list (SciTools#3990)
  Add abstract cube summary (SciTools#3987)
  automate docs discovery of iris and python versions (SciTools#3981)
  corrected syntax (SciTools#3980)
  core dev whatsnew entry (SciTools#3978)
  moved docs dir and updated references to it (SciTools#3975)
  Fix test_incompatible_dimensions test (SciTools#3977)
  remove explicit URLs for core dev names from latest.rst (SciTools#3973)
  document that iris.coords.Coord is an ABC (SciTools#3971)
  reorganise docs common links + add core devs (SciTools#3972)
  Docs whatsnew add dropdowns to the template (SciTools#3969)
  Docs whatsnew enumerated lists (SciTools#3970)
  Merge back v3p0p1 (SciTools#3966)
  Captilise installation heading - align SciTools#3958 content with SciTools#3940. (SciTools#3963)
  Merge back v3p0p0 (SciTools#3960)
  Extended the installation description (SciTools#3958)
  Put cube data on the x axis if plotting just a cube against a vertical or y coordinate (SciTools#3906)
  remove stock_mdi_arrays.npz (SciTools#3913)
  Gallery: update seasonal ensemble example (SciTools#3933)
  ...
@bjlittle bjlittle deleted the docs-sniff-python-version branch February 10, 2021 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants