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

Migrate Continuous Documentation from Vercel to Readthedocs #1859

Merged
merged 16 commits into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from 12 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: 26 additions & 0 deletions .github/workflows/docs_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pygmt
Copy link
Member

Choose a reason for hiding this comment

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

Is .github/workflows a good place to save these environment files?

I believe we will also use it in ci_docs.yml.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Sounds a good place to put all CI related files.

Ping @weiji14 for comments on this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally we would put all these 'docs' dependencies as an 'extras' in pyproject.toml/setup.py following https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies so that we could just pip install .[docs]. However, GMT would still need to come from conda-forge, unless #1853 becomes a thing 🙂

Copy link
Member Author

@weiji14 weiji14 Jun 23, 2022

Choose a reason for hiding this comment

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

Actually, is the GMT C library needed to build the docs? Could we just mock it out? I recall @meghanrjones was able to use https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_mock_imports at xarray-contrib/xbatcher#62 (comment), though not sure if it works in this case. If it does work though, then my comment at https://github.com/GenericMappingTools/pygmt/pull/1859/files#r904531125 about using 'extras' would be the way to go.

Copy link
Member

@seisman seisman Jun 23, 2022

Choose a reason for hiding this comment

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

Actually, is the GMT C library needed to build the docs? Could we just mock it out?

I don't think it's possible. We need to call the GMT C library to generate images (i.e.., all the images generated by sphinx-gallery).

channels:
- conda-forge
- defaults
dependencies:
# Required dependencies
- pip
- gmt=6.3.0
- numpy>=1.19
- pandas
- xarray
- netCDF4
- packaging
# Optional dependencies
- geopandas
# Development dependencies (general)
- build
- ipython
- make
# Dev dependencies (building documentation)
- myst-parser
- sphinx
- sphinx-copybutton
- sphinx-design
- sphinx-gallery
- sphinx_rtd_theme
30 changes: 30 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "mambaforge-4.10"
jobs:
pre_build: # Generate api stub files before building
- make -C doc api

# Build documentation in the doc/ directory with Sphinx
sphinx:
configuration: doc/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
conda:
environment: .github/workflows/docs_environment.yml
python:
install:
- method: pip
path: .
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ prune doc*
prune examples*
exclude .dvcignore
exclude .gitignore
exclude .readthedocs.yaml
exclude AUTHORSHIP.md
exclude CONTRIBUTING.md
exclude Makefile
exclude environment.yml
exclude package.json
exclude requirements.txt
exclude vercel.json
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
.. |year| replace:: {year}
"""

html_baseurl = "https://pygmt.org/latest/"
html_last_updated_fmt = "%b %d, %Y"
html_title = "PyGMT"
html_short_title = "PyGMT"
Expand Down
4 changes: 2 additions & 2 deletions doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ download and install anything:
click on the "Propose changes" button to open a pull request.
7. The pull request will run the GMT automated tests and make a preview deployment.
You can see how your change looks in the PyGMT documentation by clicking the
"View deployment" button after the Vercel bot has finished (usually 5-10 minutes
after the pull request was created).
"Details" button of the "docs/readthedocs.org:pygmt-dev" status check,
after the building has finished (usually 10-15 minutes after the pull request was created).
8. We'll review your pull request, recommend changes if necessary, and then merge
them in if everything is OK.
9. Done!
Expand Down
9 changes: 3 additions & 6 deletions doc/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,10 @@ There are 11 configuration files located in `.github/workflows`:

## Continuous Documentation

We use the [Vercel for GitHub](https://github.com/apps/vercel) App to preview changes
We use the [ReadtheDocs](https://readthedocs.org/) service to preview changes
made to our documentation website every time we make a commit in a pull request.
The service has a configuration file `vercel.json`, with a list of options to
change the default behaviour at https://vercel.com/docs/configuration.
The actual script `package.json` is used by Vercel to install the necessary packages,
build the documentation, copy the files to a 'public' folder and deploy that to the web,
see https://vercel.com/docs/build-step.
The service has a configuration file `.readthedocs.yaml`, with a list of options
to change the default behaviour at https://docs.readthedocs.io/en/stable/config-file/index.html.


## Dependencies Policy
Expand Down
8 changes: 0 additions & 8 deletions package.json

This file was deleted.

6 changes: 0 additions & 6 deletions vercel.json

This file was deleted.