You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes#577.
This allows us to greatly simplify the repository. Now we only have a
single theme, whereas before we had 3 themes so had to generalize a
bunch of logic like our visual regression testing.
First read the overall [Qiskit project contributing guidelines](https://github.com/Qiskit/qiskit/blob/main/CONTRIBUTING.md#).
7
4
8
5
## Contributing to qiskit_sphinx_theme
9
6
@@ -16,18 +13,17 @@ contributing to qiskit_sphinx_theme, these are documented below.
16
13
There are a few important subfolders to be aware of:
17
14
18
15
### `/src`
19
-
This subfolder contains the HTML, CSS, and Python files that are used for the Qiskit themes. It has these folders:
16
+
This subfolder contains the HTML, CSS, and Python files that are used for the `qiskit-ecosystem` theme. It has these folders:
20
17
21
-
*`assets`: CSS and JavaScript for the `qiskit` theme.
22
-
*`ecosystem`: the code for the `qiskit-ecosystem` theme, which is built on top of the base `qiskit` theme. This folder only has overrides.
23
-
*`theme`: static files, like HTML templates, for the `qiskit` theme.
18
+
*`assets`: CSS
19
+
*`theme`: HTML templates and the `theme.conf` config file
24
20
25
21
The top-level Python files are used for logic used by the theme, such as `translations.py` determining what URLs the HTML should use for translations support.
26
22
27
23
### `/example_docs`
28
24
This subfolder contains a scaled down version of the Sphinx build that builds the documentation for the Qiskit repos.
29
25
30
-
It pulls styles from the `/src` subfolder. You can check any changes you are making to theme by building the documentation (see running locally section) and opening the HTML files generated in `example_docs/docs/_qiskit_build` and `example_docs/docs/_ecosystem_build`.
26
+
It pulls styles from the `/src` subfolder. You can check any changes you are making to theme by building the documentation (see running locally section) and opening the HTML files generated in `example_docs/docs/_build`.
31
27
32
28
### `/docs_guide`
33
29
This subfolder contains guidance on how to write documentation and build sphinx projects for Qiskit and Qiskit Ecosystem projects. You can view the fully rendered docs guide at https://qisk.it/docs-guide
@@ -38,18 +34,15 @@ This subfolder contains guidance on how to write documentation and build sphinx
38
34
We use [Tox](https://tox.wiki/en/latest/), which you will need to install globally (e.g. using [`pipx`](https://pypa.github.io/pipx/)).
39
35
40
36
* Run Python tests: `tox -e py`
41
-
* Build `example_docs/` with the `qiskit` theme:
42
-
1.`tox -e qiskit`
43
-
2. Open up `example_docs/docs/_qiskit_build/index.html` in your browser
44
-
* Build `example_docs/` with the `qiskit-ecosystem` theme:
45
-
1.`tox -e ecosystem`
46
-
2. Open up `example_docs/docs/_ecosystem_build/index.html` in your browser
37
+
* Build `example_docs/`:
38
+
1.`tox -e docs`
39
+
2. Open up `example_docs/docs/_build/index.html` in your browser
47
40
* Build `docs_guide`:
48
41
1.`tox -e docs-guide`
49
42
2. Open up `docs_guide/_build/html/index.html` in your browser.
50
43
* Run doctests for the docs guide: `tox -e doctest`
51
44
52
-
Sometimes Sphinx's caching can get in a bad state. First, try running `tox -e clean`, which will remove Sphinx's cache. If you are still having issues, try adding `-r` your command, e.g. `tox -e qiskit -r`. `-r` tells Tox to reinstall the dependencies.
45
+
Sometimes Sphinx's caching can get in a bad state. First, try running `tox -e clean`, which will remove Sphinx's cache. If you are still having issues, try adding `-r` your command, e.g. `tox -e docs -r`. `-r` tells Tox to reinstall the dependencies.
53
46
54
47
------
55
48
## Visual regression testing
@@ -85,21 +78,21 @@ First, you need to install:
85
78
Then, to run the tests locally:
86
79
87
80
1.`npm install`
88
-
2.`npm run test-qiskit` or `npm run test-ecosystem`, depending on which theme you want.
81
+
2.`npm run test`.
89
82
* Warning: the very first time you run the tests, they will fail because the `snapshot-results` folder will not yet exist. Try running again.
90
83
91
-
The docs will rebuild every time you run `npm run test-qiskit` and `npm run test-ecosystem`.
84
+
The docs will rebuild every time you run `npm run test`.
92
85
93
86
### How to update the expected snapshot for intentional changes
94
87
95
88
First, get the `snapshot_results` folder, either by downloading it from CI or by running the tests locally. Then:
96
89
97
90
1. Find the "actual" snapshot for the failing test, such as `api-docs-class-page-1-actual.png`.
98
-
2. Copy that snapshot into the folder `tests/js/qiskit.test.js-snapshots` or `tests/js/ecosystem.test.js-snapshots`, depending on which theme failed. Rename the `-actual.png` file ending to be `-linux.png` and overwrite the prior file.
91
+
2. Copy that snapshot into the folder `tests/js/tests.js-snapshots`. Rename the `-actual.png` file ending to be `-linux.png` and overwrite the prior file.
99
92
100
93
### How to add a new snapshot
101
94
102
-
Copy the tests in `qiskit.test.js` or `ecosystem.test.js` for inspiration. Make sure the selector you use in `page.locator()` is accurate. Title the tests with a useful but concise description of what you're testing.
95
+
Copy the tests in `tests.js` for inspiration. Make sure the selector you use in `page.locator()` is accurate. Title the tests with a useful but concise description of what you're testing.
103
96
104
97
Then, run the tests either locally or in CI to generate the snapshots. When running locally, the files will be added automatically. When using CI, follow the section [How to update the expected snapshot for intentional changes](#how-to-update-the-expected-snapshot-for-intentional-changes).
105
98
@@ -110,19 +103,16 @@ We upload the docs builds to CI. So, you can download what the site will look li
110
103
111
104
1. Navigate to the GitHub Actions page for the "Tests" action.
112
105
2. Open the "Summary" page with the house icon.
113
-
3. Under the "Artifacts" section, there should be a "html_docs" entry. Download it.
114
-
4. Choose the theme you want, such as `qiskit_html_docs.tar.gz`, and un-tar it. Then, open the `index.html` page in a browser.
106
+
3. Under the "Artifacts" section, there should be a "html_docs" entry. Download it. Un-tar it, then open the `index.html` page in a browswer.
115
107
116
108
Contributors with write access can also use live previews of the docs: GitHub will deploy a website using your changes. To use live previews, push your branch to `upstream` rather than your fork. GitHub will leave a comment with the link to the site. Please prefix your branch name with your initials, e.g. `EA/add-translations`, for good Git hygiene.
117
109
118
110
------
119
111
## FYI: How Furo Theme Inheritance Works
120
112
121
-
We use Sphinx's inheritance future for our Furo-based `qiskit` theme, which we set in `theme/qiskit-sphinx-theme/theme.conf`. Sphinx will default to using all the files from Furo. But if we have a file with the same name as Furo, then Sphinx will use our copy. That allows us to override only what we care about.
122
-
123
-
We try to keep changes to a minimum because every divergence we make from base Furo increases our maintenance burden. Hence we prioritise only making changes that are important to the Qiskit brand. If the change would be generally useful to other users of Furo, we try to contribute upstream to the Furo project itself.
113
+
We use Sphinx's inheritance feature because our theme is built on top of [Furo](https://github.com/pradyunsg/furo). The `furo` inheritance is configured in `theme/qiskit-sphinx-theme/theme.conf`. Sphinx will default to using all the files from Furo. But if we have a file with the same name as Furo, then Sphinx will use our copy. That allows us to override only what we care about.
124
114
125
-
The `qiskit-ecosystem` theme then inherits the `qiskit` theme to make some tweaks, although we're removing the `qiskit` theme so the themes are converging.
115
+
We try to keep changes to a minimum because every divergence we make from base Furo increases our maintenance burden. Hence we prioritise only making changes that are important to the Qiskit Ecosystem brand. If the change would be generally useful to other users of Furo, we try to contribute upstream to the Furo project itself.
126
116
127
117
### How to change HTML
128
118
Copy the HTML template from Furo and save it in the same file path. Then, at the top of the file, add this header:
Copy file name to clipboardexpand all lines: README.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,14 @@ See [Migrate from old Pytorch theme to new theme](https://github.com/Qiskit/qisk
10
10
## Overview
11
11
12
12
This repository hosts three things:
13
-
-Qiskit Sphinx themes (located in the `src/` folder)
14
-
-Example Docs (located in the `example_docs/` folder)
13
+
-`qiskit-ecosystem` theme (located in the `src/` folder)
14
+
-example docs (located in the `example_docs/` folder)
15
15
- Qiskit Docs Guide (located in the `docs_guide/` folder)
16
16
17
-
The Qiskit Sphinx Themes are the themes used by Qiskit Documentation (https://qiskit.org/documentation/) and Qiskit Ecosystem projects.
17
+
The `qiskit-ecosystem` theme is used by projects in the [Qiskit Ecosystem](https://qiskit.github.io/ecosystem).
18
18
19
-
The Example Docs is a minimal Sphinx project that is used for testing the Qiskit Sphinx Theme. Every
20
-
pull request will trigger [a GitHub workflow](https://github.com/Qiskit/qiskit_sphinx_theme/blob/main/.github/workflows/main.yml) that builds the Example Docs to make sure the changes do
19
+
The example docs are a minimal Sphinx project that is used for testing the Qiskit Sphinx Theme. Every
20
+
pull request will trigger [a GitHub workflow](https://github.com/Qiskit/qiskit_sphinx_theme/blob/main/.github/workflows/main.yml) that builds the example docs to make sure the changes do
21
21
not introduce unintended changes.
22
22
23
23
The Qiskit Docs Guide hosts instructions, guidelines and recommendations of good documentation
@@ -34,7 +34,7 @@ pip install qiskit-sphinx-theme
34
34
35
35
Then, set up the theme by updating `conf.py`:
36
36
37
-
1. Set `html_theme = "qiskit-ecosystem"` (only Qiskit Terra should use `qiskit`)
37
+
1. Set `html_theme = "qiskit-ecosystem"`
38
38
2. Add `"qiskit_sphinx_theme"` to `extensions`
39
39
40
40
You also likely want to set `html_title` in `conf.py`. This results in the left sidebar having a more useful and concise name, along with the page title in the browser. Most projects will want to use this in their `conf.py`:
0 commit comments