From b9ceb32445f824d57a17da808e3ee5fc8b928fa4 Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 6 May 2023 10:52:05 -0500 Subject: [PATCH 1/2] Add docs build to CI --- .github/workflows/push-test.yml | 63 +++++++++++++++++++++++++++++---- .readthedocs.yaml | 36 +++++++++++++------ poetry.lock | 46 ++---------------------- pyproject.toml | 2 +- 4 files changed, 86 insertions(+), 61 deletions(-) diff --git a/.github/workflows/push-test.yml b/.github/workflows/push-test.yml index 664bf71..4698989 100644 --- a/.github/workflows/push-test.yml +++ b/.github/workflows/push-test.yml @@ -1,5 +1,6 @@ name: Test +# Overlap if PR is from the same repo, but pull_request is nec. for forks, etc. on: [push, pull_request] jobs: @@ -38,18 +39,16 @@ jobs: virtualenvs-in-project: true # ====== # Load cached venv if cache exists + # Install dependencies if cache does not exist # ====== - name: Load cached venv - id: cached-poetry-dependencies + id: cached-poetry-dependencies-dev uses: actions/cache@v3 with: path: .venv - key: venv-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ hashFiles('**/poetry.lock') }} - # ====== - # Install dependencies if cache does not exist - # ====== + key: dev-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + if: steps.cached-poetry-dependencies-dev.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root -E dev # ====== # Run test suite @@ -58,3 +57,55 @@ jobs: # ====== - name: Run tests run: poetry run pytest + + docs: + runs-on: ubuntu-latest + needs: [ test ] + strategy: + matrix: + python-version: [ "3.7" ] + poetry-version: [ "1.2.1" ] + steps: + # ====== + # Checkout, set up python + # ====== + - name: Check out + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + # ====== + # Install and configure poetry from cache + # ====== + - name: Load cached Poetry installation + id: cached-poetry + uses: actions/cache@v3 + with: + path: ~/.local # the path depends on the OS + key: poetry-${{ matrix.poetry-version }} + # ====== + # Load cached venv if cache exists + # Install dependencies if cache does not exist + # ====== + - name: Load cached venv + id: cached-poetry-dependencies-docs + uses: actions/cache@v3 + with: + path: .venv + key: docs-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root -E docs + # ====== + # Install Pandoc + # ====== + - name: Use pandoc (external to Poetry) + uses: nikeee/setup-pandoc@v1 +# uses: docker://pandoc/latex:2.9 + - run: pip install pandoc + # ====== + # Run test suite + # ====== + - name: Make docs + run: poetry run sphinx-build docs docs/_build \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 47b6188..89d4bb8 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,15 +1,31 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required version: 2 +# Set the version of Python and other tools you might need build: - image: latest - -python: - version: 3.7 - install: - - method: pip - path: . - extra_requirements: - - docs + os: ubuntu-22.04 + tools: + python: "3.7" + jobs: + post_create_environment: + - pip install poetry==1.2.1 + - poetry config virtualenvs.create false + post_install: + - poetry install -E docs +# Build documentation in the docs/ directory with Sphinx sphinx: - configuration: docs/conf.py \ No newline at end of file + configuration: docs/conf.py + +# If using Sphinx, optionally build your docs in additional formats such as PDF +# formats: +# - pdf + +## Optionally declare the Python requirements required to build your docs +#python: +# install: +# - requirements: docs/requirements.txt diff --git a/poetry.lock b/poetry.lock index 2e70295..557b30c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -578,18 +578,6 @@ category = "main" optional = true python-versions = ">=3.7" -[[package]] -name = "pandoc" -version = "2.3" -description = "Pandoc Documents for Python" -category = "main" -optional = true -python-versions = "*" - -[package.dependencies] -plumbum = "*" -ply = "*" - [[package]] name = "pandocfilters" version = "1.5.0" @@ -664,30 +652,6 @@ importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] -[[package]] -name = "plumbum" -version = "1.8.1" -description = "Plumbum: shell combinators library" -category = "main" -optional = true -python-versions = ">=3.6" - -[package.dependencies] -pywin32 = {version = "*", markers = "platform_system == \"Windows\" and platform_python_implementation != \"PyPy\""} - -[package.extras] -dev = ["paramiko", "psutil", "pytest-cov", "pytest-mock", "pytest-timeout", "pytest (>=6.0)"] -docs = ["sphinx-rtd-theme (>=1.0.0)", "sphinx (>=4.0.0)"] -ssh = ["paramiko"] - -[[package]] -name = "ply" -version = "3.11" -description = "Python Lex & Yacc" -category = "main" -optional = true -python-versions = "*" - [[package]] name = "prompt-toolkit" version = "3.0.38" @@ -1125,12 +1089,12 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "flake8 (<5)", "pytest-co [extras] dev = ["pytest"] -docs = ["sphinx", "nbsphinx", "ipykernel", "jupyter_client", "sphinx_rtd_theme", "matplotlib", "pandoc"] +docs = ["sphinx", "nbsphinx", "ipykernel", "jupyter_client", "sphinx_rtd_theme", "matplotlib"] [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "4099f4f4232f4cd8160ab04e610b476971facbf5faf8502a568b6187cfb8ec26" +content-hash = "fb41eebaae5f13670d72ade7e4ef99b448caf79fe42e7ac49ae2e38d7ecb8d79" [metadata.files] alabaster = [] @@ -1243,7 +1207,6 @@ numpy = [ {file = "numpy-1.21.1.zip", hash = "sha256:dff4af63638afcc57a3dfb9e4b26d434a7a602d225b42d746ea7fe2edf1342fd"}, ] packaging = [] -pandoc = [] pandocfilters = [ {file = "pandocfilters-1.5.0-py2.py3-none-any.whl", hash = "sha256:33aae3f25fd1a026079f5d27bdd52496f0e0803b3469282162bafdcbdf6ef14f"}, {file = "pandocfilters-1.5.0.tar.gz", hash = "sha256:0b679503337d233b4339a817bfc8c50064e2eff681314376a47cb582305a7a38"}, @@ -1263,11 +1226,6 @@ pickleshare = [ pillow = [] pkgutil-resolve-name = [] pluggy = [] -plumbum = [] -ply = [ - {file = "ply-3.11-py2.py3-none-any.whl", hash = "sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce"}, - {file = "ply-3.11.tar.gz", hash = "sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3"}, -] prompt-toolkit = [] ptyprocess = [ {file = "ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35"}, diff --git a/pyproject.toml b/pyproject.toml index afc058e..67b3e2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ ipykernel = {version = "^5.2.1", optional = true} jupyter_client = {version = "^6.1.3", optional = true} sphinx_rtd_theme = {version = "^1", optional = true} matplotlib = {version = "^3.2.1", optional = true} -pandoc = {version = "^2.2", optional = true} +#pandoc = {version = "^2.2", optional = true} # dev pytest = {version = "^7", optional = true} From 95830976320cc44a6c3afa48cda9a58226ad5b70 Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 6 May 2023 11:47:38 -0500 Subject: [PATCH 2/2] Separate docs/test yml --- .github/workflows/pull-docs.yml | 55 +++++++++++++++++++++++++++++++ .github/workflows/push-test.yml | 57 ++------------------------------- 2 files changed, 58 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/pull-docs.yml diff --git a/.github/workflows/pull-docs.yml b/.github/workflows/pull-docs.yml new file mode 100644 index 0000000..28b7b90 --- /dev/null +++ b/.github/workflows/pull-docs.yml @@ -0,0 +1,55 @@ +name: Docs + +on: [pull_request] + +jobs: + docs: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ "3.7" ] + poetry-version: [ "1.2.1" ] + steps: + # ====== + # Checkout, set up python + # ====== + - name: Check out + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + # ====== + # Install and configure poetry from cache + # ====== + - name: Load cached Poetry installation + id: cached-poetry + uses: actions/cache@v3 + with: + path: ~/.local # the path depends on the OS + key: poetry-${{ matrix.poetry-version }} + # ====== + # Load cached venv if cache exists + # Install dependencies if cache does not exist + # ====== + - name: Load cached venv + id: cached-poetry-dependencies-docs + uses: actions/cache@v3 + with: + path: .venv + key: docs-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root -E docs + # ====== + # Install Pandoc + # ====== + - name: Use pandoc (external to Poetry) + uses: nikeee/setup-pandoc@v1 +# uses: docker://pandoc/latex:2.9 + - run: pip install pandoc + # ====== + # Run test suite + # ====== + - name: Make docs + run: poetry run sphinx-build docs docs/_build diff --git a/.github/workflows/push-test.yml b/.github/workflows/push-test.yml index 4698989..12ce69f 100644 --- a/.github/workflows/push-test.yml +++ b/.github/workflows/push-test.yml @@ -1,6 +1,7 @@ name: Test -# Overlap if PR is from the same repo, but pull_request is nec. for forks, etc. +# Push/pull overlap if PR is from the same repo, +# but pull_request is nec. for forks, etc. on: [push, pull_request] jobs: @@ -56,56 +57,4 @@ jobs: # https://github.com/marketplace/actions/install-poetry-action#codecov-upload # ====== - name: Run tests - run: poetry run pytest - - docs: - runs-on: ubuntu-latest - needs: [ test ] - strategy: - matrix: - python-version: [ "3.7" ] - poetry-version: [ "1.2.1" ] - steps: - # ====== - # Checkout, set up python - # ====== - - name: Check out - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - # ====== - # Install and configure poetry from cache - # ====== - - name: Load cached Poetry installation - id: cached-poetry - uses: actions/cache@v3 - with: - path: ~/.local # the path depends on the OS - key: poetry-${{ matrix.poetry-version }} - # ====== - # Load cached venv if cache exists - # Install dependencies if cache does not exist - # ====== - - name: Load cached venv - id: cached-poetry-dependencies-docs - uses: actions/cache@v3 - with: - path: .venv - key: docs-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ hashFiles('**/poetry.lock') }} - - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root -E docs - # ====== - # Install Pandoc - # ====== - - name: Use pandoc (external to Poetry) - uses: nikeee/setup-pandoc@v1 -# uses: docker://pandoc/latex:2.9 - - run: pip install pandoc - # ====== - # Run test suite - # ====== - - name: Make docs - run: poetry run sphinx-build docs docs/_build \ No newline at end of file + run: poetry run pytest \ No newline at end of file