Skip to content

Commit

Permalink
Added documentation using Sphinx and Read the Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Aug 11, 2024
1 parent e9f17e9 commit 998ce02
Show file tree
Hide file tree
Showing 19 changed files with 424 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/build
/.coverage
/coverage.xml
/doc/_build
/dist
/.idea
/.venv*
Expand Down
29 changes: 29 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .readthedocs.yml
# Read the Docs configuration file

# Details
# - https://docs.readthedocs.io/en/stable/config-file/v2.html

# Required
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
install:
- method: pip
path: .
extra_requirements:
- doc

sphinx:
configuration: doc/conf.py
builder: html
fail_on_warning: true

# Optionally build your docs in additional formats such as PDF
#formats:
# - pdf
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Added documentation using Sphinx and Read the Docs

## 2024/08/05 v0.0.3
- Added transformer for AWS DMS to CrateDB SQL
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ Data decoding, encoding, conversion, and translation utilities.
>
> -- https://en.wikipedia.org/wiki/Codec
## Details
A collection of reusable utilities with minimal dependencies for transcoding
purposes, mostly collected from other projects like [Kotori] and [LorryStream],
in order to provide them per standalone package for broader use cases.
## What's Inside
- **Decoders:** A collection of reusable utilities with minimal dependencies for
transcoding purposes, mostly collected from other projects like
[Kotori](https://kotori.readthedocs.io/) and [LorryStream](https://lorrystream.readthedocs.io/),
in order to provide them per standalone package for broader use cases.

- Transformers for [Change Data Capture (CDC)] messages to SQL statements.

## Installation
The package is available from [PyPI] at [commons-codec].
Expand All @@ -43,14 +46,13 @@ and explore the source code or its [examples].
Kudos to the authors of all the many software components this library is
vendoring and building upon.

### Prior Art
- [core-cdc] by Alejandro Cora González. Cheers!
### Similar Projects
See [prior art].

### Contributing
The `commons-codec` package is an open source project, and is
[managed on GitHub](https://github.com/daq-tools/commons-codec).
The project is still in its infancy, and we appreciate contributions
of any kind.
[managed on GitHub]. The project is still in its infancy, and
we appreciate contributions of any kind.

### Etymology
The [Apache Commons Codec] library was the inspiration for the name. Otherwise,
Expand All @@ -65,10 +67,10 @@ within the header sections of relevant files.


[Apache Commons Codec]: https://commons.apache.org/proper/commons-codec/
[Change Data Capture (CDC)]: https://en.wikipedia.org/wiki/Change_data_capture
[commons-codec]: https://pypi.org/project/commons-codec/
[core-cdc]: https://pypi.org/project/core-cdc/
[documentation]: https://github.com/daq-tools/commons-codec/tree/main/docs
[documentation]: https://commons-codec.readthedocs.io/
[examples]: https://github.com/daq-tools/commons-codec/tree/main/examples
[Kotori]: https://github.com/daq-tools/kotori
[LorryStream]: https://github.com/daq-tools/lorrystream/
[managed on GitHub]: https://github.com/daq-tools/commons-codec
[prior art]: https://commons-codec.readthedocs.io/prior-art.html
[PyPI]: https://pypi.org/
20 changes: 20 additions & 0 deletions doc/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 doc/_static/.gitkeep
Empty file.
Empty file added doc/_templates/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion docs/backlog.md → doc/backlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [x] Release v0.0.2

## Iteration +2
- [ ] Performance: Batching!
- [ ] Performance: Batching!?
- [ ] MongoDB: Implement stream resumption using `start_after`
- [ ] Feature: Filter by events, e.g. Ignore "delete" events?
- [ ] Integration Testing the "example" programs?
30 changes: 30 additions & 0 deletions doc/cdc/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Change Data Capture (CDC)

`commons-codec` includes CDC -> SQL transformer components for AWS DMS,
DynamoDB, and MongoDB.

## DynamoDB
- Blog: [Replicating CDC Events from DynamoDB to CrateDB]
- Documentation: [DynamoDB CDC Relay for CrateDB]

## MongoDB
- Introduction: [](project:#mongodb-cdc)
- Documentation: [MongoDB CDC Relay for CrateDB]


```{toctree}
:hidden:
mongodb
```


:::{note}
Please note relevant components are still in their infancy (beta),
and need further curation and improvements.
:::


[DynamoDB CDC Relay for CrateDB]: https://cratedb-toolkit.readthedocs.io/io/dynamodb/cdc.html
[MongoDB CDC Relay for CrateDB]: https://cratedb-toolkit.readthedocs.io/io/mongodb/cdc.html
[Replicating CDC Events from DynamoDB to CrateDB]: https://cratedb.com/blog/replicating-cdc-events-from-dynamodb-to-cratedb
1 change: 1 addition & 0 deletions docs/mongodb.md → doc/cdc/mongodb.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(mongodb-cdc)=
# Relay MongoDB Change Stream into CrateDB

## About
Expand Down
1 change: 1 addition & 0 deletions doc/changes.md
130 changes: 130 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# 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

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

# ruff: noqa: ERA001

project = "commons-codec"
copyright = "2019-2024, The Panodata Developers" # noqa: A001
author = "The Panodata Developers"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"myst_parser",
"sphinx_copybutton",
"sphinx_design",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.ifconfig",
"sphinxcontrib.mermaid",
"sphinxext.opengraph",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "furo"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.

html_title = "commons-codec"

html_theme_options = {
"sidebar_hide_name": False,
# https://github.com/pradyunsg/furo/blob/main/src/furo/assets/styles/variables/_colors.scss
# "light_logo": "logo-light.svg",
# "dark_logo": "logo-dark.svg",
# #CC3333 is persian red.
"light_css_variables": {
"color-brand-primary": "darkcyan",
"color-brand-content": "darkblue",
# "color-admonition-background": "orange",
},
"dark_css_variables": {
"color-brand-primary": "darkcyan",
"color-brand-content": "lightblue",
# "color-admonition-background": "orange",
},
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}

html_show_sourcelink = True


# -- Intersphinx ----------------------------------------------------------

intersphinx_mapping = {
# "influxio": ("https://influxio.readthedocs.io/", None),
}
linkcheck_ignore = []

# Disable caching remote inventories completely.
# http://www.sphinx-doc.org/en/stable/ext/intersphinx.html#confval-intersphinx_cache_limit
# intersphinx_cache_limit = 0


# -- Extension configuration -------------------------------------------------

sphinx_tabs_valid_builders = ["linkcheck"]
todo_include_todos = True

# Configure sphinx-copybutton
copybutton_remove_prompts = True
copybutton_line_continuation_character = "\\"
copybutton_prompt_text = r">>> |\.\.\. |\$ |sh\$ |PS> |cr> |mysql> |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
copybutton_prompt_is_regexp = True

# Configure sphinxext-opengraph
ogp_site_url = "https://commons-codec.readthedocs.io/"
ogp_enable_meta_description = True
# ogp_image = "http://example.org/image.png"
# ogp_description_length = 300


# -- Options for MyST -------------------------------------------------

myst_heading_anchors = 3
myst_enable_extensions = [
"attrs_block",
"attrs_inline",
"colon_fence",
"deflist",
"fieldlist",
"html_admonition",
"html_image",
"linkify",
"replacements",
"strikethrough",
"substitution",
"tasklist",
]
myst_substitutions = {}
27 changes: 27 additions & 0 deletions doc/decode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Various Decoders

`commons-codec` includes telemetry data decoders for individual popular sensor
appliances.

## Sensor.Community

- Air quality measurement appliances of [Sensor.Community].

Example: [Kotori Sensor.Community integration]

- [Tasmota open source firmware for ESP devices].

Example: [Kotori Tasmota integration]

- Devices connected to [The Things Stack (TTS)] / [The Things Network (TTN)].

Example: [Kotori TTN/TTS integration]


[Kotori Sensor.Community integration]: https://kotori.readthedocs.io/en/latest/integration/airrohr.html
[Kotori Tasmota integration]: https://kotori.readthedocs.io/en/latest/integration/tasmota.html
[Kotori TTN/TTS integration]: https://kotori.readthedocs.io/en/latest/integration/tts-ttn.html
[Sensor.Community]: https://sensor.community/
[Tasmota open source firmware for ESP devices]: https://tasmota.github.io/
[The Things Stack (TTS)]: https://www.thethingsindustries.com/docs/
[The Things Network (TTN)]: https://www.thethingsnetwork.org/
26 changes: 26 additions & 0 deletions doc/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Development Sandbox

Acquire source code, install development sandbox, and invoke software tests.
```shell
git clone https://github.com/daq-tools/commons-codec
cd commons-codec
python3 -m venv .venv
source .venv/bin/activate
pip install --editable='.[all,develop,doc,test]'
poe check
```

Format code.
```shell
poe format
```

Run linter.
```shell
poe lint
```

Build documentation, with live-reloading.
```shell
poe docs-autobuild
```
Loading

0 comments on commit 998ce02

Please sign in to comment.