Skip to content

Commit a759c37

Browse files
authored
Merge pull request #318 from nanotaboada/feature/requirements
refactor(app)!: split requirements files
2 parents fa3a773 + aea9c50 commit a759c37

File tree

6 files changed

+160
-135
lines changed

6 files changed

+160
-135
lines changed

.flake8

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
11
[flake8]
2-
# The GitHub editor is 127 chars wide
2+
# Maximum line length allowed
33
max-line-length = 127
4+
5+
# Maximum allowed code complexity (10 is a reasonable threshold)
6+
max-complexity = 10
7+
8+
# Only check for specific error codes:
9+
# - E9 -> Syntax errors
10+
# - F63 -> Issues related to improper usage of `+=`, `-=`, etc.
11+
# - F7 -> Issues related to improper `break`, `continue`, etc.
12+
# - F82 -> Undefined names
13+
select = E9,F63,F7,F82
14+
15+
# Exclude `.venv` from linting (prevents checking dependencies)
16+
exclude = .venv
17+
18+
# Print the count of linting errors
19+
count = True
20+
21+
# Show the exact source of the error
22+
show-source = True
23+
24+
# Display statistics of errors at the end of the report
25+
statistics = True
26+
27+
# Enable verbose mode for more detailed output
28+
verbose = True

.github/workflows/python-app.yml

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -9,82 +9,88 @@ on:
99
pull_request:
1010
branches: [ master ]
1111

12-
jobs:
12+
env:
13+
PYTHON_VERSION: 3.9
1314

14-
build:
15+
jobs:
16+
lint:
1517
runs-on: ubuntu-latest
1618
steps:
17-
18-
- name: Checkout repository
19-
uses: actions/checkout@v4
20-
21-
- name: Set up Python 3.9
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: 3.9
25-
cache: 'pip'
26-
27-
- name: Install packages with pip
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install flake8 pytest pytest-cov
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32-
33-
- name: Lint with Flake8
34-
run: |
35-
# stop the build if there are Python syntax errors or undefined names
36-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39-
40-
- name: Run tests with pytest
41-
run: |
42-
pytest -v
43-
44-
- name: Generate coverage report with pytest-cov
45-
run: |
46-
pytest --cov=./ --cov-report=xml --cov-report=term
47-
48-
- name: Upload coverage report artifact
49-
uses: actions/upload-artifact@v4
50-
with:
51-
name: coverage.xml
52-
path: ./coverage.xml
53-
54-
coverage-codecov:
55-
needs: build
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ env.PYTHON_VERSION }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ env.PYTHON_VERSION }}
26+
cache: 'pip'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -r requirements-lint.txt
32+
33+
- name: Lint with Flake8
34+
run: |
35+
flake8 .
36+
37+
test:
38+
needs: lint
5639
runs-on: ubuntu-latest
5740
steps:
58-
59-
- name: Checkout repository
60-
uses: actions/checkout@v4
61-
62-
- name: Download coverage report artifact
63-
uses: actions/download-artifact@v4
64-
with:
65-
name: coverage.xml
66-
67-
- name: Upload coverage report to Codecov
68-
uses: codecov/codecov-action@v5
69-
with:
70-
token: ${{ secrets.CODECOV_TOKEN }}
71-
files: coverage.xml
72-
73-
coverage-codacy:
74-
needs: build
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Python ${{ env.PYTHON_VERSION }}
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: ${{ env.PYTHON_VERSION }}
48+
cache: 'pip'
49+
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install -r requirements-test.txt
54+
55+
- name: Run tests with pytest
56+
run: |
57+
pytest -v
58+
59+
- name: Generate coverage report
60+
run: |
61+
pytest --cov=./ --cov-report=xml --cov-report=term
62+
63+
- name: Upload coverage report artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: coverage.xml
67+
path: ./coverage.xml
68+
69+
coverage:
70+
needs: test
7571
runs-on: ubuntu-latest
72+
strategy:
73+
matrix:
74+
service: [codecov, codacy]
7675
steps:
77-
78-
- name: Checkout repository
79-
uses: actions/checkout@v4
80-
81-
- name: Download coverage report artifact
82-
uses: actions/download-artifact@v4
83-
with:
84-
name: coverage.xml
85-
86-
- name: Upload coverage report to Codacy
87-
uses: codacy/codacy-coverage-reporter-action@v1
88-
with:
89-
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
90-
coverage-reports: coverage.xml
76+
- name: Checkout repository
77+
uses: actions/checkout@v4
78+
79+
- name: Download coverage report artifact
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: coverage.xml
83+
84+
- name: Upload coverage report to ${{ matrix.service }}
85+
if: ${{ matrix.service == 'codecov' }}
86+
uses: codecov/codecov-action@v5
87+
with:
88+
token: ${{ secrets.CODECOV_TOKEN }}
89+
files: coverage.xml
90+
91+
- name: Upload coverage report to ${{ matrix.service }}
92+
if: ${{ matrix.service == 'codacy' }}
93+
uses: codacy/codacy-coverage-reporter-action@v1
94+
with:
95+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
96+
coverage-reports: coverage.xml

