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

Convert website to Sphinx #263

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ce38ab6
Use Sphinx for building
bryanwweber Jun 17, 2022
96a65d1
Add sphinx-design extension for Bootstrap support
bryanwweber Jun 19, 2022
eb4a718
Update dependencies and instructions
bryanwweber Mar 18, 2023
804e5fd
Formatting
bryanwweber Mar 18, 2023
a38b3da
add python 3.9 support for type hints
bryanwweber Apr 5, 2023
50f0f38
Update pdm and dependencies
bryanwweber Jul 2, 2023
bf7b1c4
More or less reproduce the home page
bryanwweber Jul 2, 2023
40ca92e
Some content reformatting
bryanwweber Jul 3, 2023
97a40dc
Bump api-docs submodule
speth Feb 25, 2024
aacb13d
Add tool for copying API docs into place
speth Feb 26, 2024
97918cf
Add header links to versioned sections and make styling more consistent
speth Feb 26, 2024
af0f35c
Ignore pdm.lock file
speth Feb 26, 2024
6c701e5
Delete content that was migrated to the Cantera/cantera repo
speth Feb 26, 2024
a2f7053
Delete Nikola plugin and theme files
speth Feb 26, 2024
2663431
Improve formatting of cards on homepage
speth Feb 27, 2024
f84d11b
Convert "Community" page to Markdown and update formatting
speth Feb 28, 2024
22fecba
Convert "affiliated" page to Markdown and update formatting
speth Feb 28, 2024
3d56a5e
Convert "Governance" page to Markdown and update formatting
speth Feb 28, 2024
0e3887b
Convert Dave Goodwin memorial page to Markdown and update formatting
speth Feb 29, 2024
27c9bfb
Use ABlog to handle news posts
speth Feb 29, 2024
f7c57dc
Clean up formatting of all news posts
speth Mar 2, 2024
4b44a66
Fix some warnings and display issues on index and community pages
speth Mar 4, 2024
5bcdf55
Redirect search to stable docs on most pages
speth Mar 7, 2024
7463476
Match style of navbar icons in current docs
speth Mar 7, 2024
bed0d03
Fix header links to stable docs from subdirectories
speth Mar 7, 2024
31c7e2a
Remove unused local Sphinx extensions
speth Mar 7, 2024
cffb509
Use updated favicon
speth Mar 8, 2024
cd6fc33
Add "assets" directory needed for legacy doc landing pages
speth Mar 8, 2024
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
75 changes: 60 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Nikola directories
output/
cache/
.doit.db.*
.doit.db*

# CI Support
.ci_support/ctdeploy_key
/dev-docs
/dev-docs/
pdm.lock

# Byte-compiled / optimized / DLL files
__pycache__/
Expand All @@ -29,6 +24,7 @@ parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -47,14 +43,17 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -64,6 +63,7 @@ coverage.xml
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -76,16 +76,49 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version
# IPython
profile_default/
ipython_config.py

# celery beat schedule file
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm-python

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py
Expand All @@ -111,9 +144,21 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# VS Code
.vscode/
# Cython debug symbols
cython_debug/

# macOS hidden files
*.DS_Store
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
language_version: python3
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
language_version: python3
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
# Override default --ignore-missing-imports
args: []
additional_dependencies:
- sphinx
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
82 changes: 31 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,37 @@
# Cantera Website

This repository contains the source code for the [cantera.org](https://cantera.org) website. The
site is built using the [Nikola](https://getnikola.com) static site generator.
site is built using the [Sphinx](https://sphinx-doc.org) static site generator.

## To build the website

1. Create a virtual environment for Nikola (i.e., using conda or virtualenv)
2. Clone the Cantera source: `git clone https://github.com/Cantera/cantera.git`
3. Clone the Cantera Jupyter examples: `git clone https://github.com/Cantera/cantera-jupyter.git`
4. Clone the Cantera website source: `git clone https://github.com/Cantera/cantera-website.git`
5. Enter the website repo: `cd cantera-website`
6. Copy the current development documentation: `curl -O https://cantera.org/documentation/dev/dev-docs.tar.bz2`
7. Extract the dev docs: `tar jxf dev-docs.tar.bz2 --strip-components=1 -C api-docs/dev`
8. Inside the website repo, install the required packages: `pip install -r requirements.txt`
9. Build the website and open in browser: `nikola auto -b` or use `nikola serve -p 9000 -b` for different port

## To add a language of examples

1. Copy one of the existing `render_*_examples.py` and `render_*_examples.plugin`
2. Add the source folder as the key and destination folder to the `EXAMPLES_FOLDERS` dictionary in `conf.py`
3. Edit the `render_*_examples.py` file to build the examples
4. See [this blog post](https://bryanwweber.com/writing/personal/2018/12/22/writing-task-plugins-for-nikola/) for more information about building Nikola tasks

## To add an example category for Jupyter or Python

1. New example categories are stored in folders in the Jupyter and Python example repositories
2. If new categories (folders) are added to the examples, the appropriate renderer needs to be updated
3. In the Jupyter and Python examples, there's a dictionary called `*_headers`. Each folder of examples has a key in that dictionary. The values are a nested dictionary with three keys:
1. `name`: The name used on the index page for that category
2. `files`: An empty list that gets filled with the names of the examples in this category
3. `summaries`: A empty dictionary that gets filled with keys that are the example filename and values that are the summary from that example
4. Add a new key to that dictionary with the folder name as the key and fill in the `name` key in the nested dictionary and set the `files` and `summaries` keys to the empty list and empty dictionary, respectively

## To add a version's release notes

* To add the latest version's release notes: `nikola new_release`
* To add release notes for a version by its tag name: `nikola new_release -t {tag_name}`
- Example: `nikola new_release -t v2.4.0`
* To add release notes for a version by its release ID: `nikola new_release -i {id}`
- Example: `nikola new_release -i 12508904`

## Cheat sheet for linking to content in various places:
* To link to another section on the same page (using the title of the section):
`Governing Equations for Single Reactors`_
* To link to an external site:
* `YAML 1.2 <https://yaml.org/spec/1.2/spec.html>`__
* To link to a Python class:
* :py:class:`ConstPressureReactor`
* To link to a C++ class:
* `ThermoPhase <{{% ct_docs doxygen/html/dc/d38/classCantera_1_1ThermoPhase.html %}}>`__
* To link to an example:
* `IC engine example </examples/python/reactors/ic_engine.py.html>`__
* To link to a label in the YAML API docs:
* :ref:`three-body <sec-yaml-three-body>`
* To link to a class defined in `ctml_writer`:
* :cti:class:`falloff_reaction`
### Using pdm (Recommended)

1. Install [`pdm`](https://pdm.fming.dev/latest/). Recommended method is to use `pipx`.
2. Run `pdm install` to create the virtual environment
3. Copy or symlink the development version docs as `dev-docs`
4. Run `python3 copy-api-docs.py` to copy API docs into the output directory
5. Run `pdm run build` to build the website, or run `pdm run rebuild` to automatically rebuild the website when a page changes.
6. Run a web server to view the website:

```shell
python -m http.server 8080 --directory build/html
```

7. Open a browser to <http://localhost:8080>

When you're ready to shut things down, close the web server with `C-c` (`CTRL-c`)

### Using Conda (old instructions that aren't updated)

1. Create a virtual environment for Sphinx using `conda` and activate it. The environment must have Python 3.10 and the `conda-lock` package.
2. Clone the Cantera website source: `git clone https://github.com/Cantera/cantera-website.git`
3. Enter the website repo: `cd cantera-website`
4. Inside the website repo, install the required packages:

```shell
conda-lock install continuous-integration/conda-lock.yml --name <name-of-your-environment>
```

5. Build the website and open in browser: `make html && python -m http.server --directory build/html` then navigate to `localhost:8000` in your browser
6. Press `C-c` (`CTRL-C`) to close the Python HTTP server
2 changes: 1 addition & 1 deletion api-docs
Submodule api-docs updated 4028 files
Loading