Skip to content

Commit

Permalink
adding fast api example
Browse files Browse the repository at this point in the history
  • Loading branch information
rpmolina committed Sep 25, 2024
1 parent 3a206ef commit ce06a6a
Show file tree
Hide file tree
Showing 53 changed files with 1,587 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/fastapi-simple-docker-pip/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
.git
.github
build
.devcontainer
.serverless
.venv
.vscode
7 changes: 7 additions & 0 deletions examples/fastapi-simple-docker-pip/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# For Email
EMAIL_FROM_EMAIL=[email protected]
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PASSWORD=password
EMAIL_SMTP_PORT=587
EMAIL_SMTP_USER=user
EMAIL_TO_EMAIL=[email protected]
14 changes: 14 additions & 0 deletions examples/fastapi-simple-docker-pip/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[flake8]
max-line-length = 100
max-complexity = 18
select =
"B", # Bugbear
"C", # Cyclomatic complexity
"E", # PEP8 errors
"F", # PyFlakes
"W", # PEP8 warnings
"T4", # Flake8 plugins that check typing
"B9", # Bugbear
#require-plugins =
# "flake8-bugbear",
# "flake8-black",
1 change: 1 addition & 0 deletions examples/fastapi-simple-docker-pip/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @ulises-jeremias @rpmolina
8 changes: 8 additions & 0 deletions examples/fastapi-simple-docker-pip/.github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Code of Conduct

This code of conduct is derived from the Ruby code of conduct. This document provides community guidelines for a safe, respectful, productive, and collaborative place for any person who is willing to contribute to this community. It applies to all “collaborative space”, which is defined as community communications channels. Any violations of the code of conduct may be reported by contacting one or more of the project maintainers either directly.

- Participants will be tolerant of opposing views.
- Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
- When interpreting the words and actions of others, participants should always assume good intentions.
- Behaviour that the project maintainers consider to be harassment will not be tolerated.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: "🐛 Bug Report"
description: Report a bug
title: "(short issue description)"
labels: [bug]
assignees: []
body:
- type: textarea
id: description
attributes:
label: Describe the bug
description: What is the problem? A clear and concise description of the bug.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: |
What did you expect to happen?
validations:
required: true
- type: textarea
id: current
attributes:
label: Current Behavior
description: |
What actually happened?
Please include full errors, uncaught exceptions, stack traces, and relevant logs.
If service/functions responses are relevant, please include wire logs.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction Steps
description: |
Provide a self-contained, concise snippet of code that can be used to reproduce the issue.
For more complex issues provide a repo with the smallest sample that reproduces the bug.
Avoid including business logic or unrelated code, it makes diagnosis more difficult.
The code sample should be an SSCCE. See http://sscce.org/ for details.
In short, please provide a code sample that we can copy/paste, run and reproduce.
validations:
required: true
- type: textarea
id: solution
attributes:
label: Possible Solution
description: |
Suggest a fix/reason for the bug
validations:
required: false
- type: textarea
id: context
attributes:
label: Additional Information/Context
description: |
Anything else that might be relevant for troubleshooting this bug.
Providing context helps us come up with a solution that is most useful in the real world.
validations:
required: false
- type: input
id: version
attributes:
label: Version used
description: |
Please provide the version of the repository or tool you are using.
validations:
required: true
- type: input
id: environment
attributes:
label: Environment details (OS name and version, etc.)
validations:
required: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
blank_issues_enabled: false
contact_links:
- name: 💬 General Question
url: https://github.com/nanlabs/aws-glue-etl-boilerplate/discussions/categories/q-a
about: Please ask and answer questions as a discussion thread
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: "📕 Documentation Issue"
description: Report an issue in the Reference documentation or Developer Guide
title: "(short issue description)"
labels: [documentation]
assignees: []
body:
- type: textarea
id: description
attributes:
label: Describe the issue
description: A clear and concise description of the issue.
validations:
required: true

