Skip to content

Commit da9bd11

Browse files
committed
added ruff and uv
1 parent 4d088f2 commit da9bd11

Some content is hidden

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

53 files changed

+877
-521
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: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Run linters and tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
pull-requests: read
9+
10+
env:
11+
API_KEY: ${{ secrets.API_KEY }}
12+
API_SECRET: ${{ secrets.API_SECRET }}
13+
AFFILIATE_TAG: ${{ secrets.AFFILIATE_TAG }}
14+
COUNTRY_CODE: ${{ secrets.COUNTRY_CODE }}
15+
16+
jobs:
17+
check:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v5
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version: "3.13"
27+
28+
- name: Install UV
29+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
30+
31+
- name: Cache UV dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.cache/uv
35+
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
36+
restore-keys: |
37+
${{ runner.os }}-uv-
38+
39+
- name: Cache pre-commit
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/.cache/pre-commit
43+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pre-commit-
46+
47+
- name: Run all checks
48+
run: |
49+
SKIP=test uv run pre-commit run --all-files
50+
51+
test:
52+
runs-on: ubuntu-latest
53+
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
python-version:
58+
["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
59+
60+
steps:
61+
- uses: actions/checkout@v5
62+
63+
- name: Install UV
64+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
65+
66+
- name: Cache UV dependencies
67+
uses: actions/cache@v4
68+
with:
69+
path: ~/.cache/uv
70+
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
71+
restore-keys: |
72+
${{ runner.os }}-uv-py${{ matrix.python-version }}-
73+
74+
- name: Run tests
75+
run: uv run --python "${{ matrix.python-version }}" pytest -rs --no-cov

.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/*

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# Custom folders and files to ignore
22
.vscode/
33
.DS_Store
4-
secrets.py
5-
test.py
64
coverage_html_report
75

8-
96
# Byte-compiled / optimized / DLL files
107
__pycache__/
118
*.py[cod]
@@ -32,6 +29,7 @@ wheels/
3229
.installed.cfg
3330
*.egg
3431
MANIFEST
32+
uv.lock
3533

3634
# PyInstaller
3735
# Usually these files are written by a python script from a template

0 commit comments

Comments
 (0)