Skip to content
This repository was archived by the owner on Aug 21, 2022. It is now read-only.

Commit 728c652

Browse files
authored
update dependencies and add notice about project state (#242)
1 parent 32c313f commit 728c652

File tree

12 files changed

+677
-767
lines changed

12 files changed

+677
-767
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ updates:
99
pull-request-branch-name:
1010
separator: "-"
1111
open-pull-requests-limit: 10
12-
reviewers:
13-
- nsidnev
1412

1513
- package-ecosystem: "github-actions"
1614
directory: "/"
@@ -20,5 +18,3 @@ updates:
2018
pull-request-branch-name:
2119
separator: "-"
2220
open-pull-requests-limit: 10
23-
reviewers:
24-
- nsidnev

.github/workflows/conduit.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,25 @@ jobs:
3030
with:
3131
python-version: ${{ matrix.python-version }}
3232

33-
- name: Install poetry
34-
run: pip install poetry==1.1
35-
- uses: actions/[email protected]
36-
id: cache-spec-deps
33+
- name: Install Poetry
34+
uses: snok/install-poetry@v1
35+
with:
36+
version: "1.1.12"
37+
virtualenvs-in-project: true
38+
39+
- name: Set up cache
40+
uses: actions/cache@v2
41+
id: cache
3742
with:
3843
path: .venv
39-
key: venv-conduit-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
40-
restore-keys: |
41-
venv-conduit-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-
42-
venv-conduit-${{ runner.os }}-py-${{ matrix.python-version }}-
43-
venv-conduit-${{ runner.os }}-py-
44-
venv-conduit-${{ runner.os }}-
44+
key: venv-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
45+
46+
- name: Ensure cache is healthy
47+
if: steps.cache.outputs.cache-hit == 'true'
48+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
4549

4650
- name: Install dependencies
47-
if: steps.cache-spec-deps.outputs.cache-hit != 'true'
48-
run: |
49-
poetry config virtualenvs.in-project true
50-
poetry install --no-dev
51+
run: poetry install --no-interaction
5152

5253
- name: Run newman and test service
5354
env:

.github/workflows/deploy.yml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,44 +24,3 @@ jobs:
2424
docker build -t $IMAGE_NAME:latest .
2525
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
2626
docker push $IMAGE_NAME:latest
27-
28-
deploy:
29-
name: Deploy
30-
31-
runs-on: ubuntu-18.04
32-
33-
needs: build
34-
35-
steps:
36-
- uses: actions/checkout@master
37-
- name: Deploy service with traefik over ssh
38-
env:
39-
SSH_USER: ${{ secrets.SSH_USER }}
40-
SSH_HOST: ${{ secrets.SSH_HOST }}
41-
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
42-
DATABASE_URL: ${{ secrets.DB_CONNECTION }}
43-
SECRET_KEY: ${{ secrets.SECRET_KEY }}
44-
run: |
45-
which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
46-
eval $(ssh-agent -s)
47-
echo "add ssh key"
48-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
49-
mkdir -p ~/.ssh
50-
chmod 700 ~/.ssh
51-
ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" $SSH_USER@$SSH_HOST "
52-
docker pull $IMAGE_NAME && \
53-
(docker rm -f frw_backend || true) && \
54-
docker run -d \
55-
--name frw_backend \
56-
--network web \
57-
--restart always \
58-
--label \"traefik.enable=true\" \
59-
--label \"traefik.docker.network=web\" \
60-
--label \"traefik.http.routers.frw-backend.rule=Host(\\\`frw.nsidnev.dev\\\`)\" \
61-
--label \"traefik.http.routers.frw-backend.entrypoints=web-secure\" \
62-
--label \"traefik.http.routers.frw-backend.tls.certresolver=letsencrypt\" \
63-
--label \"traefik.http.routers.frw-backend.middlewares=http-to-https@file\" \
64-
--label \"traefik.http.services.frw-backend.loadbalancer.server.port=8000\" \
65-
-e DATABASE_URL=\"$DATABASE_URL\" \
66-
-e SECRET_KEY=\"$SECRET_KEY\" \
67-
$IMAGE_NAME"

.github/workflows/styles.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ jobs:
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121

22-
- name: Install poetry
23-
run: pip install poetry==1.1
22+
- name: Install Poetry
23+
uses: snok/install-poetry@v1
24+
with:
25+
version: "1.1.12"
26+
virtualenvs-in-project: true
2427

25-
- uses: actions/[email protected]
26-
id: cache-dev-deps
28+
- name: Set up cache
29+
uses: actions/cache@v2
30+
id: cache
2731
with:
2832
path: .venv
29-
key: venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
30-
restore-keys: |
31-
venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-
32-
venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-
33-
venv-dev-${{ runner.os }}-py-
34-
venv-dev-${{ runner.os }}-
33+
key: venv-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
34+
35+
- name: Ensure cache is healthy
36+
if: steps.cache.outputs.cache-hit == 'true'
37+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
3538

3639
- name: Install dependencies
37-
if: steps.cache-dev-deps.outputs.cache-hit != 'true'
38-
run: |
39-
poetry config virtualenvs.in-project true
40-
poetry install
40+
run: poetry install --no-interaction
4141

4242
- name: Run linters
4343
run: poetry run ./scripts/lint

.github/workflows/tests.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ jobs:
3131
with:
3232
python-version: ${{ matrix.python-version }}
3333

34-
- name: Install poetry
35-
run: pip install poetry==1.1
34+
- name: Install Poetry
35+
uses: snok/install-poetry@v1
36+
with:
37+
version: "1.1.12"
38+
virtualenvs-in-project: true
3639

37-
- uses: actions/[email protected]
38-
id: cache-dev-deps
40+
- name: Set up cache
41+
uses: actions/cache@v2
42+
id: cache
3943
with:
4044
path: .venv
41-
key: venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
42-
restore-keys: |
43-
venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-
44-
venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-
45-
venv-dev-${{ runner.os }}-py-
46-
venv-dev-${{ runner.os }}-
45+
key: venv-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
46+
47+
- name: Ensure cache is healthy
48+
if: steps.cache.outputs.cache-hit == 'true'
49+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
4750

4851
- name: Install dependencies
49-
if: steps.cache-dev-deps.outputs.cache-hit != 'true'
50-
run: |
51-
poetry config virtualenvs.in-project true
52-
poetry install
52+
run: poetry install --no-interaction
5353

5454
- name: Run tests
5555
env:

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
.. image:: https://img.shields.io/badge/style-wemake-000000.svg
2727
:target: https://github.com/wemake-services/wemake-python-styleguide
2828

29+
----------
30+
31+
**NOTE**: This repository is not actively maintained because this example is quite complete and does its primary goal - passing Conduit testsuite.
32+
33+
More modern and relevant examples can be found in other repositories with ``fastapi`` tag on GitHub.
34+
2935
Quickstart
3036
----------
3137

app/api/routes/articles/articles_resource.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from fastapi import APIRouter, Body, Depends, HTTPException
3+
from fastapi import APIRouter, Body, Depends, HTTPException, Response
44
from starlette import status
55

66
from app.api.dependencies.articles import (
@@ -111,6 +111,7 @@ async def update_article_by_slug(
111111
status_code=status.HTTP_204_NO_CONTENT,
112112
name="articles:delete-article",
113113
dependencies=[Depends(check_article_modification_permissions)],
114+
response_class=Response,
114115
)
115116
async def delete_article_by_slug(
116117
article: Article = Depends(get_article_by_slug_from_path),

app/api/routes/comments.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from fastapi import APIRouter, Body, Depends
3+
from fastapi import APIRouter, Body, Depends, Response
44
from starlette import status
55

66
from app.api.dependencies.articles import get_article_by_slug_from_path
@@ -62,6 +62,7 @@ async def create_comment_for_article(
6262
status_code=status.HTTP_204_NO_CONTENT,
6363
name="comments:delete-comment-from-article",
6464
dependencies=[Depends(check_comment_modification_permissions)],
65+
response_class=Response,
6566
)
6667
async def delete_comment_from_article(
6768
comment: Comment = Depends(get_comment_by_id_from_path),

app/db/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
async def connect_to_db(app: FastAPI, settings: AppSettings) -> None:
9-
logger.info("Connecting to {0}", repr(settings.database_url))
9+
logger.info("Connecting to PostgreSQL")
1010

1111
app.state.pool = await asyncpg.create_pool(
1212
str(settings.database_url),

0 commit comments

Comments
 (0)