From 051db3f54b15f5a473deccea89c8cecd35c8b2a8 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 13 May 2025 14:43:09 +0200 Subject: [PATCH 1/7] Add `LIBCARNA_PYTHON_NBSPHINX_EXECUTE` environment variable --- .readthedocs.yaml | 4 +++- docs/conf.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index bcec7a7..1f9f286 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -25,4 +25,6 @@ build: jobs: install: - bash ./linux_build.bash - - pip install libcarna_python-*.whl \ No newline at end of file + - pip install dist/libcarna_python-*.whl + environment: + LIBCARNA_PYTHON_NBSPHINX_EXECUTE: never \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 056a7ec..9b09a0b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,4 +20,4 @@ sys.path.append(LIBCARNA_PYTHON_PATH) os.environ['PYTHONPATH'] = LIBCARNA_PYTHON_PATH + ':' + os.environ.get('PYTHONPATH', '') -nbsphinx_execute = 'always' \ No newline at end of file +nbsphinx_execute = os.environ.get('LIBCARNA_PYTHON_NBSPHINX_EXECUTE', 'always') \ No newline at end of file From 54073345e3ab4aab7554d74a5852a09386485eda Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 13 May 2025 14:49:40 +0200 Subject: [PATCH 2/7] Add docs building for testing to CI --- .github/workflows/build.yml | 55 ++++++++++++++++++++++++++++++++- .github/workflows/build_all.yml | 3 +- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76859d0..fa13c70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,10 @@ on: python-version: required: true type: string + python-version-for-docs: + required: false + type: string + default: '' jobs: build: @@ -130,4 +134,53 @@ jobs: with: name: test-output-${{ inputs.python-version }} path: | - test/test/results/actual \ No newline at end of file + test/test/results/actual + + docs: + if: ${{ inputs.python-version == inputs.python-version-for-docs }} + needs: build + name: Docs + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: dist-${{ inputs.python-version }} + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: latest + auto-update-conda: true + + - name: Create and validate conda environment + shell: bash + run: | + conda create --prefix ./.env -c conda-forge -c bioconda \ + python==${{ inputs.python-version }} \ + libcarna==${{ needs.build.outputs.libcarna_version }} \ + pip + + - name: Install wheel + run: | + eval "$(conda shell.bash hook)" + conda activate ./.env + pip install libcarna_python-*.whl + + - name: Install dependencies + run: | + eval "$(conda shell.bash hook)" + conda activate ./.env + pip install -r docs/requirements.txt + + - name: Build docs + run: | + eval "$(conda shell.bash hook)" + conda activate ./.env + cd docs + sphinx-build -M html docs docs/build + env: + LIBCARNA_PYTHON_NBSPHINX_EXECUTE: never \ No newline at end of file diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 90be044..717051c 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -29,4 +29,5 @@ jobs: uses: ./.github/workflows/build.yml secrets: inherit with: - python-version: ${{ matrix.python-version }} \ No newline at end of file + python-version: ${{ matrix.python-version }} + python-version-for-docs: '3.12' \ No newline at end of file From 724260a61a6ba3ea9662459bac34b975b0d9a2d3 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 13 May 2025 14:59:08 +0200 Subject: [PATCH 3/7] Update RTD integration, remove doc building from CI --- .github/workflows/build.yml | 55 +-------------------------------- .github/workflows/build_all.yml | 3 +- .readthedocs.yaml | 4 +-- 3 files changed, 4 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa13c70..76859d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,10 +6,6 @@ on: python-version: required: true type: string - python-version-for-docs: - required: false - type: string - default: '' jobs: build: @@ -134,53 +130,4 @@ jobs: with: name: test-output-${{ inputs.python-version }} path: | - test/test/results/actual - - docs: - if: ${{ inputs.python-version == inputs.python-version-for-docs }} - needs: build - name: Docs - runs-on: ubuntu-latest - steps: - - name: Git checkout - uses: actions/checkout@v4 - - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: dist-${{ inputs.python-version }} - - - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - miniconda-version: latest - auto-update-conda: true - - - name: Create and validate conda environment - shell: bash - run: | - conda create --prefix ./.env -c conda-forge -c bioconda \ - python==${{ inputs.python-version }} \ - libcarna==${{ needs.build.outputs.libcarna_version }} \ - pip - - - name: Install wheel - run: | - eval "$(conda shell.bash hook)" - conda activate ./.env - pip install libcarna_python-*.whl - - - name: Install dependencies - run: | - eval "$(conda shell.bash hook)" - conda activate ./.env - pip install -r docs/requirements.txt - - - name: Build docs - run: | - eval "$(conda shell.bash hook)" - conda activate ./.env - cd docs - sphinx-build -M html docs docs/build - env: - LIBCARNA_PYTHON_NBSPHINX_EXECUTE: never \ No newline at end of file + test/test/results/actual \ No newline at end of file diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 717051c..90be044 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -29,5 +29,4 @@ jobs: uses: ./.github/workflows/build.yml secrets: inherit with: - python-version: ${{ matrix.python-version }} - python-version-for-docs: '3.12' \ No newline at end of file + python-version: ${{ matrix.python-version }} \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1f9f286..47d3f0b 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -26,5 +26,5 @@ build: install: - bash ./linux_build.bash - pip install dist/libcarna_python-*.whl - environment: - LIBCARNA_PYTHON_NBSPHINX_EXECUTE: never \ No newline at end of file + pre_build: + - export LIBCARNA_PYTHON_NBSPHINX_EXECUTE=never \ No newline at end of file From ff83df7d1f5718ef8119ef255de8c26ae4fefe77 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 13 May 2025 15:06:08 +0200 Subject: [PATCH 4/7] Update docs/conf.py --- docs/conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 9b09a0b..c6824e2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,7 +17,8 @@ import sys LIBCARNA_PYTHON_PATH = os.environ.get('LIBCARNA_PYTHON_PATH') -sys.path.append(LIBCARNA_PYTHON_PATH) -os.environ['PYTHONPATH'] = LIBCARNA_PYTHON_PATH + ':' + os.environ.get('PYTHONPATH', '') +if LIBCARNA_PYTHON_PATH is not None: + sys.path.append(LIBCARNA_PYTHON_PATH) + os.environ['PYTHONPATH'] = LIBCARNA_PYTHON_PATH + ':' + os.environ.get('PYTHONPATH', '') nbsphinx_execute = os.environ.get('LIBCARNA_PYTHON_NBSPHINX_EXECUTE', 'always') \ No newline at end of file From 8a6c488a4b3cd7e2455b1c08d1524af171f74b82 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 13 May 2025 15:14:11 +0200 Subject: [PATCH 5/7] Update .readthedocs.yaml --- .readthedocs.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 47d3f0b..81587ea 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -12,11 +12,6 @@ sphinx: conda: environment: environment.yml -# Install doc-building dependencies -python: - install: - - requirements: docs/requirements.txt - # Specify the build process build: os: ubuntu-24.04 @@ -27,4 +22,5 @@ build: - bash ./linux_build.bash - pip install dist/libcarna_python-*.whl pre_build: + - pip install -r docs/requirements.txt - export LIBCARNA_PYTHON_NBSPHINX_EXECUTE=never \ No newline at end of file From 1577285f9f0ea9980b10bdd3ad9284655e98fc51 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 13 May 2025 15:34:35 +0200 Subject: [PATCH 6/7] Update .readthedocs.yaml --- .readthedocs.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 81587ea..259fa4b 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -23,4 +23,6 @@ build: - pip install dist/libcarna_python-*.whl pre_build: - pip install -r docs/requirements.txt - - export LIBCARNA_PYTHON_NBSPHINX_EXECUTE=never \ No newline at end of file + build: + html: + - LIBCARNA_PYTHON_NBSPHINX_EXECUTE=never sphinx-build -M html docs $READTHEDOCS_OUTPUT/html \ No newline at end of file From 410c4ffb226f3cfd502833d48114fde26d3efcd5 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 13 May 2025 15:41:48 +0200 Subject: [PATCH 7/7] Update .readthedocs.yaml --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 259fa4b..63787ce 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -25,4 +25,4 @@ build: - pip install -r docs/requirements.txt build: html: - - LIBCARNA_PYTHON_NBSPHINX_EXECUTE=never sphinx-build -M html docs $READTHEDOCS_OUTPUT/html \ No newline at end of file + - LIBCARNA_PYTHON_NBSPHINX_EXECUTE=never sphinx-build -M html docs $READTHEDOCS_OUTPUT \ No newline at end of file