Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: introduce sphinx build, readthedocs, and docs workflow #81

Merged
merged 59 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a622fa3
docs: add Sphinx documentation setup with configuration files and dep…
yxlao Dec 28, 2024
7d2508b
chore: remove redundant comment in .readthedocs.yaml for cleaner conf…
yxlao Dec 28, 2024
6e3c9ed
docs(README.md): add instructions for building and viewing documentat…
yxlao Dec 28, 2024
1b87ad4
docs: switch from sphinx_rtd_theme to furo theme for improved documen…
yxlao Dec 28, 2024
9911fcc
docs: add contributing, coordinates, features, and installation docum…
yxlao Dec 28, 2024
41d0bd6
style(docs): fix section underline lengths for consistency across doc…
yxlao Dec 28, 2024
51ac220
docs(camtools): improve docstrings for clarity and consistency across…
yxlao Dec 28, 2024
c18bb03
docs: improve docstrings for clarity and consistency across camtools …
yxlao Dec 28, 2024
94fbf78
docs: update documentation build instructions and improve code commen…
yxlao Dec 28, 2024
04f98a5
docs(raycast.py): clarify distance vs depth image definitions and add…
yxlao Dec 28, 2024
7e4aa83
ci: add GitHub workflow for building and deploying documentation on p…
yxlao Dec 28, 2024
25f5db3
ci(docs): streamline documentation build process by using `[docs]` ex…
yxlao Dec 28, 2024
a81124a
style: reformat code for improved readability and line length consist…
yxlao Dec 28, 2024
d532780
revert to original python code
yxlao Dec 28, 2024
3c4b5af
chore(docs.yml): remove SPHINXOPTS from documentation build command t…
yxlao Dec 28, 2024
cf9e01e
revert to original python code test
yxlao Dec 28, 2024
a846643
chore(pyproject.toml): remove black configuration as it is no longer …
yxlao Dec 28, 2024
38a5b5d
chore(.gitignore): add docs/_static/ and docs/_templates/ to ignore l…
yxlao Dec 28, 2024
11c90c5
docs(index.rst): reorder sections in the table of contents to improve…
yxlao Dec 28, 2024
598ec3c
docs(index.rst): update API documentation reference path from 'api/mo…
yxlao Dec 28, 2024
2924265
docs: add API reference documentation and update Sphinx configuration
yxlao Dec 28, 2024
ec5516f
docs(api.rst, conf.py): update module references from 'camtools' to '…
yxlao Dec 28, 2024
9be654b
docs(api.rst): add table of contents to improve navigation and readab…
yxlao Dec 28, 2024
fd95627
chore: remove docs/api from .gitignore as it is no longer needed
yxlao Dec 28, 2024
5b49be2
docs(index.rst): update toctree structure, rename 'Contents' to 'Docs…
yxlao Dec 28, 2024
448c879
docs(api.rst): restructure and align section headers for improved rea…
yxlao Dec 28, 2024
91c8d12
refactor(docs): restructure API documentation into modular files for …
yxlao Dec 28, 2024
ce987bf
docs(index.rst): add 'Home <self>' to the table of contents for bette…
yxlao Dec 28, 2024
68f50c7
docs(api.rst): reorder API reference sections for better organization…
yxlao Dec 28, 2024
d4790c7
docs: consolidate API reference into a single file and remove individ…
yxlao Dec 28, 2024
d31a597
docs(api.rst): add table of contents and internal references for bett…
yxlao Dec 28, 2024
53e00ce
docs(api.rst): format section headers with backticks for consistency …
yxlao Dec 28, 2024
a9a55bc
docs(index.rst): simplify indices section by removing modindex and se…
yxlao Dec 28, 2024
8a83030
docs(README.md): simplify documentation build commands by using `-C` …
yxlao Dec 28, 2024
c529c76
refactor(docs): restructure API reference into separate files for bet…
yxlao Dec 28, 2024
512b8ab
docs: restructure API documentation by moving modules into an api sub…
yxlao Dec 28, 2024
c9357cc
chore(docs): add empty .gitkeep file to maintain docs/_static directo…
yxlao Dec 28, 2024
02ad749
docs(api): fix section header formatting in API documentation files t…
yxlao Dec 28, 2024
ca3b7ac
refactor(docs): consolidate features.rst content into index.rst for b…
yxlao Dec 28, 2024
170ba87
docs: update configuration and improve documentation structure
yxlao Dec 28, 2024
f479b73
docs(README.md): add Read the Docs badge to indicate documentation st…
yxlao Dec 28, 2024
2a32721
docs(README.md): add new documentation badge with improved styling fo…
yxlao Dec 28, 2024
c1fcd2b
docs(README.md): standardize badge labels to lowercase for consistenc…
yxlao Dec 28, 2024
bfda6c4
Revert "docs(README.md): standardize badge labels to lowercase for co…
yxlao Dec 28, 2024
bc89266
chore(README.md): remove duplicate Docs badge to clean up documentati…
yxlao Dec 28, 2024
430a429
docs(README.md): reorder badges to improve readability and consistency
yxlao Dec 28, 2024
3d02dc5
docs: update README.md with navigation links and remove redundant badges
yxlao Dec 28, 2024
5d5e8d7
docs(README.md): improve formatting and add link to camera coordinate…
yxlao Dec 28, 2024
0d956c8
docs(README.md): remove "Camera Coordinates" link from navigation for…
yxlao Dec 28, 2024
e0b81b1
chore: remove extra blank line in README.md for consistency and clean…
yxlao Dec 28, 2024
c92e094
fix(docs/conf.py): decode file content as utf-8 when reading pyprojec…
yxlao Dec 28, 2024
0e83bd9
refactor(docs): simplify version retrieval by using camtools package …
yxlao Dec 28, 2024
5f491e3
chore(docs/conf.py): remove unused import of camtools module to clean…
yxlao Dec 28, 2024
f208cf0
docs(api): restructure and expand API documentation with new modules …
yxlao Dec 28, 2024
acfd0f1
docs: remove unused API documentation files and suppress toctree warn…
yxlao Dec 28, 2024
c554a56
docs: add repo link to README and update documentation header in inde…
yxlao Dec 28, 2024
2191080
chore: rename GitHub workflow from 'Documentation' to 'Docs' for brevity
yxlao Dec 28, 2024
c45bd1a
docs: add camera.rst documentation and update index.rst to reference it
yxlao Dec 28, 2024
5b774a8
docs(index.rst): remove installation link from documentation index to…
yxlao Dec 28, 2024
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
37 changes: 37 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docs

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[docs]

