From 81b430ca74d4dd665f6d7dfcd928021b1054a688 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 26 Aug 2025 18:52:17 +0200 Subject: [PATCH 01/11] docs: generate api documentation using sphinx --- .gitignore | 4 ++ docs/generate_docs.py | 74 ++++++++++++++++++++++++++++++ docs/source/_static/css/custom.css | 8 ++++ docs/source/conf.py | 50 ++++++++++++++++++++ docs/source/index.rst | 15 ++++++ requirements-dev.txt | 2 + 6 files changed, 153 insertions(+) create mode 100644 docs/generate_docs.py create mode 100644 docs/source/_static/css/custom.css create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/.gitignore b/.gitignore index 41a211e..e31650e 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,7 @@ build/ testing-setup-py-simple-example.py .localpythonenv/ + +# API docs +api.rst +_build/ diff --git a/docs/generate_docs.py b/docs/generate_docs.py new file mode 100644 index 0000000..1523b95 --- /dev/null +++ b/docs/generate_docs.py @@ -0,0 +1,74 @@ +import os +import re +import subprocess +import shutil + +# ----------------------- +# Step 1: Generate API RST +# ----------------------- + +# Define the directory where the Python source files are located +src_dir = 'src/bdkpython' +package_root = 'bdkpython' + +# Define the output file for the API documentation +output_file = 'docs/source/api.rst' + +# Regex pattern to match class definitions +class_pattern = re.compile(r'^class ([A-Za-z][A-Za-z0-9_]*)') + +# Store classes with their full module path +public_classes = {} + +for root, _, files in os.walk(src_dir): + for file in files: + if file.endswith('.py'): + module_path = os.path.relpath(os.path.join(root, file), src_dir) + module_path = module_path.replace(os.sep, '.').removesuffix('.py') + full_module = f'{package_root}.{module_path}' + with open(os.path.join(root, file), 'r') as f: + for line in f: + match = class_pattern.match(line) + if match: + class_name = match.group(1) + if not class_name.startswith('_'): + fqcn = f'{full_module}.{class_name}' + public_classes[fqcn] = True + +# Generate the RST content +rst_content = "API Reference\n============\n\n" + +for fqcn in sorted(public_classes.keys()): + rst_content += f".. autoclass:: {fqcn}\n" + rst_content += " :members:\n" + rst_content += " :undoc-members:\n" + rst_content += " :show-inheritance:\n\n" + +# Write the RST content to the output file +with open(output_file, 'w') as f: + f.write(rst_content) + +print(f"API documentation has been generated in {output_file}") + +# ----------------------- +# Step 2: Build HTML docs +# ----------------------- + +BUILD_DIR = 'docs/_build/html' +SOURCE_DIR = 'docs/source' + +# Clean previous HTML build +if os.path.exists(BUILD_DIR): + shutil.rmtree(BUILD_DIR) + +# Run Sphinx build +subprocess.run([ + "sphinx-build", + "-b", "html", + "-W", # treat warnings as errors + "--keep-going", # continue despite warnings + SOURCE_DIR, + BUILD_DIR +], check=True) + +print(f"HTML documentation has been built in {BUILD_DIR}") \ No newline at end of file diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css new file mode 100644 index 0000000..60a3c7f --- /dev/null +++ b/docs/source/_static/css/custom.css @@ -0,0 +1,8 @@ +/* Remove max-width restriction */ +.wy-nav-content { + max-width: none !important; +} + +.wy-menu-vertical a { + font-size: 1.1em !important; +} diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..d796186 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,50 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import os +import sys +sys.path.insert(0, os.path.abspath('../../src/bdkpython')) + + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'bdkpython' +copyright = '2025, Bitcoin Dev Kit Developers' +author = 'Bitcoin Dev Kit Developers' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.viewcode', + 'sphinx_rtd_theme', +] + +templates_path = ['_templates'] +exclude_patterns = [] + +# Suppress docstring formatting warnings due to uniffi bindings +suppress_warnings = [ + 'docutils' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] + +# Register custom CSS +html_css_files = [ + 'css/custom.css', +] + +def setup(app): + app.add_css_file('css/custom.css') \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..9f2c512 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,15 @@ +Welcome to bdkpython's documentation! +===================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + api + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/requirements-dev.txt b/requirements-dev.txt index b95a8a8..0714a87 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,4 @@ pytest==7.1.2 tox==3.25.1 +sphinx +sphinx_rtd_theme From 8b59b41747224515538a79989dd2a3918a495bfd Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 2 Sep 2025 17:56:52 +0200 Subject: [PATCH 02/11] ci: create github workflow for building and uploading API documentation --- .github/workflows/python-api-docs.yaml | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/python-api-docs.yaml diff --git a/.github/workflows/python-api-docs.yaml b/.github/workflows/python-api-docs.yaml new file mode 100644 index 0000000..b376f6c --- /dev/null +++ b/.github/workflows/python-api-docs.yaml @@ -0,0 +1,40 @@ +name: Build Python API Docs + +on: + workflow_dispatch: + +permissions: {} + +jobs: + build-docs: + name: "Build and Upload API Documentation" + runs-on: ubuntu-24.04 + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + submodules: recursive + persist-credentials: false + fetch-depth: 0 + + - name: "Set up Python" + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: "Install Sphinx and Theme" + run: | + python3 -m pip install --upgrade pip + pip install sphinx sphinx_rtd_theme + + - name: "Build python API Documentation" + run: | + bash ./scripts/generate-linux.sh + cd ./docs/ + python3 generate_docs.py + + - name: "Upload API Docs" + uses: actions/upload-artifact@v4 + with: + name: artifact-python-api-docs + path: /home/runner/work/bdk-python/bdk-python/docs/_build/html From 640e1b5554f2ce7de8b29d70719af8b5249a0b4a Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 2 Sep 2025 18:38:15 +0200 Subject: [PATCH 03/11] ci: enhance workflow name clarity --- .github/workflows/python-api-docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-api-docs.yaml b/.github/workflows/python-api-docs.yaml index b376f6c..9bfd58f 100644 --- a/.github/workflows/python-api-docs.yaml +++ b/.github/workflows/python-api-docs.yaml @@ -1,4 +1,4 @@ -name: Build Python API Docs +name: Build and Upload Python API Docs on: workflow_dispatch: From c2573f296d92aeb9bf5c77582e263c65ff771d09 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 2 Sep 2025 18:50:02 +0200 Subject: [PATCH 04/11] ci: add pull_request trigger on workflow --- .github/workflows/python-api-docs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-api-docs.yaml b/.github/workflows/python-api-docs.yaml index 9bfd58f..47095fc 100644 --- a/.github/workflows/python-api-docs.yaml +++ b/.github/workflows/python-api-docs.yaml @@ -1,6 +1,7 @@ name: Build and Upload Python API Docs on: + pull_request: workflow_dispatch: permissions: {} From 8364caf83ac9236206fb5b6bacec4e56a659cafc Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 2 Sep 2025 18:58:20 +0200 Subject: [PATCH 05/11] style: enhance visual code separator --- docs/generate_docs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/generate_docs.py b/docs/generate_docs.py index 1523b95..8e5f5e5 100644 --- a/docs/generate_docs.py +++ b/docs/generate_docs.py @@ -3,9 +3,9 @@ import subprocess import shutil -# ----------------------- +# ------------------------ # Step 1: Generate API RST -# ----------------------- +# ------------------------ # Define the directory where the Python source files are located src_dir = 'src/bdkpython' From adc7e02bb6065f6d119b3271c2036b4825048477 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 2 Sep 2025 22:01:53 +0200 Subject: [PATCH 06/11] ci: fix docs generation flow --- .github/workflows/python-api-docs.yaml | 32 ++++++++++++++++++++------ docs/generate_docs.py | 31 ++++--------------------- docs/source/conf.py | 2 +- 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/.github/workflows/python-api-docs.yaml b/.github/workflows/python-api-docs.yaml index 47095fc..c3a0697 100644 --- a/.github/workflows/python-api-docs.yaml +++ b/.github/workflows/python-api-docs.yaml @@ -1,7 +1,9 @@ name: Build and Upload Python API Docs on: - pull_request: + push: + branches: + - docs/api-docs workflow_dispatch: permissions: {} @@ -10,6 +12,11 @@ jobs: build-docs: name: "Build and Upload API Documentation" runs-on: ubuntu-24.04 + container: + image: quay.io/pypa/manylinux_2_28_x86_64 + env: + PLAT: manylinux_2_28_x86_64 + PYBIN: "/opt/python/cp310-cp310/bin" steps: - name: "Checkout" uses: actions/checkout@v4 @@ -17,6 +24,14 @@ jobs: submodules: recursive persist-credentials: false fetch-depth: 0 + + - name: "Install Rust 1.84.1" + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.84.1 + + - name: "Configure Git safe directory" + run: git config --global --add safe.directory /__w/bdk-python/bdk-python - name: "Set up Python" uses: actions/setup-python@v4 @@ -25,17 +40,20 @@ jobs: - name: "Install Sphinx and Theme" run: | - python3 -m pip install --upgrade pip - pip install sphinx sphinx_rtd_theme + ${PYBIN}/python -m pip install --upgrade pip + ${PYBIN}/pip install sphinx sphinx_rtd_theme - - name: "Build python API Documentation" + - name: "Generate python API Documentation" run: | bash ./scripts/generate-linux.sh - cd ./docs/ - python3 generate_docs.py + ${PYBIN}/python docs/generate_docs.py + + - name: "Build HTML Documentation" + run: | + ${PYBIN}/sphinx-build -b html -W --keep-going docs/source docs/_build/html - name: "Upload API Docs" uses: actions/upload-artifact@v4 with: name: artifact-python-api-docs - path: /home/runner/work/bdk-python/bdk-python/docs/_build/html + path: /home/runner/work/bdk-python/bdk-python/docs/_build/html \ No newline at end of file diff --git a/docs/generate_docs.py b/docs/generate_docs.py index 8e5f5e5..bcba1b8 100644 --- a/docs/generate_docs.py +++ b/docs/generate_docs.py @@ -3,9 +3,9 @@ import subprocess import shutil -# ------------------------ -# Step 1: Generate API RST -# ------------------------ +# ---------------- +# Generate API RST +# ---------------- # Define the directory where the Python source files are located src_dir = 'src/bdkpython' @@ -48,27 +48,4 @@ with open(output_file, 'w') as f: f.write(rst_content) -print(f"API documentation has been generated in {output_file}") - -# ----------------------- -# Step 2: Build HTML docs -# ----------------------- - -BUILD_DIR = 'docs/_build/html' -SOURCE_DIR = 'docs/source' - -# Clean previous HTML build -if os.path.exists(BUILD_DIR): - shutil.rmtree(BUILD_DIR) - -# Run Sphinx build -subprocess.run([ - "sphinx-build", - "-b", "html", - "-W", # treat warnings as errors - "--keep-going", # continue despite warnings - SOURCE_DIR, - BUILD_DIR -], check=True) - -print(f"HTML documentation has been built in {BUILD_DIR}") \ No newline at end of file +print(f"API documentation has been generated in {output_file}") \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index d796186..58da6d3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,7 +5,7 @@ import os import sys -sys.path.insert(0, os.path.abspath('../../src/bdkpython')) +sys.path.insert(0, os.path.abspath('../../src')) # -- Project information ----------------------------------------------------- From f6edfa5b82b0f86d6d920a2b2f6483a82b915d97 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Wed, 3 Sep 2025 18:24:06 +0200 Subject: [PATCH 07/11] ci: build api docs workflow (cross-os) --- .github/workflows/python-api-docs.yaml | 159 ++++++++++++++++++++++--- docs/generate_docs.py | 2 +- 2 files changed, 143 insertions(+), 18 deletions(-) diff --git a/.github/workflows/python-api-docs.yaml b/.github/workflows/python-api-docs.yaml index c3a0697..7f8d365 100644 --- a/.github/workflows/python-api-docs.yaml +++ b/.github/workflows/python-api-docs.yaml @@ -9,14 +9,21 @@ on: permissions: {} jobs: - build-docs: - name: "Build and Upload API Documentation" + build-manylinux_2_28-x86_64-api-docs: + name: "Build and upload docs on Manylinux 2.28 x86_64" runs-on: ubuntu-24.04 container: image: quay.io/pypa/manylinux_2_28_x86_64 env: PLAT: manylinux_2_28_x86_64 - PYBIN: "/opt/python/cp310-cp310/bin" + PYBIN: "/opt/python/${{ matrix.python }}/bin" + strategy: + matrix: + python: + - cp310-cp310 + - cp311-cp311 + - cp312-cp312 + - cp313-cp313 steps: - name: "Checkout" uses: actions/checkout@v4 @@ -24,36 +31,154 @@ jobs: submodules: recursive persist-credentials: false fetch-depth: 0 - + + - name: "Configure Git safe directory" + run: git config --global --add safe.directory /__w/bdk-python/bdk-python + - name: "Install Rust 1.84.1" uses: actions-rs/toolchain@v1 with: toolchain: 1.84.1 - - name: "Configure Git safe directory" - run: git config --global --add safe.directory /__w/bdk-python/bdk-python - - - name: "Set up Python" + - name: "Generate bdk.py" + run: bash ./scripts/generate-linux.sh + + - name: "Install Sphinx and Theme" + run: ${PYBIN}/pip install sphinx sphinx_rtd_theme + + - name: "Generate python API Documentation" + run: | + ${PYBIN}/python ./docs/generate_docs.py + + - name: "Build HTML Documentation" + run: | + ${PYBIN}/python -m sphinx -b html -W --keep-going docs/source docs/_build/html + - name: "Upload API Docs" + uses: actions/upload-artifact@v4 + with: + name: bdkpython-manylinux_2_28_x86_64-${{ matrix.python }}-api-docs + path: /home/runner/work/bdk-python/bdk-python/docs/_build/html + + build-macos-arm64-api-docs: + name: "Build and upload docs on macOS arm64" + runs-on: macos-14 + strategy: + matrix: + python: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + submodules: recursive + persist-credentials: false + fetch-depth: 0 + + - name: "Install Python" uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: ${{ matrix.python }} + + - name: "Generate bdk.py" + run: bash ./scripts/generate-macos-arm64.sh - name: "Install Sphinx and Theme" - run: | - ${PYBIN}/python -m pip install --upgrade pip - ${PYBIN}/pip install sphinx sphinx_rtd_theme + run: pip3 install sphinx sphinx_rtd_theme - name: "Generate python API Documentation" run: | - bash ./scripts/generate-linux.sh - ${PYBIN}/python docs/generate_docs.py + python3 ./docs/generate_docs.py - name: "Build HTML Documentation" run: | - ${PYBIN}/sphinx-build -b html -W --keep-going docs/source docs/_build/html + python3 -c "import platform; print(platform.machine())" + python3 -m sphinx -b html -W --keep-going -v docs/source docs/_build/html + - name: "Upload API Docs" + uses: actions/upload-artifact@v4 + with: + name: bdkpython-macos-arm64-${{ matrix.python }}-api-docs + path: /Users/runner/work/bdk-python/bdk-python/docs/_build/html + + build-macos-x86_64-api-docs: + name: "Build and upload docs on macOS x86_64" + runs-on: macos-13 + strategy: + matrix: + python: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + submodules: recursive + persist-credentials: false + fetch-depth: 0 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: "Generate bdk.py" + run: bash ./scripts/generate-macos-x86_64.sh + + - name: "Install Sphinx and Theme" + run: pip3 install sphinx sphinx_rtd_theme + + - name: "Generate python API Documentation" + run: | + python3 ./docs/generate_docs.py + - name: "Build HTML Documentation" + run: python3 -m sphinx -b html -W --keep-going docs/source docs/_build/html + + - name: "Upload API Docs" + uses: actions/upload-artifact@v4 + with: + name: bdkpython-macos-x86_64-${{ matrix.python }} + path: /Users/runner/work/bdk-python/bdk-python/docs/_build/html + + build-windows-api-docs: + name: "Build and upload docs on Windows" + runs-on: windows-2022 + strategy: + matrix: + python: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + submodules: recursive + persist-credentials: false + fetch-depth: 0 + + - name: "Install Python" + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: "Generate bdk.py" + run: bash ./scripts/generate-windows.sh + + - name: "Install Sphinx and Theme" + run: pip install sphinx sphinx_rtd_theme + + - name: "Generate python API Documentation" + run: | + python ./docs/generate_docs.py + - name: "Build HTML Documentation" + run: python -m sphinx -b html -W --keep-going docs/source docs/_build/html - name: "Upload API Docs" uses: actions/upload-artifact@v4 with: - name: artifact-python-api-docs - path: /home/runner/work/bdk-python/bdk-python/docs/_build/html \ No newline at end of file + name: bdkpython-windows-${{ matrix.python }} + path: D:\a\bdk-python\bdk-python\docs/_build/html \ No newline at end of file diff --git a/docs/generate_docs.py b/docs/generate_docs.py index bcba1b8..586d0cb 100644 --- a/docs/generate_docs.py +++ b/docs/generate_docs.py @@ -26,7 +26,7 @@ module_path = os.path.relpath(os.path.join(root, file), src_dir) module_path = module_path.replace(os.sep, '.').removesuffix('.py') full_module = f'{package_root}.{module_path}' - with open(os.path.join(root, file), 'r') as f: + with open(os.path.join(root, file), 'r', encoding='utf-8') as f: for line in f: match = class_pattern.match(line) if match: From c7b69de775e8c91939b05dca02fc7d6961817e37 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 5 Sep 2025 17:41:59 +0200 Subject: [PATCH 08/11] ci: remove trigger event used for testing --- .github/workflows/python-api-docs.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-api-docs.yaml b/.github/workflows/python-api-docs.yaml index 7f8d365..2b56ff6 100644 --- a/.github/workflows/python-api-docs.yaml +++ b/.github/workflows/python-api-docs.yaml @@ -1,9 +1,6 @@ name: Build and Upload Python API Docs on: - push: - branches: - - docs/api-docs workflow_dispatch: permissions: {} @@ -53,6 +50,7 @@ jobs: - name: "Build HTML Documentation" run: | ${PYBIN}/python -m sphinx -b html -W --keep-going docs/source docs/_build/html + - name: "Upload API Docs" uses: actions/upload-artifact@v4 with: @@ -96,6 +94,7 @@ jobs: run: | python3 -c "import platform; print(platform.machine())" python3 -m sphinx -b html -W --keep-going -v docs/source docs/_build/html + - name: "Upload API Docs" uses: actions/upload-artifact@v4 with: @@ -174,6 +173,7 @@ jobs: - name: "Generate python API Documentation" run: | python ./docs/generate_docs.py + - name: "Build HTML Documentation" run: python -m sphinx -b html -W --keep-going docs/source docs/_build/html From bf4b7dbf56a9baa25670976ed0e2678734709893 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 5 Sep 2025 17:45:07 +0200 Subject: [PATCH 09/11] docs: add guidelines for building docs --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 5ffdc79..e57499f 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,14 @@ pip3 install ./dist/bdkpython-.whl --force-reinstall python3 -m unittest --verbose ``` + +## Build HTML API Documentation (Optional) + +6. Generate docs +7. Build HTML Documentation + +```sh +python3 ./docs/generate_docs.py + +python3 -m sphinx -b html -W --keep-going -v docs/source docs/_build/html +``` \ No newline at end of file From 5839a9c7a69f0b6483494240d7b4cc383ca05ae2 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Mon, 22 Sep 2025 18:02:59 +0200 Subject: [PATCH 10/11] ci: streamline github workflow by removing multiple OS jobs --- .github/workflows/python-api-docs.yaml | 159 ++----------------------- 1 file changed, 13 insertions(+), 146 deletions(-) diff --git a/.github/workflows/python-api-docs.yaml b/.github/workflows/python-api-docs.yaml index 2b56ff6..560cffe 100644 --- a/.github/workflows/python-api-docs.yaml +++ b/.github/workflows/python-api-docs.yaml @@ -1,4 +1,4 @@ -name: Build and Upload Python API Docs +name: Build Python API Docs on: workflow_dispatch: @@ -6,21 +6,9 @@ on: permissions: {} jobs: - build-manylinux_2_28-x86_64-api-docs: - name: "Build and upload docs on Manylinux 2.28 x86_64" + build-api-docs: + name: "Build bdkpython API docs" runs-on: ubuntu-24.04 - container: - image: quay.io/pypa/manylinux_2_28_x86_64 - env: - PLAT: manylinux_2_28_x86_64 - PYBIN: "/opt/python/${{ matrix.python }}/bin" - strategy: - matrix: - python: - - cp310-cp310 - - cp311-cp311 - - cp312-cp312 - - cp313-cp313 steps: - name: "Checkout" uses: actions/checkout@v4 @@ -36,149 +24,28 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: 1.84.1 - - - name: "Generate bdk.py" - run: bash ./scripts/generate-linux.sh - - - name: "Install Sphinx and Theme" - run: ${PYBIN}/pip install sphinx sphinx_rtd_theme - - - name: "Generate python API Documentation" - run: | - ${PYBIN}/python ./docs/generate_docs.py - - name: "Build HTML Documentation" - run: | - ${PYBIN}/python -m sphinx -b html -W --keep-going docs/source docs/_build/html - - - name: "Upload API Docs" - uses: actions/upload-artifact@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - name: bdkpython-manylinux_2_28_x86_64-${{ matrix.python }}-api-docs - path: /home/runner/work/bdk-python/bdk-python/docs/_build/html - - build-macos-arm64-api-docs: - name: "Build and upload docs on macOS arm64" - runs-on: macos-14 - strategy: - matrix: - python: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - steps: - - name: "Checkout" - uses: actions/checkout@v4 - with: - submodules: recursive - persist-credentials: false - fetch-depth: 0 - - - name: "Install Python" - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} + python-version: "3.12" - name: "Generate bdk.py" - run: bash ./scripts/generate-macos-arm64.sh - - - name: "Install Sphinx and Theme" - run: pip3 install sphinx sphinx_rtd_theme - - - name: "Generate python API Documentation" - run: | - python3 ./docs/generate_docs.py - - - name: "Build HTML Documentation" - run: | - python3 -c "import platform; print(platform.machine())" - python3 -m sphinx -b html -W --keep-going -v docs/source docs/_build/html - - - name: "Upload API Docs" - uses: actions/upload-artifact@v4 - with: - name: bdkpython-macos-arm64-${{ matrix.python }}-api-docs - path: /Users/runner/work/bdk-python/bdk-python/docs/_build/html - - build-macos-x86_64-api-docs: - name: "Build and upload docs on macOS x86_64" - runs-on: macos-13 - strategy: - matrix: - python: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - steps: - - name: "Checkout" - uses: actions/checkout@v4 - with: - submodules: recursive - persist-credentials: false - fetch-depth: 0 - - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - - name: "Generate bdk.py" - run: bash ./scripts/generate-macos-x86_64.sh - - - name: "Install Sphinx and Theme" - run: pip3 install sphinx sphinx_rtd_theme - - - name: "Generate python API Documentation" - run: | - python3 ./docs/generate_docs.py - - name: "Build HTML Documentation" - run: python3 -m sphinx -b html -W --keep-going docs/source docs/_build/html - - - name: "Upload API Docs" - uses: actions/upload-artifact@v4 - with: - name: bdkpython-macos-x86_64-${{ matrix.python }} - path: /Users/runner/work/bdk-python/bdk-python/docs/_build/html - - build-windows-api-docs: - name: "Build and upload docs on Windows" - runs-on: windows-2022 - strategy: - matrix: - python: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - steps: - - name: "Checkout" - uses: actions/checkout@v4 - with: - submodules: recursive - persist-credentials: false - fetch-depth: 0 - - - name: "Install Python" - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - - name: "Generate bdk.py" - run: bash ./scripts/generate-windows.sh + env: + PYBIN: ${{ env.pythonLocation }}/bin + run: bash ./scripts/generate-linux.sh - name: "Install Sphinx and Theme" run: pip install sphinx sphinx_rtd_theme - name: "Generate python API Documentation" - run: | - python ./docs/generate_docs.py + run: python ./docs/generate_docs.py - name: "Build HTML Documentation" - run: python -m sphinx -b html -W --keep-going docs/source docs/_build/html + run: python -m sphinx -b html -W --keep-going docs/source docs/_build/html - name: "Upload API Docs" uses: actions/upload-artifact@v4 with: - name: bdkpython-windows-${{ matrix.python }} - path: D:\a\bdk-python\bdk-python\docs/_build/html \ No newline at end of file + name: artifact-bdkpython-api-docs + path: /home/runner/work/bdk-python/bdk-python/docs/_build/html \ No newline at end of file From 3741c067bf3a0b836aec15d4c9b7441252a3d102 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Mon, 22 Sep 2025 18:03:29 +0200 Subject: [PATCH 11/11] build: add sphinx api-docs build command in justfile --- justfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/justfile b/justfile index b13817f..f03627b 100644 --- a/justfile +++ b/justfile @@ -26,6 +26,11 @@ build: install: pip3 install dist/bdkpython-*.whl --force-reinstall +[group("Build")] +[doc("Build Sphinx api documentation.")] +api-docs: + python3 -m sphinx -b html -W --keep-going -v docs/source docs/_build/html + [group("Submodule")] [doc("Initialize bdk-ffi submodule to committed hash.")] submodule-init: