Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
f93e9fd
Added models for SQLA
IlyaDev1 Dec 23, 2024
053e3a3
added deadline default value
IlyaDev1 Dec 26, 2024
2535873
Merge pull request #2 from IlyaDev1/feature/creating_app_ModelFolder
IlyaDev1 Dec 26, 2024
84f44e5
start schema
IlyaDev1 Dec 26, 2024
0300ff2
finished schemas
IlyaDev1 Dec 28, 2024
b5cd538
Merge pull request #3 from IlyaDev1/feature/creating_schemas
IlyaDev1 Dec 28, 2024
b089219
created base (was not finished(want rename to base_repository))
IlyaDev1 Dec 28, 2024
96b8864
created psql repo
IlyaDev1 Dec 29, 2024
3bbf09c
Merge pull request #4 from IlyaDev1/feature/creating_repositories
IlyaDev1 Dec 31, 2024
279d053
deleted __all__ in repo init
IlyaDev1 Dec 31, 2024
12dc022
Merge pull request #6 from IlyaDev1/fix/repo_init
IlyaDev1 Jan 1, 2025
1b846fa
updated models/todo
IlyaDev1 Jan 1, 2025
6ecd1f9
updated repo
IlyaDev1 Jan 1, 2025
ad6aa3b
created routes and depends
IlyaDev1 Jan 2, 2025
0d3fc54
desc default value None
IlyaDev1 Jan 2, 2025
3f67425
added default value to deadline field
IlyaDev1 Jan 2, 2025
cd575ea
created relational repo
IlyaDev1 Jan 2, 2025
0e0b400
cringe
IlyaDev1 Jan 2, 2025
e617153
Merge branch 'fix/models_package' into feature/creating_api_package
IlyaDev1 Jan 2, 2025
ca5d8d9
Merge branch 'fix/repo_base' into feature/creating_api_package
IlyaDev1 Jan 2, 2025
761c3c7
created api
IlyaDev1 Jan 2, 2025
2d5c1e5
Merge pull request #12 from IlyaDev1/fix/repo_base
IlyaDev1 Jan 3, 2025
b4ba397
Merge pull request #11 from IlyaDev1/fix/models_package
IlyaDev1 Jan 3, 2025
fc39d93
Merge branch 'develop' of https://github.com/IlyaDev1/ToDo_FastAPI in…
IlyaDev1 Jan 3, 2025
77b2b09
created core
IlyaDev1 Jan 3, 2025
57b2650
Merge branch 'feature/core' into feature/creating_api_package
IlyaDev1 Jan 3, 2025
bef0912
added core
IlyaDev1 Jan 3, 2025
b0a76be
added database instance
IlyaDev1 Jan 3, 2025
3d63d85
Merge pull request #13 from IlyaDev1/feature/core
IlyaDev1 Jan 3, 2025
39e1bc2
Merge branch 'develop' of https://github.com/IlyaDev1/ToDo_FastAPI in…
IlyaDev1 Jan 3, 2025
d0e324e
added service package
IlyaDev1 Jan 4, 2025
e21145f
Merge pull request #14 from IlyaDev1/feature/creating_api_package
IlyaDev1 Jan 5, 2025
6a3d74d
added task entity and entities package
IlyaDev1 Jan 6, 2025
7bf0c9c
renamed sqla models
IlyaDev1 Jan 6, 2025
f9e1d2b
Merge pull request #16 from IlyaDev1/feature/add_task_entity
IlyaDev1 Jan 8, 2025
775c933
Merge pull request #17 from IlyaDev1/fix/model_naming
IlyaDev1 Jan 8, 2025
368fa25
upgraded repo
IlyaDev1 Jan 8, 2025
765764a
first version
IlyaDev1 Jan 14, 2025
b6a2c4b
fixed errors with imports
IlyaDev1 Jan 14, 2025
084ad94
updated repositories
IlyaDev1 Jan 15, 2025
399a2fe
added type hints
IlyaDev1 Jan 15, 2025
723c143
Merge pull request #18 from IlyaDev1/feature/more_repo
IlyaDev1 Jan 16, 2025
bad4e2e
di_v1
IlyaDev1 Jan 16, 2025
840d9da
added inject in service
IlyaDev1 Jan 16, 2025
e719e24
fixed repo's name
IlyaDev1 Jan 16, 2025
cb0619b
deleted extra imports
IlyaDev1 Jan 16, 2025
ef27491
Merge pull request #19 from IlyaDev1/feature/my_di
IlyaDev1 Jan 18, 2025
81038ec
added binding
IlyaDev1 Jan 18, 2025
d694849
fixed import production config in main
IlyaDev1 Jan 18, 2025
c834e92
not finished
IlyaDev1 Jan 18, 2025
79d9a35
added compose
IlyaDev1 Jan 18, 2025
43e0a6a
added .git/ to gitignore
IlyaDev1 Jan 18, 2025
a1eef21
commit before di settings
IlyaDev1 Jan 20, 2025
eeef42e
Merge branch 'fix/add_module_for_di_config' into feature/dockerfiles
IlyaDev1 Jan 20, 2025
17df67a
(((((
IlyaDev1 Jan 20, 2025
432da76
finished))))
IlyaDev1 Jan 21, 2025
d61f231
Merge pull request #20 from IlyaDev1/fix/add_module_for_di_config
IlyaDev1 Jan 21, 2025
8b399a1
Merge pull request #22 from IlyaDev1/feature/dockerfiles
IlyaDev1 Jan 21, 2025
0f107a9
fixed url to db
IlyaDev1 Jan 25, 2025
a33078d
added volume for psql
IlyaDev1 Jan 25, 2025
b0611db
Merge pull request #24 from IlyaDev1/fix/conn_to_db
IlyaDev1 Jan 25, 2025
34cfab5
added env file and settings
IlyaDev1 Jan 25, 2025
1ebcdcc
fixed some names
IlyaDev1 Jan 25, 2025
3b2f17b
Merge pull request #25 from IlyaDev1/feature/env
IlyaDev1 Jan 25, 2025
94dd7f0
fixed env in dockerignore
IlyaDev1 Jan 25, 2025
438d2a0
Merge pull request #27 from IlyaDev1/fix/env
IlyaDev1 Jan 25, 2025
c6cee00
changed struct
IlyaDev1 Jan 26, 2025
e9350dc
start
IlyaDev1 Jan 26, 2025
919e8d6
Merge pull request #28 from IlyaDev1/feature/change_project_struct
IlyaDev1 Jan 26, 2025
c679ffc
added volume for alembic
IlyaDev1 Jan 27, 2025
fc1812d
added first migration
IlyaDev1 Jan 27, 2025
0a437e8
fixed task model with default datetime value
IlyaDev1 Jan 30, 2025
328d0e1
removed useless import
IlyaDev1 Jan 30, 2025
62ea432
fixed migration
IlyaDev1 Jan 30, 2025
8e9623b
Merge pull request #30 from IlyaDev1/feature/alembic
IlyaDev1 Jan 31, 2025
ce39569
created fst version of endpoint
IlyaDev1 Feb 2, 2025
6a24340
fixed with not found task_instance
IlyaDev1 Feb 2, 2025
4c86bb9
fixed type hint
IlyaDev1 Feb 2, 2025
6bb9d1c
fixed None in route and type hints
IlyaDev1 Feb 3, 2025
e61f118
ENGLISH, MOTHERFUCKER! DO YOU SPEAK IT?!
IlyaDev1 Feb 3, 2025
93bd658
created mapper
IlyaDev1 Feb 3, 2025
bc04ad7
deleted mappers module
IlyaDev1 Feb 3, 2025
54b5b43
Merge pull request #34 from IlyaDev1/feature/mapper
IlyaDev1 Feb 3, 2025
99350bb
added migration for fix table
IlyaDev1 Feb 7, 2025
f7f2ac8
added task dto class
IlyaDev1 Feb 7, 2025
30b9605
fst version
IlyaDev1 Feb 7, 2025
29a32a6
fixed instances
IlyaDev1 Feb 8, 2025
b0dbf25
fst version
IlyaDev1 Feb 8, 2025
03465f2
added repo method
IlyaDev1 Feb 8, 2025
aefbd1d
fixed task model init
IlyaDev1 Feb 8, 2025
f5a1088
Merge pull request #38 from IlyaDev1/feature/add_dto
IlyaDev1 Feb 8, 2025
f793f25
Merge pull request #37 from IlyaDev1/fix/add_migration_for_task
IlyaDev1 Feb 8, 2025
0146742
added abs method for repo
IlyaDev1 Feb 9, 2025
fdfd226
fixed many errors
IlyaDev1 Feb 9, 2025
e981c03
added applying migration when starting container
IlyaDev1 Feb 9, 2025
9eb00f0
fixed session generator
IlyaDev1 Feb 9, 2025
5332768
deleted id from dto class
IlyaDev1 Feb 9, 2025
73f5dde
Merge pull request #39 from IlyaDev1/fix/a_lot_of_fixes
IlyaDev1 Feb 9, 2025
fdc34ee
created env example and fixed type hints in settings
IlyaDev1 Feb 10, 2025
755d42e
added default values to config and env example values
IlyaDev1 Feb 11, 2025
b0fdace
Merge pull request #40 from IlyaDev1/fix/a_lot_of_fixes
IlyaDev1 Feb 13, 2025
729d78d
fst pre commit using
IlyaDev1 Feb 13, 2025
12c9d7e
fst version
IlyaDev1 Feb 13, 2025
68870a9
Merge pull request #43 from IlyaDev1/feature/pre_commit
IlyaDev1 Feb 14, 2025
05e03de
added delete method
IlyaDev1 Feb 14, 2025
19320e4
fst version
IlyaDev1 Feb 14, 2025
9a9605b
Merge pull request #46 from IlyaDev1/feature/add_logger
IlyaDev1 Feb 14, 2025
e643b9d
fst version
IlyaDev1 Feb 15, 2025
995a11e
added desc to pydantic schemas
IlyaDev1 Feb 15, 2025
3625f22
added responses
IlyaDev1 Feb 16, 2025
cec30cd
first version
IlyaDev1 Feb 16, 2025
53ae145
fixed var name
IlyaDev1 Feb 16, 2025
7f2324e
added doc string to task_repo
IlyaDev1 Feb 16, 2025
f25b48a
added responses module
IlyaDev1 Feb 17, 2025
ab62210
rename arg in route
IlyaDev1 Feb 17, 2025
6bcb4ef
Merge pull request #47 from IlyaDev1/feature/add_doc
IlyaDev1 Feb 18, 2025
50341fa
Merge branch 'develop' into feature/patch
IlyaDev1 Feb 18, 2025
9822e35
Merge pull request #48 from IlyaDev1/feature/patch
IlyaDev1 Feb 18, 2025
0046345
added async to methods
IlyaDev1 Feb 20, 2025
e9497e5
fst version
IlyaDev1 Feb 20, 2025
d8a0f36
fixed get all tasks method
IlyaDev1 Feb 20, 2025
9eb66dc
fixed create task method
IlyaDev1 Feb 20, 2025
1ec8c91
added async to delete method
IlyaDev1 Feb 20, 2025
4eb7478
added async to patch method
IlyaDev1 Feb 20, 2025
707324f
fixed tz datetime
IlyaDev1 Feb 20, 2025
eb95a2b
added func for get task by id
IlyaDev1 Feb 20, 2025
7e1fd5f
fixed entity method
IlyaDev1 Feb 21, 2025
40359a0
Merge pull request #50 from IlyaDev1/feature/async
IlyaDev1 Feb 22, 2025
8c7650a
added libs
IlyaDev1 Feb 22, 2025
fcdee34
added fst test
IlyaDev1 Feb 22, 2025
0e5c222
fst version of a httpx test
Feb 24, 2025
3f30300
added conftest
Feb 24, 2025
205352c
test passed
Feb 24, 2025
9ade9f2
deleted env print
Feb 24, 2025
15d2bd1
added test compose file
Feb 25, 2025
d10cc44
added env migration
Feb 25, 2025
847f077
finished
Feb 25, 2025
bc5e70e
fixed structure
Feb 27, 2025
a22978b
finished
Feb 28, 2025
27b356e
deleted prints
Feb 28, 2025
cfc2178
Merge pull request #51 from IlyaDev1/feature/tests
IlyaDev1 Mar 3, 2025
97b4281
added ci workflow
Mar 7, 2025
e658940
Merge pull request #57 from IlyaDev1/feature/ci
IlyaDev1 Mar 7, 2025
014fad8
local test env set up
Apr 18, 2025
4dba8de
Merge pull request #60 from IlyaDev1/f/test_env
IlyaDev1 Apr 18, 2025
9223dbe
set env for local testing with psql in docker
Apr 19, 2025
2839f7c
fixed fixture in conftest
Apr 20, 2025
3969606
deleted default scope for fixture and added -vv in ci
Apr 20, 2025
3c8d4a7
added fixture for create async httpx client
Apr 20, 2025
0157eb9
Merge pull request #61 from IlyaDev1/f/local_psql_in_docker
IlyaDev1 Apr 20, 2025
37b0b38
fixed method name
Apr 22, 2025
241992b
deleted autouse in async_client fixture
Apr 22, 2025
9ba4f75
added validation to pydantic
Apr 22, 2025
bc0b66f
fixed async_client fixture
Apr 23, 2025
e57a34c
Merge branch 'f/fixture_for_ac' into f/create_task_tests
Apr 23, 2025
d524df6
added pytest.mark.asyncio to test
Apr 23, 2025
a1cf6ea
added job to ci
Apr 23, 2025
583a256
added type hint to async client in test
Apr 24, 2025
8597f91
Merge pull request #62 from IlyaDev1/f/fixture_for_ac
IlyaDev1 Apr 24, 2025
e71b9ef
Merge branch 'develop' into f/create_task_tests
Apr 24, 2025
e50c55c
payload now dto instead of dict
Apr 24, 2025
4230fa8
Merge pull request #64 from IlyaDev1/f/change_ci_workflow
IlyaDev1 Apr 27, 2025
dd299ea
Merge pull request #65 from IlyaDev1/f/create_task_tests
IlyaDev1 Apr 27, 2025
bd85e2e
added test for too long (61) title
Apr 24, 2025
3192839
added max_length to schema
Apr 27, 2025
ea4a979
added test with long title
Apr 27, 2025
0fe88c2
Merge pull request #66 from IlyaDev1/f/too_long_title
IlyaDev1 Apr 27, 2025
ab652e0
added consts
Apr 27, 2025
f7cbb79
added comment for task_url
Apr 27, 2025
4fd37e5
added fixture
Apr 27, 2025
58e1eb1
added max_length to desc
Apr 27, 2025
bbb7980
deleted deepcopy
Apr 27, 2025
fc950f1
Merge branch 'develop' of https://github.com/IlyaDev1/ToDo_FastAPI in…
May 12, 2025
df67c53
fixed constant instances and created module for consts
May 12, 2025
5ea478b
added constants module for pydantic
May 12, 2025
f4d6991
Merge pull request #67 from IlyaDev1/f/consts_fixtures
IlyaDev1 May 23, 2025
06b1ed5
added test and fixed psql_repo
Apr 28, 2025
a3ae5dc
added test for deadline and fixed pydantic model
Apr 28, 2025
3b914ff
fixed datetime timezone error
Apr 28, 2025
9dcaedf
added change deadline test and fixed schema
Apr 29, 2025
b23727c
added const to schema and added pyproject toml
May 23, 2025
164e6b5
fixed url name in tests
May 23, 2025
2b1eb2a
deleted stub
May 23, 2025
317750e
fixed names
May 23, 2025
794ed06
transferred deadline validation to service
May 26, 2025
aff49ed
deleted extra if
May 26, 2025
bfd8d66
deleted extra import
May 26, 2025
ed7cf83
Merge pull request #78 from IlyaDev1/f/deadline_before_current_time
IlyaDev1 May 26, 2025
9ce095b
deadline not in past in change deadline endpoint
May 27, 2025
da09c6d
extension package, func 404 or entity
May 29, 2025
cbb3bad
Merge pull request #79 from IlyaDev1/f/change_deadline
IlyaDev1 May 29, 2025
db8081b
added test for empty deadline, fixed psql_repo method
May 29, 2025
3360d19
Merge pull request #80 from IlyaDev1/f/deadline_not_empty_test
IlyaDev1 May 30, 2025
db17224
added sync db url to test_api.yml
May 30, 2025
183206a
added sync db url to config
May 30, 2025
f8ed436
added sync engine to database module
May 30, 2025
f313639
changed orm package to an updated one
May 30, 2025
618b7a6
changed setup_db to a sync version
May 30, 2025
049edff
Merge pull request #81 from IlyaDev1/fix/conftest
IlyaDev1 Jun 1, 2025
45d535e
added is_completed set to false by default test and deleted version f…
Jun 1, 2025
8d571f3
Merge pull request #82 from IlyaDev1/f/is_completed_false_by_default
IlyaDev1 Jun 2, 2025
ac45ef2
added depends to pyproject.toml
Jun 6, 2025
608bb63
destroyed fucking reqs.txt
Jun 6, 2025
fefe58a
added lockfile
Jun 8, 2025
be88f13
changed dockerfile for uv
Jun 8, 2025
a62d77a
updated ci for uv
Jun 9, 2025
c5daf82
updated depends installing in ci
Jun 9, 2025
3f0d85a
added ci depends to toml
Jun 9, 2025
dd8f0f8
deleted extra \n
Jun 9, 2025
3c6865d
Merge pull request #84 from IlyaDev1/f/uv
IlyaDev1 Jun 9, 2025
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.venv/
__pycache__/
.idea/
.git/
.env
23 changes: 23 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Переменные для аппы
APP_NAME="Task Management API" # app/core/config.py
API_V1_STR="/api/v1" # app/core/config.py
ASYNC_DATABASE_URL="postgresql+asyncpg://postgres:postgres@db:5432/postgres" # app/core/config.py
SYNC_DATABASE_URL="postgresql://postgres:postgres@db:5432/postgres" # app/alembic/env.py
ASYNC_TEST_DATABASE_URL="postgresql+asyncpg://postgres:postgres@test_db:5432/postgres"
SYNC_TEST_DATABASE_URL="postgresql://postgres:postgres@test_db:5432/postgres"
DESCRIPTION="API for managing tasks and users" # app/core/config.py
DEBUG=False # app/core/config.py

# Переменные для БД
POSTGRES_PASSWORD=postgres # docker-compose (db)
POSTGRES_USER=postgres # docker-compose (db)
DATABASE_DB=postgres # docker-compose (db)

# Переменные для портов
DB_HOST_PORT=5433 # docker-compose (db)
DB_CONTAINER_PORT=5432 # docker-compose (db)
TEST_DB_HOST_PORT=5434
APP_HOST_PORT=8080 # docker-compose (app) & app/core/config.py
APP_CONTAINER_PORT=8085 # docker-compose (app)

MODE=PRODUCTION
126 changes: 126 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: CI Workflow

on:
push:
branches:
- '**'
pull_request:
branches:
- develop

jobs:
api-tests-only:
if: github.event_name == 'push'
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
APP_NAME: "Task Management API"
API_V1_STR: "/api/v1"
ASYNC_DATABASE_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/postgres"
DESCRIPTION: "API for managing tasks and users"
DEBUG: False
APP_HOST_PORT: 8080
MODE: TEST

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

- name: Install uv
run: pip install uv

- name: Sync dependencies
run: uv sync --extra ci --no-cache

- name: Wait for PostgreSQL
run: |
for i in {1..10}; do
pg_isready -h localhost -p 5432 && echo "DB is ready" && exit 0
echo "Waiting for DB..."
sleep 3
done
echo "DB did not become available in time" && exit 1

- name: Run migrations
env:
SYNC_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
run: uv run alembic upgrade head

- name: Run API tests
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
SYNC_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
run: uv run pytest -vv tests/test_api.py

all-tests:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
APP_NAME: "Task Management API"
API_V1_STR: "/api/v1"
ASYNC_DATABASE_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/postgres"
DESCRIPTION: "API for managing tasks and users"
DEBUG: False
APP_HOST_PORT: 8080
MODE: TEST

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

- name: Install uv
run: pip install uv

- name: Sync dependencies
run: uv sync --extra ci --no-cache

- name: Wait for PostgreSQL
run: |
for i in {1..10}; do
pg_isready -h localhost -p 5432 && echo "DB is ready" && exit 0
echo "Waiting for DB..."
sleep 3
done
echo "DB did not become available in time" && exit 1

- name: Run migrations
env:
SYNC_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
run: uv run alembic upgrade head

- name: Run all tests
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
SYNC_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
run: uv run pytest -vv
178 changes: 176 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,177 @@
.venv
.idea/
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

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

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy

- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
20 changes: 20 additions & 0 deletions .test.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Переменные для самой аппы
APP_NAME="Task Management API" # app/core/config.py
API_V1_STR="/api/v1" # app/core/config.py
ASYNC_DATABASE_URL="postgresql+asyncpg://postgres:postgres@localhost:5434/postgres" # app/core/config.py
SYNC_DATABASE_URL="postgresql://postgres:postgres@localhost:5434/postgres" # app/alembic/env.py
DESCRIPTION="API for managing tasks and users" # app/core/config.py
DEBUG=True # app/core/config.py

# Переменные для БД
POSTGRES_PASSWORD=postgres # docker-compose (db)
POSTGRES_USER=postgres # docker-compose (db)
DATABASE_DB=postgres # docker-compose (db)

# Переменные для портов
DB_CONTAINER_PORT=5432 # docker-compose (db)
TEST_DB_HOST_PORT=5434
APP_HOST_PORT=8080 # docker-compose (app) & app/core/config.py
APP_CONTAINER_PORT=8085 # docker-compose (app)

MODE=TEST
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.12-slim

WORKDIR /todo

RUN pip install --no-cache-dir uv

COPY uv.lock pyproject.toml /todo/

RUN uv sync --frozen --no-cache

COPY . /todo/

ENV PYTHONWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/todo

CMD uv run alembic upgrade head && uv run python app/main.py
Loading