Skip to content

Commit 92d36c6

Browse files
committed
suggest Docker first, require Python 3.10, reorg
1 parent 08b9ec6 commit 92d36c6

1 file changed

Lines changed: 38 additions & 37 deletions

File tree

doc/sphinx-guides/source/contributor/documentation.md

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,76 +50,77 @@ If you would like to read more about the Dataverse's use of GitHub, please see t
5050

5151
## Building the Guides with Sphinx
5252

53-
While the "quick fix" technique shown above should work fine for minor changes, especially for larger changes, we recommend installing Sphinx on your computer or using a Sphinx Docker container to build the guides locally so you can get an accurate preview of your changes.
53+
While the "quick fix" technique shown above should work fine for minor changes, in many cases, you're going to want to preview changes locally before committing them.
5454

55-
In case you decide to use a Sphinx Docker container to build the guides, you can skip the next two installation sections, but you will need to have Docker installed.
55+
Before we worry about pushing changes to the code, let's make sure we can build the guides.
5656

57-
### Installing Sphinx
57+
Go to <https://github.com/IQSS/dataverse> and click "Code" and then follow the instructions to clone the code locally.
5858

59-
First, make a fork of <https://github.com/IQSS/dataverse> and clone your fork locally. Then change to the ``doc/sphinx-guides`` directory.
59+
### Makefile and Docker
6060

61-
``cd doc/sphinx-guides``
61+
From a terminal, switch to the "dataverse" directory you just cloned.
6262

63-
Create a Python virtual environment, activate it, then install dependencies:
64-
65-
``python3 -m venv venv``
63+
`cd dataverse`
6664

67-
``source venv/bin/activate``
65+
Then try building the HTML version of the guides.
6866

69-
``pip install -r requirements.txt``
67+
`make docs-html`
7068

71-
### Installing GraphViz
69+
If all goes well, you should be able open `doc/sphinx-guides/build/html/index.html` to see the guides you just built.
7270

73-
In some parts of the documentation, graphs are rendered as images using the Sphinx GraphViz extension.
71+
Here is the complete list of commands.
7472

75-
Building the guides requires the ``dot`` executable from GraphViz.
73+
- `make docs-html`
74+
- `make docs-pdf`
75+
- `make docs-epub`
76+
- `make docs-all`
7677

77-
This requires having [GraphViz](https://graphviz.org) installed and either having ``dot`` on the path or
78-
[adding options to the `make` call](https://groups.google.com/forum/#!topic/sphinx-users/yXgNey_0M3I).
78+
### Docker
7979

80-
On a Mac we recommend installing GraphViz through [Homebrew](<https://brew.sh>). Once you have Homebrew installed and configured to work with your shell, you can type `brew install graphviz`.
80+
Also from the "dataverse" directory (the root of the git repo), you can try this command:
8181

82-
### Editing and Building the Guides
82+
`docker run -it --rm -v $(pwd):/docs sphinxdoc/sphinx:7.2.6 bash -c "cd doc/sphinx-guides && pip3 install -r requirements.txt && make html"`
8383

84-
To edit the existing documentation:
84+
### Sphinx Installed Locally
8585

86-
- Create a branch (see {ref}`how-to-make-a-pull-request`).
87-
- In ``doc/sphinx-guides/source`` you will find the .rst files that correspond to https://guides.dataverse.org.
88-
- Using your preferred text editor, open and edit the necessary files, or create new ones.
86+
First, run `python --version` or `python3 --version` to determine the version of Python you have. If you don't have Python 3.10 or higher, you must upgrade.
8987

90-
Once you are done, you can preview the changes by building the guides locally. As explained, you can build the guides with Sphinx locally installed, or with a Docker container.
88+
Next, change to the `doc/sphinx-guides` directory.
9189

92-
#### Building the Guides with Sphinx Installed Locally
90+
`cd doc/sphinx-guides`
9391

94-
Open a terminal, change directories to `doc/sphinx-guides`, activate (or reactivate) your Python virtual environment, and build the guides.
92+
Create a Python virtual environment, activate it, then install dependencies:
9593

96-
`cd doc/sphinx-guides`
94+
`python3 -m venv venv`
9795

9896
`source venv/bin/activate`
9997

100-
`make clean`
98+
`pip install -r requirements.txt`
10199

102-
`make html`
100+
Next, install [GraphViz](https://graphviz.org) because building the guides requires having the `dot` executable from GraphViz either on the path or passed [as an argument](https://groups.google.com/g/sphinx-users/c/yXgNey_0M3I/m/3T2NipFlBgAJ).
103101

104-
#### Building the Guides with a Sphinx Docker Container and a Makefile
102+
On a Mac we recommend installing GraphViz through [Homebrew](<https://brew.sh>). Once you have Homebrew installed and configured to work with your shell, you can type `brew install graphviz`.
105103

106-
We have added a Makefile to simplify the process of building the guides using a Docker container, you can use the following commands from the repository root:
104+
Finally, you can try building the guides with the following command.
107105

108-
- `make docs-html`
109-
- `make docs-pdf`
110-
- `make docs-epub`
111-
- `make docs-all`
106+
`make html`
112107

113-
#### Building the Guides with a Sphinx Docker Container and CLI
108+
If all goes well, you should be able open `doc/sphinx-guides/build/html/index.html` to see the guides you just built.
114109

115-
If you want to build the guides using a Docker container, execute the following command in the repository root:
110+
## Editing, Building, and Previewing the Guides
116111

117-
`docker run -it --rm -v $(pwd):/docs sphinxdoc/sphinx:7.2.6 bash -c "cd doc/sphinx-guides && pip3 install -r requirements.txt && make html"`
112+
To edit the existing documentation:
113+
114+
- Create a branch (see {ref}`how-to-make-a-pull-request`).
115+
- In `doc/sphinx-guides/source` you will find the .rst or .md files that correspond to https://guides.dataverse.org.
116+
- Using your preferred text editor, open and edit the necessary files, or create new ones.
118117

119-
#### Previewing the Guides
118+
Once you are done, you can preview the changes by building the guides using one of the options above.
120119

121120
After Sphinx is done processing the files you should notice that the `html` folder in `doc/sphinx-guides/build` directory has been updated. You can click on the files in the `html` folder to preview the changes.
122121

122+
## Making a Pull Request
123+
123124
Now you can make a commit with the changes to your own fork in GitHub and submit a pull request. See {ref}`how-to-make-a-pull-request`.
124125

125126
## Writing Guidelines

0 commit comments

Comments
 (0)