Skip to content

Commit

Permalink
v1.0/auth (#52)
Browse files Browse the repository at this point in the history
* Setup/GitHub actions (#7)

* Add: ci workflow

* Add: docker build & publish workflow

* Fix: temporary reduce interroagte threshold

* Fix: testing not running

* Add regex utils file

* Add test for regex.py

* Rename tests workflow command

* ⬆ Bump ruff from 0.0.289 to 0.0.290 (#8)

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.289 to 0.0.290.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md)
- [Commits](astral-sh/ruff@v0.0.289...v0.0.290)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump pyupgrade from 3.10.1 to 3.11.0 & Bandit to Bandit[toml] (#9)

Bumps [pyupgrade](https://github.com/asottile/pyupgrade) from 3.10.1 to 3.11.0.
- [Commits](asottile/pyupgrade@v3.10.1...v3.11.0)

Bumps Bandit to Bandit[toml]
---
updated-dependencies:
- dependency-name: pyupgrade
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump sqlalchemy from 2.0.20 to 2.0.21 (#10)

Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.20 to 2.0.21.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

---
updated-dependencies:
- dependency-name: sqlalchemy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump pyupgrade from 3.11.0 to 3.11.1 (#11)

Bumps [pyupgrade](https://github.com/asottile/pyupgrade) from 3.11.0 to 3.11.1.
- [Commits](asottile/pyupgrade@v3.11.0...v3.11.1)

---
updated-dependencies:
- dependency-name: pyupgrade
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump pyupgrade from 3.11.1 to 3.12.0 (#12)

Bumps [pyupgrade](https://github.com/asottile/pyupgrade) from 3.11.1 to 3.12.0.
- [Commits](asottile/pyupgrade@v3.11.1...v3.12.0)

---
updated-dependencies:
- dependency-name: pyupgrade
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Upgrade precommit

* Setup/db (#13)

* Add db env variables to settings

* Create db async engine & async session factory

* Create sqlalchemy base model & imp methods

* Add pydantic base schema

* Setup alembic migration

* setup initial base repo

* Add db counting utilility methods

* ⬆ Bump ruff from 0.0.290 to 0.0.291 (#14)

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.290 to 0.0.291.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md)
- [Commits](astral-sh/ruff@v0.0.290...v0.0.291)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump pyupgrade from 3.12.0 to 3.13.0 (#15)

Bumps [pyupgrade](https://github.com/asottile/pyupgrade) from 3.12.0 to 3.13.0.
- [Commits](asottile/pyupgrade@v3.12.0...v3.13.0)

---
updated-dependencies:
- dependency-name: pyupgrade
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ahmed Ashraf <[email protected]>

* Fix: add alembic.ini

* Setup/server entrypoint scripts (#17)

* Add entrypoint script to establish db connection

* Add script reqs & integrate into docker

* ⬆ Bump pydantic from 2.3.0 to 2.4.0 (#16)

Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](pydantic/pydantic@v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump pydantic from 2.4.0 to 2.4.1 (#19)

Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](pydantic/pydantic@v2.4.0...v2.4.1)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump redis[hiredis] from 5.0.0 to 5.0.1 (#18)

Bumps [redis[hiredis]](https://github.com/redis/redis-py) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/redis/redis-py/releases)
- [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES)
- [Commits](redis/redis-py@v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: redis[hiredis]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Feature/customize migrations (#20)

* Add custom revision id generation for alembic

* Create script to autogenerate new revision

* Feature/create user db model (#21)

* Create user sqlalchmey model

* Create initial user schemas

* Add user alembic revision

* Add users skeleton api

* Add alembic documentation (#22)

* Feature/create device db model (#23)

* Create device sqlalchemy model

* Create initial device schemas

* Add device alembic revision

* Add devices skeleton api

* Fromat code base

* ⬆ Bump fastapi from 0.103.1 to 0.103.2 (#25)

Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.1 to 0.103.2.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Commits](fastapi/fastapi@0.103.1...0.103.2)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump pydantic from 2.4.1 to 2.4.2 (#24)

Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](pydantic/pydantic@v2.4.1...v2.4.2)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix missed old pydantic syntax

* Update issue templates (#26)

* Feature/setup redis client (#27)

* Setup custom coders

* Create async redis client

* Setup api dependencies

* Migrate to python3.12 (#31)

* ⬆ Bump pyupgrade from 3.13.0 to 3.14.0 (#30)

Bumps [pyupgrade](https://github.com/asottile/pyupgrade) from 3.13.0 to 3.14.0.
- [Commits](asottile/pyupgrade@v3.13.0...v3.14.0)

---
updated-dependencies:
- dependency-name: pyupgrade
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump coverage from 7.3.1 to 7.3.2 (#29)

Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.3.1 to 7.3.2.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](nedbat/coveragepy@7.3.1...7.3.2)

---
updated-dependencies:
- dependency-name: coverage
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump ruff from 0.0.291 to 0.0.292 (#28)

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.291 to 0.0.292.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md)
- [Commits](astral-sh/ruff@v0.0.291...v0.0.292)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore/refactor user & device models (#32)

* Create collection model

* Add extra columns to user model

* Fix device columns nullability

* Create cipher enums & migration revision

* Update user & device migration revisions

* Feature/create collection db model (#33)

* Create collection model

* Create collection migration revision

* Feature/create cipher db model (#34)

* Create collection model

* Create collection migration revision

* Create cipher model & type enum

* Create cipher migration revision

* Fix/remove unused code

* Update/ pre-commit & pyprject python version

* Add deleetd _at column (#35)

* Refactor/db models (#36)

* Nullize cipher collection id  & Add more schemas

* Remove user.name & Add more schemas

* Replace device_* with user_agent

* Add collection schemas & Add schemas to __init__

* Disable ruff B024 error

* Add barebones models repos

* Fix python version in github action workflows

* Setup/security (#37)

* Add security env variables

* Add tokens schemas

* Add security hashing/encryption methods

* Add token generation methods

* Add custom exceptions

* Add tests for regex utils

* Use argon2id when hasing auto assigned passwords

* ⬆ Bump pyupgrade from 3.14.0 to 3.15.0 (#38)

Bumps [pyupgrade](https://github.com/asottile/pyupgrade) from 3.14.0 to 3.15.0.
- [Commits](asottile/pyupgrade@v3.14.0...v3.15.0)

---
updated-dependencies:
- dependency-name: pyupgrade
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump sqlalchemy from 2.0.21 to 2.0.22 (#40)

Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.21 to 2.0.22.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

---
updated-dependencies:
- dependency-name: sqlalchemy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump mypy from 1.5.1 to 1.6.0 (#39)

Bumps [mypy](https://github.com/python/mypy) from 1.5.1 to 1.6.0.
- [Commits](python/mypy@v1.5.1...v1.6.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix false repo names bug

* Update pre commit hooks versions

* Feature/setup redis mq (#41)

* Add supervisord & settings config

* Create mq worker dockerfile

* Add a readme to the mq worker

* Add initial db seed script to app entrypoint (#42)

* Await redis connection on entrypoint script (#43)

* ⬆ Bump pre-commit from 3.4.0 to 3.5.0 (#44)

Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](pre-commit/pre-commit@v3.4.0...v3.5.0)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Gitignore ,env.dev for .env.example

* Create email payloads schemas

* Add send email feature

* Feature/implement invite & register scheme (#45)

* Create invitation table

* Add wroker job schemas & queue enum

* Minor edits & bug fixes

* Add user model & repo methods

* Add custom auth exceptions

* Create invitation endpoint

* Create registeration endpoint

* ⬆ Bump ruff from 0.0.292 to 0.1.0 (#46)

* ⬆ Bump ruff from 0.0.292 to 0.1.0

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.292 to 0.1.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@v0.0.292...v0.1.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Upgrqade ruff version && add unsafe flag

* Add preview && unsafe fixes flags to ruff command

* Add more rules into ruff

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ahmed Ashraf <[email protected]>

* Add more ruff rules

* ⬆ Bump ruff from 0.1.0 to 0.1.1 (#50)

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.0 to 0.1.1.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@v0.1.0...v0.1.1)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump mypy from 1.6.0 to 1.6.1 (#49)

Bumps [mypy](https://github.com/python/mypy) from 1.6.0 to 1.6.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump black from 23.9.1 to 23.10.0 (#47)

Bumps [black](https://github.com/psf/black) from 23.9.1 to 23.10.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@23.9.1...23.10.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ⬆ Bump fastapi from 0.103.2 to 0.104.0 (#48)

Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.2 to 0.104.0.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Commits](fastapi/fastapi@0.103.2...0.104.0)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Yoink local ^_^ (#51)

* Add Auth dependency injection utilities
* Refactor & upgrade register endpoint
* Create oauth2/login endpoint
* Create otp login endpoint
* Refactor & upgrade the invite endpoint
* Create cache repo
* Refactor create otp token
* Create device db repo
* Enhance user db repo
* Complete rewrite of db seeding
* Enhance device model & schema
* Fix invitation model bug
* Add helper methods to user model
* Add more enums & Refactor enum base
* Refactor & Enhance Tokens schemas
* Setup otp email flow
* Add more custom exceptions

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Husam-Hs1807958 <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2023
1 parent b00a403 commit 38ee465
Show file tree
Hide file tree
Showing 90 changed files with 3,741 additions and 70 deletions.
2 changes: 0 additions & 2 deletions .env.dev

This file was deleted.

38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on: push

jobs:

tests:

runs-on: ubuntu-latest

steps:

- name: Checkout repository
uses: actions/checkout@v3

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

- uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements/*') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install -r ./requirements/dev.txt
- name: Run Tests
run: coverage run --rcfile=pyproject.toml -m pytest ./tests/

- name: Enforce Coverage
run: |
coverage combine
coverage report --rcfile=pyproject.toml -m
docstring-coverage:

runs-on: ubuntu-latest

steps:

- name: Checkout repository
uses: actions/checkout@v3

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

- uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements/*') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install -r ./requirements/dev.txt
- name: Run Interrogate
run: |
interrogate
45 changes: 45 additions & 0 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Create and publish a Docker image

on:
push:
branches: ['main']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:

build-and-push-image:

runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:

- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
16 changes: 1 addition & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.env.dev

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -131,15 +126,6 @@ celerybeat.pid
# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.11
python: python3.12
repos:
# Pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
args:
Expand All @@ -21,15 +21,15 @@ repos:
- --unsafe
# Ruff is a super fast linter written in Rust.
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.287
rev: v0.1.0
hooks:
- id: ruff
name: Code linting
args:
- --fix
# Black is the python code formatter.
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
args: [--config=./pyproject.toml]
Expand All @@ -43,7 +43,7 @@ repos:
files: ^app/.*\.py$
# Codespell is a spell checker for source code.
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
Expand Down
105 changes: 105 additions & 0 deletions alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = ./migration

# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s

# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory.
prepend_sys_path = .

# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python-dateutil library that can be
# installed by adding `alembic[tz]` to the pip requirements
# string value is passed to dateutil.tz.gettz()
# leave blank for localtime
# timezone =

# max length of characters to apply to the
# "slug" field
# truncate_slug_length = 40

# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false

# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false

# version location specification; This defaults
# to ./alembic/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "version_path_separator" below.
# version_locations = %(here)s/bar:%(here)s/bat:./alembic/versions

# version path separator; As mentioned above, this is the character used to split
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
# Valid values for version_path_separator are:
#
# version_path_separator = :
# version_path_separator = ;
# version_path_separator = space
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.

# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8

# MY NOTE:
# Overridden inside alembic/env.py
sqlalchemy.url = driver://user:pass@localhost/dbname


[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples

# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME

# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
12 changes: 12 additions & 0 deletions app/api/deps/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from .auth import (
AdminDep,
DeviceIDCookieDep,
OAuth2PasswordRequestFormDep,
OTPUserDep,
ReqDeviceDep,
ReqIpDep,
ReqUserAgentDep,
UserDep,
)
from .cache import AsyncRedisClientDep, MQDefault, MQHigh, MQLow, SyncRedisClientDep
from .db import DbDep
Loading

0 comments on commit 38ee465

Please sign in to comment.