Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@
"""

import datetime
from importlib.metadata import metadata
import importlib

# ruff: isort: off
from sphinx_gallery.sorting import ExplicitOrder, ExampleTitleSortKey
from pygmt.clib import required_gmt_version
from packaging.requirements import Requirement
from pygmt import __commit__, __version__
from pygmt.clib import required_gmt_version
from pygmt.sphinx_gallery import PyGMTScraper
from sphinx_gallery.sorting import ExampleTitleSortKey, ExplicitOrder

# ruff: isort: on

requires_python = metadata("pygmt")["Requires-Python"]
requires_gmt = f">={required_gmt_version}"
# Dictionary for dependency name and minimum required version.
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}",
}
)

extensions = [
"myst_parser",
Expand Down Expand Up @@ -51,8 +58,7 @@
]
# These enable substitutions using {{ key }} in the Markdown files
myst_substitutions = {
"requires_python": requires_python,
"requires_gmt": requires_gmt,
"requires": requirements,
}


Expand Down
4 changes: 2 additions & 2 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ development version.

## Which Python?

PyGMT is tested to run on Python {{ requires_python }}.
PyGMT is tested to run on Python {{ requires.python }}.

We recommend using the [Miniforge](https://github.com/conda-forge/miniforge#miniforge3)
Python distribution to ensure you have all dependencies installed and
Expand All @@ -69,7 +69,7 @@ your computer and doesn't interfere with any other Python installations on your

## Which GMT?

PyGMT requires Generic Mapping Tools (GMT) {{ requires_gmt }} since there are many
PyGMT requires Generic Mapping Tools (GMT) {{ requires.gmt }} since there are many
changes being made to GMT itself in response to the development of PyGMT.

Compiled conda packages of GMT for Linux, macOS and Windows are provided through
Expand Down
2 changes: 1 addition & 1 deletion doc/minversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ after their initial release.

| PyGMT Version | GMT | Python | NumPy | Pandas | Xarray |
|---|---|---|---|---|---|
| [Dev][]* [[Docs][Docs Dev]] | >=6.3.0 | >=3.10 | >=1.24 | >=1.5 | >=2022.09 |
| [Dev][]* [[Docs][Docs Dev]] | {{ requires.gmt }} | {{ requires.python }} | {{ requires.numpy }} | {{ requires.pandas }} | {{ requires.xarray }} |
| [v0.12.0][] [[Docs][Docs v0.12.0]] | >=6.3.0 | >=3.10 | >=1.23 | >=1.5 | >=2022.06 |
| [v0.11.0][] [[Docs][Docs v0.11.0]] | >=6.3.0 | >=3.9 | >=1.23 | | |
| [v0.10.0][] [[Docs][Docs v0.10.0]] | >=6.3.0 | >=3.9 | >=1.22 | | |
Expand Down