Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,28 @@ jobs:
uv run pytest --cov
uv run coveralls

docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v5
with:
python-version-file: ".python-version"
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
with:
version: "0.7.12"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Build docs
uv run script/docs

checks:
name: Checks
needs: [lint, test]
needs: [lint, test, docs]
runs-on: ubuntu-latest
permissions:
issues: write
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ htmlcov/

# Sphinx
docs/_build
docs/_output

# Cursor
.cursorrules
1 change: 1 addition & 0 deletions docs/_static/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pytool"
version = "6.0.1"
description = "Pytool is a collection of utilities and language enhancements for Python"
readme = "README.md"
license = {text = "MIT"}
license = "MIT"
authors = [
{name = "Jacob Alheid", email = "shakefu@gmail.com"},
]
Expand All @@ -30,3 +30,7 @@ docs = [
"sphinx-rtd-theme >=2.0.0, <3.0.0",
"sphinx-autodoc-typehints >=1.25.2, <2.0.0",
]

# This is required so setuptools doesn't see "script" as a package
[tool.setuptools]
packages = ["pytool"]
4 changes: 2 additions & 2 deletions pytool/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def as_json(obj, **kwargs):
:class:`bson.ObjectId`.

:param object obj: An object to encode.
:param \*\*kwargs: Any optional keyword arguments to pass to the \
JSONEncoder
:param kwargs: Any optional keyword arguments to pass to the \
JSONEncoder
:returns: JSON encoded version of `obj`.

.. versionadded:: 2.4
Expand Down
20 changes: 20 additions & 0 deletions script/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

# This script will install the project and all its dependencies into a virtual
# environment and then build the documentation.
#
# It maintains parity with the Read the Docs build process.

# Use a separate venv from the main development venv
# shellcheck disable=SC2034
UV_PROJECT_ENVIRONMENT="${UV_PROJECT_ENVIRONMENT:-./docs/.venv/}"

# Create a virtual environment for the documentation
uv venv "${UV_PROJECT_ENVIRONMENT}"

# Install the project and all its dependencies into the virtual environment
uv sync --frozen --all-extras --all-groups --no-editable --link-mode=copy
uv pip install --link-mode=copy .

# Build the documentation, failing on warnings
uv run python -m sphinx -T -W --keep-going -b html -d ./docs/_build/doctrees -D language=en ./docs ./docs/_output
Loading