requirements-lint.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flake8==7.1.2

requirements-test.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-r requirements.txt
2+
3+
pytest==8.3.5
4+
pytest-cov==6.0.0
5+
pytest-sugar==1.0.0
6+
gevent==24.11.1

requirements.txt

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,5 @@
1-
aiohttp==3.11.14
2-
aiosignal==1.3.2
3-
aiosqlite==0.21.0
4-
annotated-types==0.7.0
5-
anyio==4.8.0
6-
attrs==25.3.0
7-
certifi==2025.1.31
8-
click==8.1.8
9-
coverage==7.7.0
10-
dnspython==2.7.0
11-
email_validator==2.2.0
12-
fastapi==0.115.11
1+
# https://fastapi.tiangolo.com/#standard-dependencies
2+
fastapi[standard]==0.115.12
133
fastapi-cache2==0.2.2
14-
fastapi-cli==0.0.7
15-
flake8==7.1.2
16-
frozenlist==1.5.0
17-
gevent==24.11.1
18-
greenlet==3.1.1
19-
h11==0.14.0
20-
httpcore==1.0.7
21-
httptools==0.6.4
22-
httpx==0.28.1
23-
idna==3.10
24-
iniconfig==2.0.0
25-
Jinja2==3.1.5
26-
markdown-it-py==3.0.0
27-
MarkupSafe==3.0.2
28-
mccabe==0.7.0
29-
mdurl==0.1.2
30-
multidict==6.1.0
31-
packaging==24.2
32-
pendulum==3.0.0
33-
pluggy==1.5.0
34-
pycodestyle==2.12.1
35-
pydantic==2.10.6
36-
pydantic_core
37-
pyflakes==3.2.0
38-
Pygments==2.19.1
39-
pytest==8.3.5
40-
pytest-cov==6.0.0
41-
pytest-sugar==1.0.0
42-
python-dateutil==2.9.0.post0
43-
python-dotenv==1.0.1
44-
python-multipart==0.0.20
45-
PyYAML==6.0.2
46-
rich==13.9.4
47-
setuptools==76.0.0
48-
shellingham==1.5.4
49-
six==1.17.0
50-
sniffio==1.3.1
514
SQLAlchemy==2.0.39
52-
starlette
53-
termcolor==2.5.0
54-
time-machine==2.16.0
55-
typer==0.15.2
56-
typing_extensions==4.12.2
57-
tzdata==2025.1
58-
uvicorn==0.34.0
59-
uvloop==0.21.0
60-
watchfiles==1.0.4
61-
websockets==15.0.1
62-
yarl==1.18.3
63-
zope.event==5.0
64-
zope.interface==7.2
5+
aiosqlite==0.21.0

0 commit comments

Comments
 (0)