Skip to content

Commit 3e00276

Browse files
authored
Merge pull request #139 from sergioteula/add-ruff-and-uv
Modernize tooling: migrate to Ruff, uv, and pyproject.toml
2 parents 4d088f2 + e305a7c commit 3e00276

Some content is hidden

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

63 files changed

+1161
-721
lines changed

.agent/rules/code-style-guide.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
# General
6+
7+
- All code in English
8+
- Add comments only when needed
9+
- Add docstrings for every function
10+
- Use type hints in all functions
11+
- Use f-strings
12+
- Follow PEP 8 and clean code principles
13+
- Imports always at the top
14+
- Avoid short variable names, abbreviations, or single-letter names
15+
- Avoid the use of noqa unless strictly necessary
16+
17+
# Test
18+
19+
- Add tests following TDD practices
20+
- Mirror the amazon_paapi structure in the tests directory
21+
- Use unittest.TestCase with setUp() and tearDown()
22+
- Use unittest assertions, not native assert
23+
- Use @patch decorators for mocks (avoid context managers)
24+
25+
# References
26+
27+
- Documentation for the Product Advertising API here: https://webservices.amazon.com/paapi5/documentation/operations.html

.coveragerc

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

.env.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
API_KEY=
2+
API_SECRET=
3+
AFFILIATE_TAG=
4+
COUNTRY_CODE=

.flake8

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

.githooks/pre-push

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

.github/ISSUE_TEMPLATE/---bug-report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ assignees: ''
88
---
99

1010
**Steps to reproduce**
11-
1.
12-
2.
13-
3.
11+
1.
12+
2.
13+
3.
1414

1515
**Code example**
1616
```python

.github/ISSUE_TEMPLATE/---feature-request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ assignees: ''
88
---
99

1010
**Is your feature request related to a problem? Please describe.**
11-
A clear and concise description of what the problem is.
11+
A clear and concise description of what the problem is.
1212

1313
**Describe the solution you'd like**
1414
A clear and concise description of what you want to happen.

.github/workflows/check.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Run linters and tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions:
10+
pull-requests: read
11+
12+
jobs:
13+
changelog:
14+
if: github.event_name == 'pull_request'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Check CHANGELOG was updated
22+
run: |
23+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^CHANGELOG.md$"; then
24+
echo "✅ CHANGELOG.md was updated"
25+
else
26+
echo "❌ ERROR: CHANGELOG.md was not updated"
27+
echo "Please add your changes to the CHANGELOG.md file"
28+
exit 1
29+
fi
30+
31+
check:
32+
runs-on: ubuntu-latest
33+
env:
34+
API_KEY: ${{ secrets.API_KEY }}
35+
API_SECRET: ${{ secrets.API_SECRET }}
36+
AFFILIATE_TAG: ${{ secrets.AFFILIATE_TAG }}
37+
COUNTRY_CODE: ${{ secrets.COUNTRY_CODE }}
38+
39+
steps:
40+
- uses: actions/checkout@v5
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v6
44+
with:
45+
python-version: "3.13"
46+
47+
- name: Install UV
48+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
49+
50+
- name: Cache UV dependencies
51+
uses: actions/cache@v4
52+
with:
53+
path: ~/.cache/uv
54+
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
55+
restore-keys: |
56+
${{ runner.os }}-uv-
57+
58+
- name: Cache pre-commit
59+
uses: actions/cache@v4
60+
with:
61+
path: ~/.cache/pre-commit
62+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
63+
restore-keys: |
64+
${{ runner.os }}-pre-commit-
65+
66+
- name: Run all checks
67+
run: |
68+
uv run pre-commit run --all-files
69+
70+
test:
71+
runs-on: ubuntu-latest
72+
timeout-minutes: 2
73+
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
78+
79+
steps:
80+
- uses: actions/checkout@v5
81+
82+
- name: Install UV
83+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
84+
85+
- name: Cache UV dependencies
86+
uses: actions/cache@v4
87+
with:
88+
path: ~/.cache/uv
89+
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
90+
restore-keys: |
91+
${{ runner.os }}-uv-py${{ matrix.python-version }}-
92+
93+
- name: Run tests
94+
run: uv run --python "${{ matrix.python-version }}" pytest -rs --no-cov

.github/workflows/lint-and-test.yml

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

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.x"
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install build twine
21+
- name: Update version number
22+
run: |
23+
sed -i 's/version = ".*"/version = "${{ github.ref_name }}"/' pyproject.toml
24+
- name: Build and publish
25+
env:
26+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
27+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
28+
run: |
29+
python -m build
30+
twine upload dist/*

0 commit comments

Comments
 (0)