Skip to content

Commit

Permalink
build: move doc building and testing to pixi
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrecco committed Feb 15, 2025
1 parent 1297186 commit b494c56
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 40 deletions.
51 changes: 11 additions & 40 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,17 @@ on: [push, pull_request]
jobs:
docbuild:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Set up minimal Python version
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.1
with:
python-version: "3.11"

- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: Setup pip cache
uses: actions/cache@v2
environments: docs
- run: pixi run --environment docs docbuild
doctest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-docs
restore-keys: pip-docs

- name: Install locales
run: |
sudo apt-get install language-pack-fr
sudo localedef -i fr_FR -f UTF-8 fr_FR
- name: Install dependencies
run: |
sudo apt install -y pandoc
pip install --upgrade pip setuptools wheel
pip install -r "requirements_docs.txt"
pip install docutils commonmark==0.8.1 recommonmark==0.5.0 babel
pip install .
- name: Build documentation
run: sphinx-build -n -j auto -b html -d build/doctrees docs build/html

- name: Doc Tests
run: sphinx-build -a -j auto -b doctest -d build/doctrees docs build/doctest
environments: docs
- run: pixi run --environment docs doctest
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ matplotlib = ["matplotlib"]
all = [
"pint[numpy,uncertainties,babel,pandas,pandas,xarray,dask,mip,matplotlib]",
]
docs = [
"sphinx>=6",
"ipython<=8.12",
"nbsphinx",
"jupyter_client",
"ipykernel",
"graphviz",
"pooch",
"sparse",
"Serialize",
"pygments>=2.4",
"sphinx-book-theme>=1.1.0",
"sphinx_copybutton",
"sphinx_design",
"docutils", #==0.14",
"commonmark==0.8.1",
"recommonmark==0.5.0",
"babel",
]

[project.urls]
Homepage = "https://github.com/hgrecco/pint"
Expand Down Expand Up @@ -96,6 +115,16 @@ test = { features = ["test"], solve-group = "default" }
test-all = { features = ["test-all"], solve-group = "default" }
numpy = { features = ["numpy"], solve-group = "default" }
codspeed = { features = ["codspeed"], solve-group = "default" }
docs = { features = [
"docs",
"numpy",
"mip",
"matplotlib",
"dask",
"xarray",
"test",
"py311",
] }
# When pint[all] works in pixi, this will be easier.
all = { features = [
"test",
Expand Down Expand Up @@ -154,6 +183,16 @@ pip = "*"
[tool.pixi.feature.typecheck.tasks]
typecheck = "pyright"

[tool.pixi.feature.docs.pypi-dependencies]
pint = { path = ".", editable = true }

[tool.pixi.feature.docs.tasks]
docbuild = "sphinx-build -n -j auto -b html -d build/doctrees docs build/html"
doctest = "sphinx-build -a -j auto -b doctest -d build/doctrees docs build/doctest"

[tool.pixi.feature.docs.dependencies]
pandoc = "*"

[tool.pixi.feature.py311.dependencies]
python = "3.11.*"

Expand Down

0 comments on commit b494c56

Please sign in to comment.