Skip to content

Commit

Permalink
add doctest to CI (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgsavage authored Dec 1, 2024
1 parent 656e337 commit d1eb38d
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 8 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Documentation Build

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
with:
python-version: "3.10"

- 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
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==0.14 commonmark==0.8.1 recommonmark==0.5.0 babel==2.8
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
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.11"
sphinx:
configuration: docs/conf.py
fail_on_warning: false
Expand Down
4 changes: 1 addition & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,13 @@ Pint-pandas: Unit support for pandas
User Guide <user/index>
Advanced topics <advanced/index>
ecosystem
API Reference <api/index>

.. toctree::
:maxdepth: 1
:hidden:
:caption: For developers

dev/contributing
dev/pint-convert
dev/contributing <https://github.com/hgrecco/pint-pandas>

.. toctree::
:maxdepth: 1
Expand Down
3 changes: 2 additions & 1 deletion docs/user/common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ The default operation of Pandas `pd.concat` function is to perform row-wise conc

.. ipython:: python
:suppress:
:okwarning:
:okexcept:
df = pd.concat(list_of_series, axis=1)
Expand Down
5 changes: 4 additions & 1 deletion docs/user/reading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ Let's read that into a DataFrame. Here io.StringIO is used in place of reading a
df = pd.read_csv(io.StringIO(test_data), header=[0, 1], index_col=[0, 1]).T
# df = pd.read_csv("/path/to/test_data.csv", header=[0, 1])
for col in df.columns:
df[col] = pd.to_numeric(df[col], errors="ignore")
try:
df[col] = pd.to_numeric(df[col])
except ValueError:
pass
df.dtypes
Expand Down
4 changes: 2 additions & 2 deletions requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx>4
sphinx>=6
ipython<=8.12
matplotlib
mip>=1.13
Expand All @@ -16,7 +16,7 @@ dask[complete]
setuptools>=41.2
Serialize
pygments>=2.4
sphinx-book-theme==0.3.3
sphinx-book-theme>=1.1.0
sphinx_copybutton
sphinx_design
typing_extensions

0 comments on commit d1eb38d

Please sign in to comment.