- name: Build documentation
run: |
cd docs
make clean && make html # SPHINXOPTS="-W --keep-going"

- name: Notice
run: |
echo "Documentation build successful!"
echo "After merging this PR, you can view the latest documentation at:"
echo "- Public docs: https://camtools.readthedocs.io/en/latest/"
echo "- Admin panel: https://app.readthedocs.org/projects/camtools/"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ instance/

# Sphinx documentation
docs/_build/
.doctrees
.buildinfo

# PyBuilder
target/
Expand Down
28 changes: 28 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# .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 OS, Python version and other tools you might need
build:
os: ubuntu-24.04
tools:
python: "3.10"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally declare the Python requirements required to build your docs
python:
install:
- method: pip
path: .
extra_requirements:
- docs

# Optionally build your docs in additional formats such as PDF
formats:
- pdf
44 changes: 40 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
<img alt="CamTools Logo" src="https://raw.githubusercontent.com/yxlao/camtools/main/camtools/assets/camtools_logo_light.png" width="360">
</picture>
</p>

<h1 align="center">CamTools: Camera Tools for Computer Vision</h1>

<p align="center">
<a href="https://camtools.readthedocs.io/"><strong>Docs</strong></a> |
<a href="https://github.com/yxlao/camtools"><strong>Repo</strong></a> |
<a href="#installation"><strong>Installation</strong></a>
</p>

