Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
YeisonCardona committed Feb 21, 2024
1 parent 3fa5aae commit 744acca
Show file tree
Hide file tree
Showing 43 changed files with 2,001 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/automated-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# .github/workflows

name: Automated Setup Generation

# Workflow triggers
on:
workflow_dispatch: # Allows manual triggering of the workflow
push: # Triggers the workflow on every push to the repository

jobs:
format-code-customized:
runs-on: ubuntu-latest # Specifies the virtual machine to use, in this case, the latest version of Ubuntu

# Defines permissions for this job
permissions:
contents: write # Permissions to write to the repository

steps:
- uses: actions/checkout@v4 # Checks out the code from the repository

# Step to update and prepare the documentation
- name: Prepare and Update Documentation

run: |
# Verifica si setup.py existe, si no, lo crea
if [ ! -f "setup.py" ]; then
echo """import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name=\"${{ vars.MODULE }}\",
version='0.1',
packages=[\"${{ vars.MODULE }}\"],
author=\"${{ vars.AUTHOR }}\",
author_email=\"${{ vars.EMAIL }}\",
maintainer=\"${{ vars.AUTHOR }}\",
maintainer_email=\"${{ vars.EMAIL }}\",
download_url='',
install_requires=[
],
scripts=[
],
include_package_data=True,
license='Simplified BSD License',
description=\"\",
zip_safe=False,
long_description=README,
long_description_content_type='text/markdown',
python_requires='>=3.7',
#https://pypi.org/classifiers/
classifiers=[
],
)
""" >> setup.py
fi
# Commit all changed files back to the repository
- uses: stefanzweifel/git-auto-commit-action@v5
82 changes: 82 additions & 0 deletions .github/workflows/automated-sphinx-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# .github/workflows

name: Automated Documentation and Code Formatting

# Workflow triggers
on:
workflow_dispatch: # Allows manual triggering of the workflow
push: # Triggers the workflow on every push to the repository

jobs:
format-code-customized:
runs-on: ubuntu-latest # Specifies the virtual machine to use, in this case, the latest version of Ubuntu

# Defines permissions for this job
permissions:
contents: write # Permissions to write to the repository

steps:
- uses: actions/checkout@v4 # Checks out the code from the repository

# Step to update and prepare the documentation
- name: Prepare and Update Documentation

run: |
# Pulls necessary Docker images for documentation
docker pull dunderlab/docs
docker pull sphinxdoc/sphinx-latexpdf
# Installs required Python packages
pip install nbsphinx
pip install dunderlab-docs
# Sets up initial documentation if a 'docs' directory does not exist
if [ ! -d "docs" ]; then
dunderlab_docs quickstart '--project "${{ vars.PROJECT_NAME }}" --author "${{ vars.AUTHOR }}" --extensions nbsphinx,dunderlab.docs --no-batchfile --quiet --sep'
fi
# Generates API documentation and builds HTML and Latex PDF if SUBMODULE is set
if [ -n "${{ vars.SUBMODULE }}" ]; then
dunderlab_docs apidoc "${{ vars.MODULE }}"
dunderlab_docs build html "${{ vars.MODULE }}/${{ vars.SUBMODULE }}"
dunderlab_docs build latexpdf "${{ vars.MODULE }}/${{ vars.SUBMODULE }}"
else
dunderlab_docs apidoc "${{ vars.MODULE }}"
dunderlab_docs build html "${{ vars.MODULE }}"
dunderlab_docs build latexpdf "${{ vars.MODULE }}"
fi
# Adds a configuration file for Read the Docs
# Verifies if .readthedocs.yml exists, if not, creates it
if [ ! -f ".readthedocs.yml" ]; then
echo """# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
# Optionally set the version of Python and requirements required to build your docs
python:
install:
- requirements: docs/requirements
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: \"3.11\"
formats:
- epub
- pdf
""" >> .readthedocs.yml
fi
# Commit all changed files back to the repository
- uses: stefanzweifel/git-auto-commit-action@v5
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

*.wpr
*.wpu
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# GCPDS - Documentation Guide

Welcome to the "GCPDS - Documentation Guide". This guide serves as a comprehensive resource for setting up, configuring, and maintaining the documentation of projects under the General Computational Perception and Decision Systems (GCPDS) initiative. Our goal is to standardize the process of documentation across various modules and projects to enhance clarity, accessibility, and ease of use.

The guide outlines a series of steps and best practices aimed at ensuring a seamless integration of Python modules with version control and automated documentation systems. By following these guidelines, developers and contributors will be able to maintain a high standard of code management and documentation, which is vital for collaborative development and the long-term success of the project.

We cover everything from the initial setup of a GitHub repository, including naming conventions and configuration, to the integration with Read the Docs for automated documentation generation. Additionally, we discuss security practices, such as handling sensitive data through repository secrets and access tokens, to ensure the integrity and confidentiality of the project.

Each section of this guide is designed to walk you through the necessary steps to achieve an efficient and secure workflow. By adhering to these guidelines, the GCPDS community can contribute to a robust and sustainable ecosystem for research and development in computational perception and decision systems.

## Installation Instructions

To integrate the `gcpds.docs` module into your Python environment, the process is straightforward and managed via `pip`, Python's package installer. Ensure that you have `pip` installed and that it is up to date to avoid any compatibility issues. Follow the command below to install the latest version of `gcpds.docs`:


