Skip to content

docs(Python): Docs config #1918

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

Merged
merged 1 commit into from
Jun 3, 2025
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
38 changes: 38 additions & 0 deletions DynamoDbEncryption/runtimes/python/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# .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-22.04
tools:
python: "3.11"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
# Get Dafny.
# readthedocs executes each command in a new shell process, so exported variables aren't persisted between commands.
# Any command that relies on exported variables needs to be executed in one command.
- export dafnyVersion=$(grep '^dafnyVersion=' project.properties | cut -d '=' -f 2) && curl https://github.com/dafny-lang/dafny/releases/download/v$dafnyVersion/dafny-$dafnyVersion-x64-ubuntu-20.04.zip -L -o dafny.zip
- unzip -qq dafny.zip && rm dafny.zip
- export PATH="$PWD/dafny:$PATH" && make transpile_python -C DynamoDbEncryption
post_install:
# Install project with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --directory DynamoDbEncryption/runtimes/python --with docs

# Build documentation in the doc/ directory with Sphinx
sphinx:
configuration: DynamoDbEncryption/runtimes/python/docs/conf.py

# Need all submodules to transpile
submodules:
include: all
recursive: true
72 changes: 72 additions & 0 deletions DynamoDbEncryption/runtimes/python/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
import os
import re
from datetime import datetime
import toml

VERSION_RE = re.compile(r"""__version__ = ['"]([0-9.]+)['"]""")
HERE = os.path.abspath(os.path.dirname(__file__))


def get_release():
with open('../pyproject.toml', 'r') as toml_file:
data = toml.load(toml_file)
return data['tool']['poetry']['version']

def get_version():
"""Reads the version (MAJOR.MINOR) from this module."""
release = get_release()
split_version = release.split(".")
if len(split_version) == 3:
return ".".join(split_version[:2])
return release

project = 'aws-dbesdk-dynamodb-python'
version = get_version()
release = get_release()

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
]
napoleon_include_special_with_doc = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

source_suffix = ".rst" # The suffix of source filenames.
root_doc = "index" # The master toctree document.

copyright = u"%s, Amazon" % datetime.now().year

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ["_build"]

pygments_style = "sphinx"

autoclass_content = "both"
autodoc_default_options = {
"show-inheritance": True,
"undoc-members": True,
'special-members': '__init__',
"members": True
}
autodoc_member_order = "bysource"

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
htmlhelp_basename = "%sdoc" % project

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"http://docs.python.org/": None}

# autosummary
autosummary_generate = True
31 changes: 31 additions & 0 deletions DynamoDbEncryption/runtimes/python/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. include:: ../README.md
:parser: myst_parser.docutils_


*******
Modules
*******

.. autosummary::
:toctree: generated

aws_dbesdk_dynamodb.encrypted.client
aws_dbesdk_dynamodb.encrypted.table
aws_dbesdk_dynamodb.encrypted.item
aws_dbesdk_dynamodb.encrypted.resource
aws_dbesdk_dynamodb.encrypted.paginator
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb.models
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_structuredencryption.models
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.models
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.config


The content below applies to all languages of the AWS DBESDK for DynamoDB.

----

.. include:: ../../../../README.md
:parser: myst_parser.docutils_

.. include:: ../../../../CHANGELOG.md
:parser: myst_parser.docutils_
Loading