Skip to content
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
77 changes: 77 additions & 0 deletions .github/workflows/publishGitHubPages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish GitHub Pages

on:
pull_request:
branches:
- main

push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r doc/requirements.txt

- name: get git info
id: getgitinfo
run: |
echo "GITHUB_COMMIT_DATE=$(git --no-pager log -1 --pretty='format:%cd' --date='format:%Y-%m-%d %H:%M:%S')" >> "$GITHUB_OUTPUT"

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: build Documentation
env:
GH_ACTIONS_GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
GH_ACTIONS_GIT_COMMIT_DATE: ${{ steps.getgitinfo.outputs.GITHUB_COMMIT_DATE }}
GH_ACTIONS_GIT_COMMIT_HASH: ${{ github.sha }}

run: |
sphinx-build -W --keep-going -b html doc/source/ ./_site

- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.venv
target
__pycache__
**/.terraform/**
*.zip
.terraform
.terraform.*
terraform.*
.tox
doc/build
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# FunctionGraph example fg-http-python-fastapi

Sample on how to create FunctionGraph HTTP function using python and [FastAPI framework](https://fastapi.tiangolo.com)

> [!WARNING]
> ###############################################
> Work in progress....
> ###############################################


## Documentation

For documentation see: [otc-java-sdk-v1](https://opentelekomcloud-community.github.io/fg-http-python-fastapi/)

>[!NOTE]
> To run documentation locally:
>
> Install ``tox`` as described in: [tox installation guide ](https://tox.wiki/en/4.26.0/installation.html)
>
> and run:
>
> ```bash
> tox -e docs-auto
> ```
> Open documentation in browser: <http://127.0.0.1:8882>

57 changes: 57 additions & 0 deletions createZip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!.venv/bin/python3

import os
import subprocess

from zipfile import ZIP_DEFLATED, ZipFile

####################################################################
# Zip Code and dependencies
####################################################################
def createZippedFunctionCode(packDependencies: bool):
# create temp venv, installdependencies
if packDependencies:
subprocess.run(["./packDependencies.sh", ""], shell=True)

# zip_buffer = io.BytesIO()

with ZipFile("./code.zip", "w", ZIP_DEFLATED) as zip:
# add files from folder src
src = "./src"

for dirname, subdirs, files in os.walk(src):
for filename in files:
absname = os.path.abspath(os.path.join(dirname, filename))
arcname = absname[absname.rindex("/src/") + len("/src/") :]
#print("zipping %s as %s" % (os.path.join(dirname, filename), arcname))
if (
"__pycache__" not in absname
and "__pycache__" not in arcname
):
#print("zipping %s as %s" % (os.path.join(dirname, filename), arcname))
zip.write(absname, arcname)

# add files from dependencies
src = "./target/dependenciesVenv/lib/python3.10/site-packages"

for dirname, subdirs, files in os.walk(src):
for filename in files:
absname = os.path.abspath(os.path.join(dirname, filename))
arcname = absname[
absname.rindex("/site-packages/") + len("/site-packages/") :
]
if (
not arcname.startswith("pip")
and not arcname.startswith("_distutils")
and not arcname.startswith("setuptools")
and "__pycache__" not in absname
and "__pycache__" not in arcname
):
#print("zipping %s as %s" % (os.path.join(dirname, filename), arcname))
zip.write(absname, arcname)

print("created: code.zip")


if __name__ == "__main__":
createZippedFunctionCode(True)
23 changes: 23 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
docutils>=0.11 # OSI-Approved Open Source, Public Domain
beautifulsoup4>=4.6.0 # MIT
reno>=4.1.0 # Apache-2.0
otcdocstheme>=1.13.2 # Apache-2.0
otc-api-ref>=0.1.0 # Apache-2.0
sphinx>=2.0.0,!=2.1.0 # BSD
sphinxcontrib-apidoc>=0.2.0 # BSD
# cliff!=2.9.0,>=2.8.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
osc-lib>=1.10.0 # Apache-2.0
doc8
rstcheck
javasphinx
sphinx-tabs
sphinx-copybutton
sphinx-design
Sphinx-Substitution-Extensions
gitpython
sphinx-autobuild
git+https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata-rework.git#egg=otc_metadata
6 changes: 6 additions & 0 deletions doc/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[rstcheck]
ignore_roles=github_repo_master

[doc8]
ignore = ["D001"]
allow-long-titles = true
34 changes: 34 additions & 0 deletions doc/source/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* START: Copy to Clipboard */

button.copybtn {
webkit-transition: opacity .3s ease-in-out;
-o-transition: opacity .3s ease-in-out;
transition: opacity .3s ease-in-out;
opacity: 0;
padding: 0px 6px;
position: absolute;
right: 4px;
top: 4px;
}
div.highlight:hover .copybtn, div.highlight .copybtn:focus {
opacity: .5;
}
div.highlight .copybtn:hover {
opacity: 1;
color: var(--telekom-color-primary-standard);
}

div.highlight .btn:focus {
box-shadow: 0 0 0 .25rem rgba(226, 0, 116,.25);
}

div.highlight {
position: relative;
}

.fa-solid, .fas {
font-family: "Font Awesome 6 Free";
font-weight: 900;
}

/* END: Copy to Clipboard */
16 changes: 16 additions & 0 deletions doc/source/_templates/sidebartoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<aside id="left-sidebar" class="docs-sidebar">
<div class="docs-sidebar-toc collapse" aria-label="Docs navigation" id="docs-sidebar-nav">
{%- if theme_display_global_toc_section %}
<div class="docs-sidebar-section" id="table-of-contents">
<!-- <a href="../{{ pathto(master_doc) }}" class="docs-sidebar-section-title"><h4>{{project}} {{version}}</h4></a> -->
<!-- <a href="/fg-http-python-fastapi/index.html" class="docs-sidebar-section-title"><h4>{{project}} {{version}}</h4></a> -->
<a href="index.html" class="docs-sidebar-section-title"><h4>{{project}} {{version}}</h4></a>
{%- if theme_sidebar_mode == 'toc' %}
{{ toc }}
{%- elif theme_sidebar_mode == 'toctree' %}
{{ toctree(maxdepth=4, includehidden=True, titles_only=true) }}
{%- endif %}
</div>
{%- endif %}
</div>
</aside>
Loading
Loading