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

Determine the minimum required versions of dependencies from package metadata for docs #3380

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Aug 7, 2024

Description of proposed changes

It's possible to determine the minimum required versions from the package metadata using codes like below. So that we don't have to update the doc/minversions.md file everytime we bump the minimum required versions (e.g., #3372).

>>> import importlib
>>> from packaging.requirements import Requirement
>>> requirements = {
...:     Requirement(requirement).name: str(Requirement(requirement).specifier)
...:     for requirement in importlib.metadata.requires("pygmt")
...: }
...: requirements.update(
...:     {
...:         "python": importlib.metadata.metadata("pygmt")["Requires-Python"],
...:         #"gmt": f">={required_gmt_version}",
...:     }
...: )

>> requirements
{'numpy': '>=1.24',
 'pandas': '>=1.5',
 'xarray': '>=2022.09',
 'netCDF4': '',
 'packaging': '',
 'contextily': '',
 'geopandas': '',
 'IPython': '',
 'rioxarray': '',
 'python': '>=3.10'}

This PR uses the same codes to determine the minimum required versions and store in the requirements dictionary, which can be used in the documentation using syntax like {{ requires.python }}.

Preview:

@seisman seisman added the maintenance Boring but important stuff for the core devs label Aug 7, 2024
@seisman seisman changed the title doc: Determine the minimum required versions of dependencies from package metadata Determine the minimum required versions of dependencies from package metadata for docs Aug 7, 2024
@seisman seisman added this to the 0.13.0 milestone Aug 7, 2024
@seisman seisman added the needs review This PR has higher priority and needs review. label Aug 7, 2024
@seisman seisman requested a review from weiji14 August 7, 2024 07:14
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

So much more automation, nice!

@seisman seisman merged commit 6a47383 into main Aug 7, 2024
10 of 11 checks passed
@seisman seisman deleted the doc/requires branch August 7, 2024 08:19
@seisman seisman removed the needs review This PR has higher priority and needs review. label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants