Skip to content

Commit

Permalink
Merge pull request #50 from sarnold/sphinx-apidocs
Browse files Browse the repository at this point in the history
add basic sphinx docs build using apidoc
  • Loading branch information
andreasvc authored Sep 12, 2024
2 parents 00ff29d + ba4931b commit aed0536
Show file tree
Hide file tree
Showing 16 changed files with 946 additions and 53 deletions.
20 changes: 13 additions & 7 deletions .gitchangelog.rc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ignore_regexps = [
r'@wip', r'!wip',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:',
r'^([cC]i)\s*:',
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
r'^$', ## ignore commits with empty messages
]
Expand All @@ -85,16 +86,17 @@ section_regexps = [
('New', [
r'^[nN]ew\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
]),
('Features', [
r'^([nN]ew|[fF]eat)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
]),
('Changes', [
r'^[cC]hg\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
]),
('Fix', [
('Fixes', [
r'^[fF]ix\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
]),

('Other', None ## Match all lines
),

]


Expand Down Expand Up @@ -150,7 +152,9 @@ subject_process = (strip |
##
## Tags that will be used for the changelog must match this regexp.
##
tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$'
#tag_filter_regexp = r'^v?[0-9]+\.[0-9]+(\.[0-9]+)?$'
#tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$'
tag_filter_regexp = r'.*?$' # accept funky tag strings


## ``unreleased_version_label`` is a string or a callable that outputs a string
Expand All @@ -160,7 +164,9 @@ tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$'
#unreleased_version_label = "(unreleased)"
unreleased_version_label = lambda: swrap(
["git", "describe", "--tags"],
shell=False)
shell=False,
)


## ``output_engine`` is a callable
##
Expand Down Expand Up @@ -227,7 +233,7 @@ include_merge = True
## Outputs directly to standard output
## (This is the default)
##
## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start())
## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start(), flags)
##
## Creates a callable that will parse given file for the given
## regex pattern and will insert the output in the file.
Expand All @@ -242,7 +248,7 @@ include_merge = True
## take care of everything and might be more complex. Check the README
## for a complete copy-pastable example.
##
# publish = FileInsertIntoFirstRegexMatch(
# publish = FileInsertAtFirstRegexMatch(
# "CHANGELOG.rst",
# r'/(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/',
# idx=lambda m: m.start(1)
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts

# note wheels should be in subdirectories named <artifact_name>
- name: Check number of downloaded artifacts
run: ls -l artifacts/*
run: ls -l artifacts/
79 changes: 48 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,23 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest, windows-latest]
include:
- os: "ubuntu-22.04"
arch: "x86_64"
- os: "ubuntu-22.04"
arch: "aarch64"
- os: "macos-13"
arch: "x86_64"
macosx_deployment_target: "13.0"
- os: "macos-14"
arch: "arm64"
macosx_deployment_target: "14.0"
- os: "windows-latest"
arch: "auto64"
triplet: "x64-windows"
- os: "windows-latest"
arch: "auto32"
triplet: "x86-windows"

steps:
- uses: actions/checkout@v4
Expand All @@ -22,43 +38,41 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

- name: Prepare compiler environment for Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
arch: amd64

- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-cibw.txt
platforms: all

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2010_x86_64:latest
CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2010_i686:latest
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-*
CIBW_SKIP: "*-win32"
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones, plus cross-compile on macos
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_TEST_SKIP: "*_arm64 *universal2:arm64 *linux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2010
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: "*musllinux* *i686"
CIBW_BEFORE_ALL_LINUX: >
yum -y -q --enablerepo=extras install epel-release
&& yum install -y re2-devel ninja-build
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel show {wheel} && auditwheel repair -w {dest_dir} {wheel}"
yum -y update && yum -y install epel-release && yum install -y re2-devel ninja-build
CIBW_BEFORE_ALL_MACOS: >
brew install re2 pybind11 ninja
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.09
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "pip uninstall -y delocate && pip install git+https://github.com/Chia-Network/delocate.git && delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} -v {wheel}"
brew install re2 pybind11
# macos target should be at least 10.13 to get full c++17
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=${{ matrix.macosx_deployment_target }}
CIBW_BEFORE_ALL_WINDOWS: >
vcpkg install re2:x64-windows
vcpkg install pkgconf:${{ matrix.triplet }} re2:${{ matrix.triplet }}
&& vcpkg integrate install
CIBW_ENVIRONMENT_WINDOWS: 'CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake'
CIBW_TEST_COMMAND: python -c "import re2"
run: |
python -m cibuildwheel --output-dir wheelhouse
CIBW_TEST_REQUIRES: ""
CIBW_TEST_COMMAND: ""

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl

build_sdist:
Expand All @@ -70,12 +84,12 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

- name: Build sdist
run: |
pip install pep517
python -m pep517.build -s .
pip install build
python -m build -s .
- uses: actions/upload-artifact@v4
with:
Expand All @@ -99,10 +113,13 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.7
python-version: 3.9

# download all artifacts to project dir
# download all artifacts to artifacts dir
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts

- name: Generate changes file
uses: sarnold/gitchangelog-action@master
Expand All @@ -121,7 +138,7 @@ jobs:
draft: false
prerelease: false
# uncomment below to upload wheels to github releases
files: dist/cibw-wheels/pyre2*.whl
files: artifacts/pyre2*

- uses: pypa/gh-action-pypi-publish@master
if: ${{ github.actor == github.repository_owner && github.ref == 'refs/heads/master' }}
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docs
on:
workflow_dispatch:
pull_request:
push:
branches:
- master

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Ubuntu build deps
run: |
sudo apt-get -qq update
sudo apt-get install -y libre2-dev
- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Add python requirements
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install Ubuntu build deps
run: |
sudo apt-get -qq update
sudo apt-get install -y libre2-dev
- name: Build docs
run: |
tox -e ldocs,docs
- uses: actions/upload-artifact@v4
with:
name: ApiDocsHTML
path: "docs/_build/html/"

- name: set nojekyll for github
run: |
touch docs/_build/html/.nojekyll
- name: Deploy docs to gh-pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html/
single-commit: true
49 changes: 48 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,54 @@ src/*.html
tests/*.so
tests/access.log
*~
*.so
*.pyc
*.swp
*.egg-info

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Sphinx documentation
docs/_build/
docs/source/api/

Loading

0 comments on commit aed0536

Please sign in to comment.