Skip to content

Commit

Permalink
Fixed documentation inside the template (#39)
Browse files Browse the repository at this point in the history
As brought up in
[this](#35 (comment))
discussion the documentation should build now without any errors.

---------

Co-authored-by: Agriya Khetarpal <[email protected]>
  • Loading branch information
santacodes and agriyakhetarpal committed Aug 6, 2024
1 parent c76bb32 commit edd627c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,39 @@ jobs:
- name: Test the generated project
working-directory: ./pybamm-example-project
run: nox -s generated-project-tests

run_generated_project_doctests:
needs: [template_test]
runs-on: ubuntu-latest
name: Generated Project Doctests (ubuntu-latest / Python 3.12)

steps:
- name: Check out pybamm-cookiecutter repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Set up uv
uses: yezz123/setup-uv@v4
with:
uv-venv: ".venv"

- name: Install nox
uses: wntrblm/[email protected]

- name: Install copier and jinja2_time and generate a template with default values
run: |
uv pip install copier jinja2-time
copier copy . ../pybamm-example-project --trust --defaults
- name: Check if the documentation can be built
working-directory: ../pybamm-example-project
run: |
git add .
git commit -am "initial commit"
nox -s docs
Empty file added template/docs/_static/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions template/docs/conf.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ html_last_updated_fmt = "%Y-%m-%d"
html_static_path = ["_static"]
html_file_suffix = ".html"

# For edit button
html_context = {
"github_user": "{{org}}",
"github_repo": "{{project_name}}",
"github_version": "{{branch}}",
"doc_path": "docs/",
}
# Add any logos and favicons for your hosted documentation here. The logo and the favicon
# should be placed in the html_static_path directory listed above.
# html_logo = "_static/logo.png"
Expand Down Expand Up @@ -104,6 +111,8 @@ extensions = [
"IPython.sphinxext.ipython_console_highlighting",
]

# Configure references
bibtex_bibfiles = ['refs.bib']
# ---- Options for EPUB output --------------------------------------------------------

# Bibliographic Dublin Core information
Expand Down
Empty file added template/docs/refs.bib
Empty file.
2 changes: 1 addition & 1 deletion template/noxfile.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ VENV_DIR = Path("./venv").resolve()
@nox.session(name="docs")
def build_docs(session: nox.Session) -> None:
"""Build the documentation and load it in a browser tab, rebuilding on changes."""
session.install("setuptools")
session.install("-e", ".[docs]")
with session.chdir("docs/"):
# For local development
Expand Down Expand Up @@ -59,7 +60,6 @@ def run_coverage(session):
session.posargs.append("--cov-report=xml")
run_user_tests(session)


@nox.session(name="dev")
def set_dev(session):
"""Install pybamm-cookiecutter in editable mode"""
Expand Down

0 comments on commit edd627c

Please sign in to comment.