```python
pip install -U gcpds.docs
```

This command will download and install the `gcpds.docs` module along with its dependencies. The `-U` flag ensures that if the package is already installed, it will be upgraded to the latest version.

After the installation is complete, you can import and use `gcpds.docs` in your Python projects to enhance your documentation process.

**Note:** It is recommended to perform this installation within a virtual environment to maintain a clean workspace and avoid version conflicts with other projects.

## Introduction to Setting Up and Integrating a Python Module Repository

This documentation provides a structured approach to setting up a Python module repository on GitHub and integrating it with external documentation and automation services. The objective is to streamline the process of repository management, code security, and documentation generation for Python projects. By following these guidelines, developers can ensure their projects are well-organized, secure, and easily maintainable.

### Objectives

1. **Establish Conventions**: Define a clear and descriptive naming convention for Python module repositories to maintain consistency and clarity across projects.

2. **Secure Configuration**: Implement repository variables and secrets to manage environment configurations and sensitive information securely.

3. **Access Management**: Generate a Personal Access Token (Classic) to provide secure access to GitHub resources, enabling automated processes and integrations.

4. **Documentation Automation**: Create and configure a project on Read the Docs to facilitate automatic generation and hosting of project documentation.

5. **Continuous Integration**: Set up webhooks between GitHub and Read the Docs to enable real-time documentation updates with each code commit, ensuring the latest project changes are always documented.

By adhering to these steps, we aim to create a robust workflow that encapsulates best practices for repository setup, security, and documentation, while also leveraging automation to reduce manual effort and potential errors.

### Steps Overview

- **Guidelines for Python Module Repository Naming and Configuration on GitHub**: This section will guide you through the best practices for naming your Python module repository, setting it to public, and choosing the appropriate license.

- **Configuring Repository Variables and Secrets on GitHub**: Here, you will learn how to securely store and manage environment-specific configurations within your GitHub repository settings.

- **Creating a Personal Access Token (Classic) on GitHub**: This part of the documentation explains the process of creating a Personal Access Token to interact with GitHub's API securely.

- **Creating a Project on Read the Docs**: We will go through the steps of setting up your project on Read the Docs, ensuring your documentation is automatically generated from your repository.

- **Integrating GitHub with Webhooks for Read the Docs**: Lastly, you will set up a webhook to connect your GitHub repository with Read the Docs, allowing for automated documentation builds upon every commit.

Following these guidelines will set a solid foundation for your Python projects on GitHub and ensure that your documentation is always up-to-date with your latest code changes.
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 = source
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)
8 changes: 8 additions & 0 deletions docs/requirements
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sphinx==7.0.0
urllib3<2.0
ipython
ipykernel
nbsphinx
sphinxcontrib-bibtex
pygments
dunderlab-docs
7 changes: 7 additions & 0 deletions docs/source/_modules/docs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
docs package
============

.. automodule:: docs
:members:
:undoc-members:
:show-inheritance:
11 changes: 11 additions & 0 deletions docs/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
img[alt*="border-image"] {
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
width: 80%;
margin: 30px 10%;
}


div.sphinxsidebar ul li {
margin: 10px 0;
list-style: circle;
}
116 changes: 116 additions & 0 deletions docs/source/_static/dunderlab_custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
:root {
--accent: #FC4DB5;
--accent_dark: #b0357e;
}

pre.literal-block,
.highlight pre {
background-color: #fbfbfb;
border: none !important;
border-radius: 2px;
font-size: 75%;
}

.docutils.literal {
color: #FC4DB5;
padding: 1px 4px;
margin: 0 -2px;
border-radius: 2px;
}

div.nbinput.container div.input_area {
border: none !important;
}

a.reference {
border-bottom: 1px dotted #FC4DB5;
color: #FC4DB5;
}

a.reference:hover {
border-bottom: 1px solid #b0357e;
color: #b0357e;
}



h1 {
margin: 30px 0px 10px 0px !important;
}


.body {
max-width: unset !important;
}


img.logo {

width: 210px;

}


div.note {
background-color: #00ACC117;
border: 1px solid #00ACC15C;
}



dl:not(.docutils) dt {
margin: 6px 0;
margin-top: 6px;
font-size: 90%;
line-height: normal;
background: #00ACC117;
color: #555;
border-top: solid 3px #00ACC15C;
padding: 6px;
font-family: mono;
}

dl:not(.docutils) tt,
dl:not(.docutils) tt,
dl:not(.docutils) code {
font-weight: bold;
}

dl:not(.docutils) tt.descname,
dl:not(.docutils) tt.descname,
dl:not(.docutils) code.descname {
font-weight: bold;
}

dl:not(.docutils) dl dt {
margin-bottom: 6px;
border: none;
border-left: solid 3px #ccc;
background: #f0f0f0;
color: #555;
}

.body > .highlight-ipython3 {
display: none;
}

.toctree-wrapper .caption-text {
font-size: 30.6px;
font-family: Noto Sans;
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}

.sphinxsidebarwrapper p.caption{
font-size: 20px;
}

.dunderlab-footer {
margin-top: 80px;
background-color: #7878780d;
padding: 15px 30px;
border: 1px solid #FC4DB5;
border-width: 3px 0 0 0;
border-radius: 5px;
}
Binary file added docs/source/_static/favicon.ico
Binary file not shown.
Binary file added docs/source/_static/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 744acca

Please sign in to comment.