Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
exclude = venv,.venv,build,dist,__pycache__,.pytest_cache,.mypy_cache,*.egg-info
max-line-length = 127
max-complexity = 10
inline-quotes = double
count = True
show-source = True
statistics = True
32 changes: 14 additions & 18 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,26 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
# Install a specific version of uv.
version: "0.9.18"
enable-cache: true
- name: Install dependencies
run: |
pip install --user pipx
python3 -m pipx ensurepath
pipx install poetry
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --inline-quotes='double' --statistics
- name: Run mypy
uv sync --locked --all-extras --dev
- name: Lint with flake8 and run mypy
run: |
poetry run mypy --strict .
uv run poe lint
- name: Test with pytest
run: |
poetry run coverage run --source=pyfastapi -m pytest
poetry run coverage xml -o coverage.xml
uv run poe coverage
- name: Test coverage report
uses: orgoro/coverage@v3.1
if: ${{ github.event_name == 'pull_request' }}
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.12
1,525 changes: 0 additions & 1,525 deletions poetry.lock

This file was deleted.

1 change: 0 additions & 1 deletion pyfastapi/repositories/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from .base import BaseRepository, extract_sort, extract_query



class PersonRepository(BaseRepository):
def get_person(self, id_: int) -> Person | None:
stmt = select(Person, Country).join(Country, Person.country_code == Country.code).where(Person.id == id_)
Expand Down
63 changes: 44 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,52 @@
[tool.poetry]
[project]
name = "pyfastapi"
version = "0.1.0"
description = ""
authors = ["Heinrich Chan <guiltyrage10@gmail.com>"]
authors = [{ name = "Heinrich Chan", email = "guiltyrage10@gmail.com" }]
requires-python = ">=3.12,<4"
readme = "README.md"
dependencies = [
"fastapi[all]>=0.109.0,<0.110",
"fastapi-pagination>=0.12.14,<0.13",
"sqlalchemy>=2.0.25,<3",
"alembic>=1.13.1,<2",
"toolz>=0.12.1,<0.13",
]

[tool.poetry.dependencies]
python = "^3.12"
fastapi = {extras = ["all"], version = "^0.109.0"}
fastapi-pagination = "^0.12.14"
sqlalchemy = "^2.0.25"
alembic = "^1.13.1"
toolz = "^0.12.1"
[dependency-groups]
dev = [
"pytest>=8.0.0,<9",
"flake8>=7.0.0,<8",
"faker>=22.6.0,<23",
"coverage>=7.4.1,<8",
"mypy>=1.8.0,<2",
"flake8-quotes>=3.4.0,<4",
"poethepoet>=0.39.0",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry.group.dev.dependencies]
pytest = "^8.0.0"
flake8 = "^7.0.0"
faker = "^22.6.0"
coverage = "^7.4.1"
mypy = "^1.8.0"
flake8-quotes = "^3.4.0"
[tool.mypy]
exclude = [
"venv/",
".venv/",
"build/",
"dist/",
".pytest_cache/",
".mypy_cache/",
"htmlcov/",
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poe.tasks.coverage]
shell = "coverage run -m pytest && coverage report && coverage xml -o coverage.xml"

[tool.poe.tasks.flake8]
shell = "flake8 ."

[tool.poe.tasks.mypy]
shell = "mypy --strict ."

[tool.poe.tasks.lint]
sequence = ["flake8", "mypy"]
Loading