Skip to content

Commit b1d4ea6

Browse files
lucasmcdonald3Lucas McDonald
and
Lucas McDonald
authored
docs(Python): Docs config (#1918)
Co-authored-by: Lucas McDonald <[email protected]>
1 parent 3b76f86 commit b1d4ea6

File tree

3 files changed

+141
-0
lines changed

3 files changed

+141
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
jobs:
14+
post_create_environment:
15+
# Install poetry
16+
# https://python-poetry.org/docs/#installing-manually
17+
- pip install poetry
18+
# Get Dafny.
19+
# readthedocs executes each command in a new shell process, so exported variables aren't persisted between commands.
20+
# Any command that relies on exported variables needs to be executed in one command.
21+
- 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
22+
- unzip -qq dafny.zip && rm dafny.zip
23+
- export PATH="$PWD/dafny:$PATH" && make transpile_python -C DynamoDbEncryption
24+
post_install:
25+
# Install project with 'docs' dependency group
26+
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
27+
# VIRTUAL_ENV needs to be set manually for now.
28+
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
29+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --directory DynamoDbEncryption/runtimes/python --with docs
30+
31+
# Build documentation in the doc/ directory with Sphinx
32+
sphinx:
33+
configuration: DynamoDbEncryption/runtimes/python/docs/conf.py
34+
35+
# Need all submodules to transpile
36+
submodules:
37+
include: all
38+
recursive: true
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# -*- coding: utf-8 -*-
2+
import os
3+
import re
4+
from datetime import datetime
5+
import toml
6+
7+
VERSION_RE = re.compile(r"""__version__ = ['"]([0-9.]+)['"]""")
8+
HERE = os.path.abspath(os.path.dirname(__file__))
9+
10+
11+
def get_release():
12+
with open('../pyproject.toml', 'r') as toml_file:
13+
data = toml.load(toml_file)
14+
return data['tool']['poetry']['version']
15+
16+
def get_version():
17+
"""Reads the version (MAJOR.MINOR) from this module."""
18+
release = get_release()
19+
split_version = release.split(".")
20+
if len(split_version) == 3:
21+
return ".".join(split_version[:2])
22+
return release
23+
24+
project = 'aws-dbesdk-dynamodb-python'
25+
version = get_version()
26+
release = get_release()
27+
28+
# Add any Sphinx extension module names here, as strings. They can be extensions
29+
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
30+
extensions = [
31+
"sphinx.ext.autodoc",
32+
"sphinx.ext.doctest",
33+
"sphinx.ext.intersphinx",
34+
"sphinx.ext.todo",
35+
"sphinx.ext.coverage",
36+
"sphinx.ext.autosummary",
37+
"sphinx.ext.napoleon",
38+
]
39+
napoleon_include_special_with_doc = False
40+
41+
# Add any paths that contain templates here, relative to this directory.
42+
templates_path = ["_templates"]
43+
44+
source_suffix = ".rst" # The suffix of source filenames.
45+
root_doc = "index" # The master toctree document.
46+
47+
copyright = u"%s, Amazon" % datetime.now().year
48+
49+
# List of directories, relative to source directory, that shouldn't be searched
50+
# for source files.
51+
exclude_trees = ["_build"]
52+
53+
pygments_style = "sphinx"
54+
55+
autoclass_content = "both"
56+
autodoc_default_options = {
57+
"show-inheritance": True,
58+
"undoc-members": True,
59+
'special-members': '__init__',
60+
"members": True
61+
}
62+
autodoc_member_order = "bysource"
63+
64+
html_theme = "sphinx_rtd_theme"
65+
html_static_path = ["_static"]
66+
htmlhelp_basename = "%sdoc" % project
67+
68+
# Example configuration for intersphinx: refer to the Python standard library.
69+
intersphinx_mapping = {"http://docs.python.org/": None}
70+
71+
# autosummary
72+
autosummary_generate = True
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. include:: ../README.md
2+
:parser: myst_parser.docutils_
3+
4+
5+
*******
6+
Modules
7+
*******
8+
9+
.. autosummary::
10+
:toctree: generated
11+
12+
aws_dbesdk_dynamodb.encrypted.client
13+
aws_dbesdk_dynamodb.encrypted.table
14+
aws_dbesdk_dynamodb.encrypted.item
15+
aws_dbesdk_dynamodb.encrypted.resource
16+
aws_dbesdk_dynamodb.encrypted.paginator
17+
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb.models
18+
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_structuredencryption.models
19+
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.models
20+
aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.config
21+
22+
23+
The content below applies to all languages of the AWS DBESDK for DynamoDB.
24+
25+
----
26+
27+
.. include:: ../../../../README.md
28+
:parser: myst_parser.docutils_
29+
30+
.. include:: ../../../../CHANGELOG.md
31+
:parser: myst_parser.docutils_

0 commit comments

Comments
 (0)