- type: textarea
id: links
attributes:
label: Links
description: |
Include links to affected documentation page(s).
validations:
required: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: 🚀 Feature Request
description: Suggest an idea for this project
title: "(short issue description)"
labels: [feature-request]
assignees: []
body:
- type: textarea
id: description
attributes:
label: Describe the feature
description: A clear and concise description of the feature you are proposing.
validations:
required: true
- type: textarea
id: use-case
attributes:
label: Use Case
description: |
Why do you need this feature? For example: "I'm always frustrated when..."
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed Solution
description: |
Suggest how to implement the addition or change.
Please include prototype/workaround/sketch/reference implementation.
validations:
required: false
- type: textarea
id: other
attributes:
label: Other Information
description: |
Any alternative solutions or features you considered, a more detailed explanation,
stack traces, related issues, links for context, etc.
validations:
required: false
- type: checkboxes
id: ack
attributes:
label: Acknowledgements
options:
- label: I may be able to implement this feature request
required: false
- label: This feature might incur a breaking change
required: false
- type: input
id: version
attributes:
label: Version used
description: |
Please provide the version of the repository or tool you are using.
validations:
required: true
- type: input
id: environment
attributes:
label: Environment details (OS name and version, etc.)
validations:
required: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# What's this PR do?

_Summary of changes in this PR or what it accomplishes._

<!--
Please title your PR as follows: `feature: fix foo bar`.
Always start with the thing you are fixing, then describe the fix.
Don't use past tense (e.g. "fixed foo bar").
Explain what your PR does and why.
If you are adding a new function, please document it and add tests:
```python
code you added/updated
```
If you are fixing a bug, please add a test that covers it.
Before submitting a PR, please:
- specify the command to execute or steps to follow to know that the problem was solved
We try to process PRs as soon as possible. They should be handled within 24 hours.
Applying labels to PRs is not needed.
Thanks a lot for your contribution!
->
12 changes: 12 additions & 0 deletions examples/fastapi-simple-docker-pip/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
79 changes: 79 additions & 0 deletions examples/fastapi-simple-docker-pip/.github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
name: Super Linter

on:
push:
branches:
- main

pull_request:
branches:
- main

permissions:
contents: read

jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
actions: read
checks: read
statuses: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python, including cache for pipenv virtual environment
uses: actions/setup-python@v5
with:
python-version-file: .python-version
cache: pipenv

- name: Install pipenv
run: |
pip install --upgrade pip
pip install pipenv
- name: Install project dependencies
run: pipenv install --deploy --dev

- name: Get virtual environment path
id: get-venv-path
run: echo "venv-path=$(pipenv --venv)" >> "$GITHUB_OUTPUT"

- name: Copy python dependencies
run: |
cp -r "${{ steps.get-venv-path.outputs.venv-path }}" \
/home/runner/work/_temp/_github_workflow/.venv
- name: Get Python version from .python-version file
id: get-python-version
run: echo "python-version=$(cut -d '.' -f 1,2 .python-version)" >> "$GITHUB_OUTPUT"

- name: Lint Code Base
uses: super-linter/super-linter/slim@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main
VALIDATE_ALL_CODEBASE: true
LINTER_RULES_PATH: .
PYTHONPATH: "/github/workspace:/github/workflow/.venv/lib/python${{ steps.get-python-version.outputs.python-version }}/site-packages"
MARKDOWN_CONFIG_FILE: .markdownlint.json
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
PYTHON_PYLINT_CONFIG_FILE: pyproject.toml
PYTHON_RUFF_CONFIG_FILE: pyproject.toml
VALIDATE_BASH_EXEC: false
VALIDATE_CHECKOV: false
VALIDATE_CLOUDFORMATION: false
VALIDATE_JSCPD: false
VALIDATE_SHELL_SHFMT: false
VALIDATE_BASH: false
VALIDATE_DOCKERFILE_HADOLINT: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Security Scan

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

schedule:
- cron: '31 1,12 * * *'

push:
branches:
- main

pull_request:
branches:
- main

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
security-scan:
runs-on: ubuntu-22.04
timeout-minutes: 5

permissions:
security-events: write
actions: read
contents: read

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

- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: config
hide-progress: true
output: trivy.txt

- name: Publish Trivy Output to Summary
run: |
if [[ -s trivy.txt ]]; then
{
echo "### Security Output"
echo "<details><summary>Click to expand</summary>"
echo ""
echo '```terraform'
cat trivy.txt
echo '```'
echo "</details>"
} >> "${GITHUB_STEP_SUMMARY}"
fi
Loading

0 comments on commit ce06a6a

Please sign in to comment.