Skip to content

Release 6.0 #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6eb0790
add mypy, rewrite config and security, create proper refresh token fl…
Jan 19, 2024
4d5d656
Move project to main dir, remove cookiecutter
Jan 19, 2024
d21e408
remove cryptography, update .env.example, run pre-commit
Jan 19, 2024
44728a6
add freezegun, write test_auth tests
Jan 20, 2024
983937e
fix pytest tests, finish test_auth_login_access_token
Jan 29, 2024
e708d99
run pre-commit
Jan 29, 2024
2feb0eb
add freeze time
Feb 21, 2024
86e0024
test for refresh token, change database uri method in settings, add n…
Mar 2, 2024
c45731c
auth token test
Mar 2, 2024
3fddcf3
refactor conftest, use proper transaction rollback after tests!
Mar 2, 2024
a8bfdc3
remove test database, make conftest fixture_setup_new_test_database
Mar 3, 2024
a2d0f9e
init api messages
Mar 3, 2024
80559c6
remove minversion line
Mar 3, 2024
2545ecb
add ruff format support
Mar 3, 2024
2602ad1
fix post_write_hooks in alembic, recreate migration
Mar 3, 2024
90e3526
fix typo in conftest
Mar 3, 2024
35c5a92
auth endpoint messages
Mar 3, 2024
c82232e
add test auth refresh token
Mar 4, 2024
77a6c9c
fix refresh tokens tests
Mar 4, 2024
03b4206
users api
Mar 4, 2024
1935504
finish api tests
Mar 4, 2024
e55694c
improve module notes
Mar 4, 2024
de114c6
readme - update image link
Mar 4, 2024
cb62655
make auth api above users in schema again
Mar 4, 2024
1671f59
readme: make image look better
Mar 4, 2024
6177d18
readme: next try for border image
Mar 4, 2024
4f0f53b
bump libs, fix depr warning in tests
Mar 4, 2024
b0bba3c
improve JWT messages and add comment
Mar 4, 2024
7039381
use session.scalar instead of session.execute where possible
Mar 4, 2024
7e2c0d0
shorter get_current_user
Mar 4, 2024
b24bfc9
add freeze time to 2 tests
Mar 4, 2024
326e1bf
unify tokens time to use time.time
Mar 4, 2024
a6bd5dc
jwt and password core tests added
Mar 4, 2024
9b70ff7
add dependabot and update workflows
Mar 4, 2024
6e4209a
readme - update Features
Mar 4, 2024
6a75069
Readme- Quickstart
Mar 4, 2024
5a19c5e
readme -move check out phrase
Mar 4, 2024
8711ae0
readme - update about and step by step section
Mar 5, 2024
4ad1302
readme - better Running tests section
Mar 5, 2024
531e29b
readme - use (...)
Mar 5, 2024
4d34829
readme - add license note
Mar 5, 2024
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
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SECURITY__JWT_SECRET_KEY=DVnFmhwvjEhJZpuhndxjhlezxQPJmBIIkMDEmFREWQADPcUnrG
SECURITY__BACKEND_CORS_ORIGINS=["http://localhost:3000","http://localhost:8001"]
SECURITY__ALLOWED_HOSTS=["localhost", "127.0.0.1"]

DATABASE__HOSTNAME=localhost
DATABASE__USERNAME=rDGJeEDqAz
DATABASE__PASSWORD=XsPQhCoEfOQZueDjsILetLDUvbvSxAMnrVtgVZpmdcSssUgbvs
DATABASE__PORT=5455
DATABASE__DB=default_db
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
allow:
- dependency-type: "all"
groups:
all-dependencies:
patterns:
- "*"
exclude-patterns:
- "pytest-asyncio"

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: docker
directory: /
schedule:
interval: weekly
42 changes: 0 additions & 42 deletions .github/workflows/build_docker_image.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: dev-build
on:
workflow_run:
workflows: ["tests"]
branches: [main]
types:
- completed

workflow_dispatch:
inputs:
tag:
description: "Docker image tag"
required: true
default: "latest"

env:
IMAGE_TAG: ${{ github.event.inputs.tag || 'latest' }}

jobs:
dev_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push image
uses: docker/build-push-action@v5
with:
file: Dockerfile
push: true
tags: rafsaf/minimal-fastapi-postgres-template:${{ env.IMAGE_TAG }}
40 changes: 0 additions & 40 deletions .github/workflows/manual_build_docker_image.yml

This file was deleted.

54 changes: 23 additions & 31 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Run tests

name: tests
on:
push:
branches:
- "**"
tags-ignore:
- "*.*"

jobs:
build:
runs-on: ubuntu-20.04
tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
Expand All @@ -19,47 +22,36 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

# Below will create fresh template in path: minimal_project
- name: Generate project from template using cookiecutter
run: |
pip install cookiecutter
python tests/create_minimal_project.py
python-version: "3.12.2"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-in-project: false
virtualenvs-path: /opt/venv

# run tests from folder minimal_project
- name: Load cached venv
id: cached-poetry-dependencies-template
uses: actions/cache@v2
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: minimal_project/.venv
key: venv-${{ runner.os }}-${{ hashFiles('minimal_project/poetry.lock') }}
path: /opt/venv
key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }}

- name: Install template minimal dependencies
if: steps.cached-poetry-dependencies-template.outputs.cache-hit != 'true'
- name: Install dependencies and actiavte virtualenv
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd minimal_project
poetry install --no-interaction --no-root

- name: Run template minimal flake8 and then tests
- name: Run tests
env:
TEST_DATABASE_HOSTNAME: localhost
TEST_DATABASE_PASSWORD: postgres
TEST_DATABASE_PORT: 5432
TEST_DATABASE_USER: postgres
TEST_DATABASE_DB: postgres
SECURITY__JWT_SECRET_KEY: very-not-secret
DATABASE__HOSTNAME: localhost
DATABASE__PASSWORD: postgres
run: |
cd minimal_project
poetry run ruff app
poetry run coverage run -m pytest
poetry run pytest
51 changes: 51 additions & 0 deletions .github/workflows/type_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: type-check
on:
push:
branches:
- "**"
tags-ignore:
- "*.*"

jobs:
type_check:
strategy:
matrix:
check: ["ruff check", "mypy --check", "ruff format --check"]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: /opt/venv

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: /opt/venv
key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }}

- name: Install dependencies and actiavte virtualenv
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root

- name: Run ${{ matrix.check }}
run: |
poetry run ${{ matrix.check }} .
Loading