Skip to content

Commit

Permalink
Add nbformat to Optional Dependency Group (#43)
Browse files Browse the repository at this point in the history
* [gha] fix `no module named 'nbformat'`

* [gha] shinx -> sphinx

* [pyproj] add more jupyter dependencies

* [readme] fix model constructor call

* [pyproj]  must depend on

* [gha] poetry -> sphinx-build

* [gha] actually install sphinx

* [gha] remove  invocation

* [gha] change bad doc path
  • Loading branch information
IsaccBarker authored Sep 18, 2024
1 parent 57e6664 commit db7393b
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 73 deletions.
147 changes: 75 additions & 72 deletions .github/workflows/sphinx.yaml
Original file line number Diff line number Diff line change
@@ -1,79 +1,82 @@
name: shinx
name: sphinx

on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

# Setting up the environment
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.4.515

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

# - name: Install Poetry
# run: pip install poetry

- name: Install the package
run: pip install .

# Building
- name: Render Quarto File
run: quarto render README.qmd --to rst && mv README.rst docs/index.rst

- name: Build HTML using Poetry
run: poetry run -C docs sphinx-build -M html docs/source/ docs/build/

# Upload
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: docs/build/html/

deploy:
# Deploy to the github-pages environment
# but not on PRs
if: ${{ github.event_name != 'pull_request' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

needs: build

# Specify runner + deployment step
runs-on: ubuntu-latest

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages
preview: true # Not yet available to the public.
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

# Setting up the environment
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.4.515

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

# - name: Install Poetry
# run: pip install poetry

- name: Install Sphinx
run: pip install sphinx

- name: Install the package
run: pip install ".[doc]"

# Building
- name: Render Quarto File
run: quarto render README.qmd --to rst && mv README.rst docs/index.rst

- name: Build HTML using Sphinx
run: sphinx-build -M html docs docs/build/

# Upload
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: docs/build/html/

deploy:
# Deploy to the github-pages environment
# but not on PRs
if: ${{ github.event_name != 'pull_request' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

needs: build

# Specify runner + deployment step
runs-on: ubuntu-latest

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages
preview: true # Not yet available to the public.
2 changes: 1 addition & 1 deletion README.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Here we show how to create a `SEIR` object and add terms to it. We will use the
import epiworldpy as epiworld
# Create a SEIR model (susceptible, exposed, infectious, recovered), representing COVID-19.
covid19 = epiworld.ModelSEIR(
covid19 = epiworld.ModelSEIRCONN(
name = 'covid-19',
n = 10000,
prevalence = .01,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ classifiers = [

[project.optional-dependencies]
test = ["pytest"]
doc = ["nbformat", "nbclient", "jupyter", "epiworldpy[viz]"]
viz = ["ipympl>=0.8", "matplotlib>=3.5.0", "networkx>=3.0", "scipy>=1.0"]

[tool.scikit-build]
Expand Down

0 comments on commit db7393b

Please sign in to comment.