Skip to content

Commit

Permalink
Merge pull request #3 from koldakov/feature/rewrite-project
Browse files Browse the repository at this point in the history
Rewrite the project
  • Loading branch information
koldakov committed Jun 1, 2024
2 parents 0e01137 + 7558fa7 commit 24efc8a
Show file tree
Hide file tree
Showing 117 changed files with 5,038 additions and 3,004 deletions.
Empty file removed .dockerignore
Empty file.
7 changes: 3 additions & 4 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ruff pytest
python -m pip install -r requirements.txt
make install-dev
- name: Code style
run: |
pre-commit run --all-files
poetry run pre-commit run --all-files
- name: Pytest
run: |
make tests
make test
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ repos:
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=700"]
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-symlinks

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
rev: v0.4.2
hooks:
- id: ruff
- id: ruff-format
Expand All @@ -27,7 +28,7 @@ repos:
- manual

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.10.0
hooks:
- id: mypy
pass_filenames: false
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Changelog

All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2024-06-01

### Added

- API: Character selection by id
- API: Paginated characters selection by gender, status, species, order by, order by direction
- API: Character search by name
- API: Episode selection by id
- API: Paginated episodes selection
- API: Season selection by id
- API: Paginated seasons selection
- API: Callbacks for characters, episodes, seasons
- API: Server Sent Events (SSE) for characters
- API: User registration
- API: User authorization
- API: User activation
- API: User confirmation resend message
- API: User information update
- GraphQL: Character selection by id
- GraphQL: Paginated (Edged) characters selection by gender, status, species, order by, order by direction
- GraphQL: Episode selection by id
- GraphQL: Paginated (Edged) episodes selection
- GraphQL: Season selection by id
- GraphQL: Paginated (Edged) seasons selection

[1.0.0]: https://github.com/koldakov/futuramaapi/releases/tag/1.0.0
39 changes: 19 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
SHELL = /bin/bash
PYTHON = python3.12

help: # Display this message
@sed -ne '/@sed/!s/# //p' $(MAKEFILE_LIST)

messages-init: # locale=LANG, init LANG language
@test $${locale?Please specify locale. Example \"locale=en_CA\"}
@pybabel init -l $(locale) -i locale/messages.pot -d locale
install-dev: # Install DEV/TEST Environ and dependencies
@echo "Upgrading pip"
@$(PYTHON) -m pip install --upgrade pip
@echo "Installing poetry"
@$(PYTHON) -m pip install poetry
@echo "Installing dependencies"
@$(PYTHON) -m poetry install

messages-extract: # Extract messages to locale/messages.pot
@pybabel extract \
--version=0.0.1 \
[email protected] \
--project=FuturamaAPI \
--copyright-holder=FuturamaAPI \
--mapping babel.cfg \
--output-file=locale/messages.pot \
.
install: # Install Environ and dependencies
@echo "Upgrading pip"
@$(PYTHON) -m pip install --upgrade pip
@echo "Installing poetry"
@$(PYTHON) -m pip install poetry
@echo "Installing dependencies"
@$(PYTHON) -m poetry install --without dev --without test

messages: # Update all locales
@$(MAKE) messages-extract
@pybabel update --input-file=locale/messages.pot --output-dir=locale
test: # Run tests
@poetry run $(PYTHON) -m pytest

messages-compile: # Generate .mo files for all locales
@pybabel compile --directory=locale

tests: # Run tests
@python -m pytest
migrate: # Migrate
@poetry run $(PYTHON) -m alembic upgrade head
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ If you create models in a new file please import it in env.py.
Because alembic does not detect child classes.

```commandline
alembic revision --autogenerate -m "Revision Name"
alembic upgrade head
poetry run alembic revision --autogenerate -m "Revision Name"
poetry run alembic upgrade head
```

<p align="right">(<a href="#top">back to top</a>)</p>
Expand All @@ -72,7 +72,7 @@ export $(cat .env | xargs)
# Compile tranlations
make messages-compile
# Run hypercorn server
hypercorn --reload app.main:app
hypercorn --reload futuramaapi.main:app
```

<p align="right">(<a href="#top">back to top</a>)</p>
Expand Down
2 changes: 1 addition & 1 deletion alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[alembic]
# path to migration scripts
script_location = alembic
script_location = futuramaapi/repositories/migrations

# 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
Expand Down
6 changes: 0 additions & 6 deletions app/core/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions app/graph_ql/routers.py

This file was deleted.

Loading

0 comments on commit 24efc8a

Please sign in to comment.