Skip to content

Commit e3272ca

Browse files
authored
Merge pull request #20 from ArielMAJ/BREAKING_CHANGE/general-project-improvements-and-updates
BREAKING_CHANGE: general project improvements and updates;
2 parents e809bda + 1404b92 commit e3272ca

52 files changed

Lines changed: 2210 additions & 2151 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ repos:
55
- id: poetry-check
66
- id: poetry-lock
77
- id: poetry-install
8+
- id: poetry-export
9+
name: Export requeriments.txt
10+
args:
11+
[
12+
"--without-hashes",
13+
"-o",
14+
"requirements.txt",
15+
"-f",
16+
"requirements.txt",
17+
]
18+
files: ^(pyproject\.toml|poetry\.lock)$
19+
820
- repo: https://github.com/pre-commit/pre-commit-hooks
921
rev: v4.5.0
1022
hooks:
@@ -90,12 +102,3 @@ repos:
90102
rev: v0.1.8
91103
hooks:
92104
- id: ruff
93-
94-
- repo: local
95-
hooks:
96-
- id: export-requirements
97-
name: Export requeriments.txt
98-
language: system
99-
pass_filenames: false
100-
entry: poetry export --without-hashes -o requirements.txt -f requirements.txt
101-
files: ^(pyproject\.toml|poetry\.lock)$

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9.18
1+
3.12.8

Makefile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
CONTAINER_ENGINE := $(shell which podman || which docker)
2+
COMPOSE := $(CONTAINER_ENGINE) compose
3+
14
ifneq ("$(wildcard .env)","")
25
include .env
36
export
47
endif
58

69
.PHONY: run
710
run: ## Run the project.
8-
poetry run python -m api
11+
poetry run python -m src.main
912

1013
.PHONY: install
1114
install: ## Install Python package dependencies.
@@ -20,11 +23,11 @@ test: ## Run automated tests.
2023

2124
.PHONY: up-database
2225
up-database: ## Start database container.
23-
docker compose up -d postgres --force-recreate
26+
$(COMPOSE) up -d postgres --force-recreate
2427

2528
.PHONY: down
2629
down: ## Stop all containers.
27-
docker compose down
30+
$(COMPOSE) down
2831

2932
.PHONY: revision
3033
revision: ## Create a new database revision following the repository's models.
@@ -38,13 +41,13 @@ migrate: ## Run database migrations.
3841
downgrade: ## Undo last database migration.
3942
poetry run alembic downgrade -1
4043

41-
.PHONY: docker-rm
42-
docker-rm: ## Remove all docker containers.
43-
docker rm -f $$(docker ps -a -q)
44+
.PHONY: remove-containers
45+
remove-containers: ## Remove all containers.
46+
$(CONTAINER_ENGINE) rm -f $$($(CONTAINER_ENGINE) ps -a -q)
4447

45-
.PHONY: docker-rmi
46-
docker-rmi: ## Remove all downloaded docker images.
47-
docker rmi -f $$(docker images -q)
48+
.PHONY: remove-container-images
49+
remove-container-images: ## Remove all downloaded container images.
50+
$(CONTAINER_ENGINE) rmi -f $$($(CONTAINER_ENGINE) images -q)
4851

4952
.PHONY: export-requirements
5053
export-requirements: ## Export poetry managed packages to a requirements.txt (needed by Vercel).
@@ -62,6 +65,10 @@ patch: ## Bump project version to next patch (bugfix release).
6265
minor: ## Bump project version to next minor (feature release).
6366
poetry version minor
6467

68+
.PHONY: major
69+
major: ## Bump project version to next major (breaking change).
70+
poetry version major
71+
6572
.PHONY: clean
6673
clean: ## Clean project's temporary files.
6774
find . -name '__pycache__' -exec rm -rf {} +

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ make pre-commit
113113

114114
For changes to the database, you can follow these steps:
115115

116-
1. Make changes to the database models in `api/database/models`.
117-
2. Make sure new models are imported in `api/database/__init__.py`.
116+
1. Make changes to the database models in `src/database/models`.
117+
2. Make sure new models are imported in `src/database/__init__.py`.
118118
3. Create a new revision:
119119
```bash
120120
make revision
121121
```
122-
4. Check the new revision file created in `api/database/alembic/versions` and make sure it reflects the changes you expect.
122+
4. Check the new revision file created in `src/database/alembic/versions` and make sure it reflects the changes you expect.
123123
5. Apply the migration to your database (the database needs to be running and available):
124124
```bash
125125
make migrate

alembic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[alembic]
44
# path to migration scripts
55
# Use forward slashes (/) also on windows to provide an os agnostic path
6-
script_location = api/database/alembic
6+
script_location = src/database/alembic
77

88
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
99
# Uncomment the line below if you want the files to be prepended with date and time

api/database/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

api/entrypoints/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

api/schemas/user.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

api/vercel.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)