-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Sphinx documentation setup and initial content
- Created build_docs.sh script for building documentation. - Added requirements.txt for Sphinx and related packages. - Configured Sphinx in conf.py with necessary extensions and settings. - Created index.rst with project overview, installation, usage, and API documentation structure. - Documented core components and configuration models in separate .rst files. - Implemented autodoc for GitHubClient, TemplateManager, and data models. - Added initial models for GitHub configuration, workflow configuration, PR configuration, and template input. - Developed TemplateManager class for handling template rendering and configuration. - Added Jinja2 templates for Ansible and Terraform workflows. - Created ROADMAP.md for future IAM access rules discussion.
- Loading branch information
Dave Arnold
committed
May 1, 2025
1 parent
9bd1e83
commit d4c2207
Showing
16 changed files
with
966 additions
and
956 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # Ensure we're in the project root | ||
| cd "$(dirname "$0")/.." | ||
|
|
||
| # Create and activate virtual environment if it doesn't exist | ||
| if [ ! -d "docs/venv" ]; then | ||
| python3 -m venv docs/venv | ||
| fi | ||
| source docs/venv/bin/activate | ||
|
|
||
| # Install dependencies and package in development mode | ||
| pip install -r docs/requirements.txt | ||
| pip install -e . | ||
|
|
||
| # Create documentation directories | ||
| mkdir -p docs/source/_static | ||
| mkdir -p docs/build | ||
|
|
||
| # Generate documentation | ||
| cd docs | ||
| sphinx-build -b html source build | ||
|
|
||
| echo "Documentation built successfully in docs/build/index.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| sphinx | ||
| sphinx_rtd_theme | ||
| sphinx-autodoc-typehints | ||
| pydantic~=2.6 | ||
| boto3>=1.38.6 | ||
| requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Configuration file for the Sphinx documentation builder. | ||
|
|
||
| # -- Project information ----------------------------------------------------- | ||
| project = 'Template Automation Lambda' | ||
| copyright = '2025, Template Automation Team' | ||
| author = 'Template Automation Team' | ||
| release = '1.0.0' | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| extensions = [ | ||
| 'sphinx.ext.autodoc', | ||
| 'sphinx.ext.napoleon', # Support for Google-style docstrings | ||
| 'sphinx.ext.viewcode', # Add links to source code | ||
| 'sphinx.ext.intersphinx', # Link to other project's documentation | ||
| 'sphinx_autodoc_typehints', # Support for type hints | ||
| ] | ||
|
|
||
| # -- Options for autodoc ---------------------------------------------------- | ||
| autodoc_default_options = { | ||
| 'members': True, | ||
| 'undoc-members': True, | ||
| 'show-inheritance': True, | ||
| 'special-members': '__init__', | ||
| } | ||
|
|
||
| # Napoleon settings for Google-style docstrings | ||
| napoleon_google_docstring = True | ||
| napoleon_numpy_docstring = False | ||
| napoleon_include_init_with_doc = True | ||
| napoleon_include_private_with_doc = True | ||
| napoleon_include_special_with_doc = True | ||
| napoleon_use_admonition_for_examples = True | ||
| napoleon_use_admonition_for_notes = True | ||
| napoleon_use_admonition_for_references = True | ||
| napoleon_use_ivar = False | ||
| napoleon_use_param = True | ||
| napoleon_use_rtype = True | ||
| napoleon_type_aliases = None | ||
|
|
||
| # -- Options for HTML output ------------------------------------------------- | ||
| html_theme = 'sphinx_rtd_theme' | ||
| html_static_path = ['_static'] | ||
|
|
||
| # Intersphinx mapping | ||
| intersphinx_mapping = { | ||
| 'python': ('https://docs.python.org/3', None), | ||
| 'boto3': ('https://boto3.amazonaws.com/v1/documentation/api/latest', None), | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| Template Automation Lambda Documentation | ||
| ===================================== | ||
|
|
||
| Welcome to the Template Automation Lambda documentation. This system provides a flexible | ||
| template automation framework for creating and configuring repositories from templates. | ||
|
|
||
| Quick Start | ||
| ---------- | ||
|
|
||
| The Template Automation Lambda is an AWS Lambda function that automates the process of creating | ||
| repositories from templates. It handles: | ||
|
|
||
| - Repository creation from templates | ||
| - Template rendering with variable substitution | ||
| - Pull request creation with customizable settings | ||
| - Workflow automation triggers | ||
|
|
||
| Installation | ||
| ----------- | ||
|
|
||
| To install the package and its dependencies: | ||
|
|
||
| .. code-block:: bash | ||
| pip install -r requirements.txt | ||
| pip install -e . | ||
| Usage | ||
| ----- | ||
|
|
||
| Basic usage example: | ||
|
|
||
| .. code-block:: python | ||
| from template_automation.app import lambda_handler | ||
| event = { | ||
| "project_name": "my-new-repo", | ||
| "owning_team": "devops", | ||
| "template_settings": { | ||
| "variables": { | ||
| "environment": "prod", | ||
| "region": "us-west-2" | ||
| } | ||
| } | ||
| } | ||
| lambda_handler(event, {}) | ||
| API Documentation | ||
| --------------- | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 2 | ||
| :caption: Contents: | ||
|
|
||
| modules/github_client | ||
| modules/template_manager | ||
| modules/models | ||
| modules/lambda_handler | ||
|
|
||
| Core Components | ||
| ------------- | ||
|
|
||
| - :doc:`modules/github_client` - GitHub API interaction for repository and PR management | ||
| - :doc:`modules/template_manager` - Template rendering and configuration handling | ||
| - :doc:`modules/models` - Pydantic data models for input validation | ||
| - :doc:`modules/lambda_handler` - AWS Lambda function entry point | ||
|
|
||
| Configuration | ||
| ------------ | ||
|
|
||
| The system uses several configuration models: | ||
|
|
||
| - **GitHubConfig**: GitHub API and authentication settings | ||
| - **WorkflowConfig**: Template workflow configuration | ||
| - **PRConfig**: Pull request settings | ||
| - **TemplateInput**: Input parameters for template processing | ||
|
|
||
| Environment Variables | ||
| ------------------- | ||
|
|
||
| Required environment variables: | ||
|
|
||
| - ``GITHUB_TOKEN``: GitHub Personal Access Token | ||
| - ``GITHUB_ORG``: GitHub Organization name | ||
| - ``TEMPLATE_REPO``: Template repository name | ||
|
|
||
| Indices and tables | ||
| ================== | ||
|
|
||
| * :ref:`genindex` | ||
| * :ref:`modindex` | ||
| * :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| GitHub Client | ||
| ============= | ||
|
|
||
| .. automodule:: template_automation.app | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
| GitHubClient Class | ||
| ---------------- | ||
|
|
||
| .. autoclass:: template_automation.app.GitHubClient | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
| :special-members: __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Lambda Handler | ||
| ============= | ||
|
|
||
| .. automodule:: template_automation.app | ||
| :members: lambda_handler, operate_github, generate_repository_name, get_parameter | ||
| :undoc-members: | ||
| :show-inheritance: |
Oops, something went wrong.