[![Formatter](https://github.com/yxlao/camtools/actions/workflows/formatter.yml/badge.svg)](https://github.com/yxlao/camtools/actions/workflows/formatter.yml)
[![Unit Test](https://github.com/yxlao/camtools/actions/workflows/unit_test.yml/badge.svg)](https://github.com/yxlao/camtools/actions/workflows/unit_test.yml)
[![PyPI](https://github.com/yxlao/camtools/actions/workflows/pypi.yml/badge.svg)](https://github.com/yxlao/camtools/actions/workflows/pypi.yml)
[![GitHub](https://img.shields.io/badge/GitHub-323940.svg?style=flat&logo=github&logoColor=959DA5)](https://github.com/yxlao/camtools)
[![Gitee](https://img.shields.io/badge/Gitee-323940.svg?style=flat&logo=gitee&logoColor=959DA5)](https://gitee.com/yxlao/camtools)
[![PyPI](https://img.shields.io/pypi/v/camtools?style=flat&label=PyPI&logo=PyPI&logoColor=959DA5&labelColor=323940&color=808080)](https://pypi.org/project/camtools)
[![Docs](https://readthedocs.org/projects/camtools/badge/?version=latest)](https://camtools.readthedocs.io/en/latest/?badge=latest)

CamTools is a collection of tools for handling cameras in computer vision. It
can be used for plotting, converting, projecting, ray casting, and doing more
Expand All @@ -20,8 +26,13 @@ clear and easy-to-use APIs.

<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/yxlao/camtools/main/camtools/assets/camera_coordinates_dark.png">
<img alt="CamTools Logo" src="https://raw.githubusercontent.com/yxlao/camtools/main/camtools/assets/camera_coordinates_light.png" width="520">
<source
media="(prefers-color-scheme: dark)"
srcset="https://raw.githubusercontent.com/yxlao/camtools/main/camtools/assets/camera_coordinates_dark.png">
<img
alt="CamTools Logo"
src="https://raw.githubusercontent.com/yxlao/camtools/main/camtools/assets/camera_coordinates_light.png"
width="520">
</picture>
</p>

Expand Down Expand Up @@ -251,6 +262,31 @@ the beginning of the README.
[part 2](https://ksimek.github.io/2012/08/22/extrinsic/),
and [part 3](https://ksimek.github.io/2013/08/13/intrinsic/).

## Building Documentation

To build and view the documentation locally:

```bash
# Install documentation dependencies
pip install -e .[docs]

# Build the documentation
make -C docs clean && make -C docs html

# (Optional) Build the documentation with warnings as errors
make -C docs clean && make -C docs html SPHINXOPTS="-W --keep-going"

# Start a local server to view the documentation
python -m http.server 8000 --directory docs/_build/html
```

Then open your browser and navigate to `http://localhost:8000` to view the documentation.

The documentation is also automatically built by GitHub Actions on pull requests and pushes to main. After merging to main, you can view:

- Public documentation at https://camtools.readthedocs.io/en/latest/
- Admin panel at https://app.readthedocs.org/projects/camtools/

## Contributing

- Follow [Angular's commit message convention](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format) for PRs.
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Empty file added docs/_static/.gitkeep
Empty file.
26 changes: 26 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
API Reference
============

.. toctree::
:maxdepth: 1

api/camera
api/colormap
api/convert
api/geometry
api/image
api/io
api/metric
api/normalize
api/project
api/raycast
api/render
api/solver
api/transform


.. Not included in the docs website:
.. api/artifact
.. api/colmap
.. api/sanity
.. api/util
9 changes: 9 additions & 0 deletions docs/api/camera.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.camera
=========

.. currentmodule:: ct

.. automodule:: ct.camera
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/colormap.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.colormap
===========

.. currentmodule:: ct

.. automodule:: ct.colormap
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/convert.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.convert
==========

.. currentmodule:: ct

.. automodule:: ct.convert
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/geometry.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.geometry
===========

.. currentmodule:: ct

.. automodule:: ct.geometry
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/image.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.image
========

.. currentmodule:: ct

.. automodule:: ct.image
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/io.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.io
=======

.. currentmodule:: ct

.. automodule:: ct.io
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/metric.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.metric
=========

.. currentmodule:: ct

.. automodule:: ct.metric
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/normalize.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.normalize
===========

.. currentmodule:: ct

.. automodule:: ct.normalize
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/project.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.project
==========

.. currentmodule:: ct

.. automodule:: ct.project
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/raycast.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.raycast
==========

.. currentmodule:: ct

.. automodule:: ct.raycast
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/render.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.render
=========

.. currentmodule:: ct

.. automodule:: ct.render
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/solver.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.solver
=========

.. currentmodule:: ct

.. automodule:: ct.solver
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/api/transform.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ct.transform
===========

.. currentmodule:: ct

.. automodule:: ct.transform
:members:
:undoc-members:
:show-inheritance:
Loading
Loading