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
27 changes: 26 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
[flake8]
# The GitHub editor is 127 chars wide
# Maximum line length allowed
max-line-length = 127

# Maximum allowed code complexity (10 is a reasonable threshold)
max-complexity = 10

# Only check for specific error codes:
# - E9 -> Syntax errors
# - F63 -> Issues related to improper usage of `+=`, `-=`, etc.
# - F7 -> Issues related to improper `break`, `continue`, etc.
# - F82 -> Undefined names
select = E9,F63,F7,F82

# Exclude `.venv` from linting (prevents checking dependencies)
exclude = .venv

# Print the count of linting errors
count = True

# Show the exact source of the error
show-source = True

# Display statistics of errors at the end of the report
statistics = True

# Enable verbose mode for more detailed output
verbose = True
150 changes: 78 additions & 72 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,82 +9,88 @@ on:
pull_request:
branches: [ master ]

jobs:
env:
PYTHON_VERSION: 3.9

build:
jobs:
lint:
runs-on: ubuntu-latest
steps:

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

- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pip'

- name: Install packages with pip
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Lint with Flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Run tests with pytest
run: |
pytest -v

- name: Generate coverage report with pytest-cov
run: |
pytest --cov=./ --cov-report=xml --cov-report=term

- name: Upload coverage report artifact
uses: actions/upload-artifact@v4
with:
name: coverage.xml
path: ./coverage.xml

coverage-codecov:
needs: build
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-lint.txt

- name: Lint with Flake8
run: |
flake8 .

test:
needs: lint
runs-on: ubuntu-latest
steps:

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

- name: Download coverage report artifact
uses: actions/download-artifact@v4
with:
name: coverage.xml

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml

coverage-codacy:
needs: build
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt

- name: Run tests with pytest
run: |
pytest -v

- name: Generate coverage report
run: |
pytest --cov=./ --cov-report=xml --cov-report=term

- name: Upload coverage report artifact
uses: actions/upload-artifact@v4
with:
name: coverage.xml
path: ./coverage.xml

coverage:
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
service: [codecov, codacy]
steps:

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

- name: Download coverage report artifact
uses: actions/download-artifact@v4
with:
name: coverage.xml

- name: Upload coverage report to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
- name: Checkout repository
uses: actions/checkout@v4

- name: Download coverage report artifact
uses: actions/download-artifact@v4
with:
name: coverage.xml

- name: Upload coverage report to ${{ matrix.service }}
if: ${{ matrix.service == 'codecov' }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml

- name: Upload coverage report to ${{ matrix.service }}
if: ${{ matrix.service == 'codacy' }}
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
1 change: 1 addition & 0 deletions requirements-lint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flake8==7.1.2
6 changes: 6 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-r requirements.txt

pytest==8.3.5
pytest-cov==6.0.0
pytest-sugar==1.0.0
gevent==24.11.1
65 changes: 3 additions & 62 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,64 +1,5 @@
aiohttp==3.11.14
aiosignal==1.3.2
aiosqlite==0.21.0
annotated-types==0.7.0
anyio==4.8.0
attrs==25.3.0
certifi==2025.1.31
click==8.1.8
coverage==7.7.0
dnspython==2.7.0
email_validator==2.2.0
fastapi==0.115.11
# https://fastapi.tiangolo.com/#standard-dependencies
fastapi[standard]==0.115.12
fastapi-cache2==0.2.2
fastapi-cli==0.0.7
flake8==7.1.2
frozenlist==1.5.0
gevent==24.11.1
greenlet==3.1.1
h11==0.14.0
httpcore==1.0.7
httptools==0.6.4
httpx==0.28.1
idna==3.10
iniconfig==2.0.0
Jinja2==3.1.5
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mccabe==0.7.0
mdurl==0.1.2
multidict==6.1.0
packaging==24.2
pendulum==3.0.0
pluggy==1.5.0
pycodestyle==2.12.1
pydantic==2.10.6
pydantic_core
pyflakes==3.2.0
Pygments==2.19.1
pytest==8.3.5
pytest-cov==6.0.0
pytest-sugar==1.0.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.20
PyYAML==6.0.2
rich==13.9.4
setuptools==76.0.0
shellingham==1.5.4
six==1.17.0
sniffio==1.3.1
SQLAlchemy==2.0.39
starlette
termcolor==2.5.0
time-machine==2.16.0
typer==0.15.2
typing_extensions==4.12.2
tzdata==2025.1
uvicorn==0.34.0
uvloop==0.21.0
watchfiles==1.0.4
websockets==15.0.1
yarl==1.18.3
zope.event==5.0
zope.interface==7.2
aiosqlite==0.21.0
Loading
Loading