Skip to content

Commit 1ce5fcc

Browse files
committed
feat: dependency injection for quart
0 parents  commit 1ce5fcc

29 files changed

+4167
-0
lines changed

.devcontainer/Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.224.3/containers/python-3/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
4+
ARG VARIANT="3.10-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
6+
7+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8+
ARG NODE_VERSION="none"
9+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10+
11+
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
12+
# COPY requirements.txt /tmp/pip-tmp/
13+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
14+
# && rm -rf /tmp/pip-tmp
15+
16+
# [Optional] Uncomment this section to install additional OS packages.
17+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
18+
# && apt-get -y install --no-install-recommends <your-package-list-here>
19+
20+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
21+
&& apt-get -y install --no-install-recommends enchant-2 hunspell-en-gb
22+
23+
RUN su vscode -c "curl -sSL https://install.python-poetry.org | python3 - --preview"
24+
RUN su vscode -c "pip --no-cache-dir install --user --upgrade pre-commit"
25+
26+
# [Optional] Uncomment this line to install global node packages.
27+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.224.3/containers/python-3
3+
{
4+
"name": "quart-injector",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": "..",
8+
"args": {
9+
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
10+
// Append -bullseye or -buster to pin to an OS version.
11+
// Use -bullseye variants on local on arm64/Apple Silicon.
12+
"VARIANT": "3.10-bullseye",
13+
// Options
14+
"NODE_VERSION": "none"
15+
}
16+
},
17+
// Set *default* container specific settings.json values on container create.
18+
"settings": {
19+
"files.exclude": {
20+
".pnp.*": true,
21+
".yarn": true,
22+
"**/__pycache__": true,
23+
"**/.mypy_cache": true,
24+
"**/.pytest_cache": true,
25+
"**/.coverage": true,
26+
},
27+
"python.defaultInterpreterPath": "/usr/local/bin/python",
28+
"python.linting.enabled": true,
29+
"python.linting.pylintEnabled": true,
30+
"python.formatting.blackPath": "black",
31+
"python.linting.mypyPath": "mypy",
32+
"python.linting.pylintPath": "pylint",
33+
"python.testing.pytestPath": "pytest",
34+
"python.venvPath": "/home/vscode/.cache/pypoetry/virtualenvs/",
35+
},
36+
// Add the IDs of extensions you want installed when the container is created.
37+
"extensions": [
38+
"ms-python.python",
39+
"ms-python.vscode-pylance",
40+
"bungcip.better-toml",
41+
],
42+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
43+
// "forwardPorts": [],
44+
// Use 'postCreateCommand' to run commands after the container is created.
45+
"postCreateCommand": "make setup",
46+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
47+
"remoteUser": "vscode",
48+
"features": {
49+
"git": "latest",
50+
"github-cli": "latest"
51+
}
52+
}

.dictionary

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
iterable
2+
obj
3+
pragma
4+
teardown
5+
websocket

.github/workflows/docs.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy-docs:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@master
14+
15+
- name: install hunspell-en-gb
16+
run: sudo apt-get install -y hunspell-en-gb
17+
18+
- name: set python version
19+
uses: actions/setup-python@v1
20+
with:
21+
python-version: "3.10"
22+
23+
- name: install poetry
24+
run: |
25+
curl -sSL https://install.python-poetry.org | python - --preview
26+
27+
- name: Update PATH
28+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
29+
30+
- name: configure poetry
31+
run: poetry config virtualenvs.in-project true
32+
33+
- name: set up python cache
34+
uses: actions/cache@v2
35+
id: python-cache
36+
with:
37+
path: .venv
38+
key: venv-${{ hashFiles('**/poetry.lock') }}
39+
40+
- name: ensure cache is healthy
41+
if: steps.python-cache.outputs.cache-hit == 'true'
42+
run: timeout 10s poetry run pip --version || rm -rf .venv
43+
44+
- name: install python dependencies
45+
if: steps.python-cache.outputs.cache-hit != 'true'
46+
run: poetry install
47+
48+
- name: build docs
49+
run: make build docs
50+
51+
- name: deploy site
52+
env:
53+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
54+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
55+
run: netlify deploy --dir=dist/docs --prod

.github/workflows/tests.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
branches:
8+
- main
9+
pull_request:
10+
paths-ignore:
11+
- 'docs/**'
12+
branches:
13+
- '**'
14+
15+
jobs:
16+
tests:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@master
21+
22+
- name: install hunspell-en-gb
23+
run: sudo apt-get install -y hunspell-en-gb
24+
25+
- name: set python version
26+
uses: actions/setup-python@v1
27+
with:
28+
python-version: "3.10"
29+
30+
- name: install poetry
31+
run: |
32+
curl -sSL https://install.python-poetry.org | python - --preview
33+
- name: Update PATH
34+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
35+
36+
- name: configure poetry
37+
run: poetry config virtualenvs.in-project true
38+
39+
- name: set up python cache
40+
uses: actions/cache@v2
41+
id: python-cache
42+
with:
43+
path: .venv
44+
key: venv-${{ hashFiles('**/poetry.lock') }}
45+
46+
- name: ensure cache is healthy
47+
if: steps.python-cache.outputs.cache-hit == 'true'
48+
run: timeout 10s poetry run pip --version || rm -rf .venv
49+
50+
- name: install python dependencies
51+
if: steps.python-cache.outputs.cache-hit != 'true'
52+
run: poetry install
53+
54+
- name: Install pytest plugin
55+
run: poetry run pip install pytest-github-actions-annotate-failures
56+
57+
- name: run tests
58+
run: make ci

.gitignore

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#######################################################################################
2+
# Python
3+
#######################################################################################
4+
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
cover/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
.pybuilder/
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# IPython
86+
profile_default/
87+
ipython_config.py
88+
89+
# pyenv
90+
# For a library or package, you might want to ignore these files since the code is
91+
# intended to run in multiple environments; otherwise, check them in:
92+
# .python-version
93+
94+
# pipenv
95+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
97+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
98+
# install all needed dependencies.
99+
#Pipfile.lock
100+
101+
# poetry
102+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103+
# This is especially recommended for binary packages to ensure reproducibility, and is more
104+
# commonly ignored for libraries.
105+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106+
#poetry.lock
107+
108+
# pdm
109+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110+
#pdm.lock
111+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112+
# in version control.
113+
# https://pdm.fming.dev/#use-with-ide
114+
.pdm.toml
115+
116+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117+
__pypackages__/
118+
119+
# Celery stuff
120+
celerybeat-schedule
121+
celerybeat.pid
122+
123+
# SageMath parsed files
124+
*.sage.py
125+
126+
# Environments
127+
.env
128+
.venv
129+
env/
130+
venv/
131+
ENV/
132+
env.bak/
133+
venv.bak/
134+
135+
# Spyder project settings
136+
.spyderproject
137+
.spyproject
138+
139+
# Rope project settings
140+
.ropeproject
141+
142+
# mkdocs documentation
143+
/site
144+
145+
# mypy
146+
.mypy_cache/
147+
.dmypy.json
148+
dmypy.json
149+
150+
# Pyre type checker
151+
.pyre/
152+
153+
# pytype static type analyzer
154+
.pytype/
155+
156+
# Cython debug symbols
157+
cython_debug/
158+
159+
# PyCharm
160+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162+
# and can be added to the global gitignore or merged into this file. For a more nuclear
163+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
164+
#.idea/

0 commit comments

Comments
 (0)