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: 27 additions & 0 deletions .agent/rules/code-style-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
trigger: always_on
---

# General

- All code in English
- Add comments only when needed
- Add docstrings for every function
- Use type hints in all functions
- Use f-strings
- Follow PEP 8 and clean code principles
- Imports always at the top
- Avoid short variable names, abbreviations, or single-letter names
- Avoid the use of noqa unless strictly necessary

# Test

- Add tests following TDD practices
- Mirror the amazon_paapi structure in the tests directory
- Use unittest.TestCase with setUp() and tearDown()
- Use unittest assertions, not native assert
- Use @patch decorators for mocks (avoid context managers)

# References

- Documentation for the Product Advertising API here: https://webservices.amazon.com/paapi5/documentation/operations.html
14 changes: 0 additions & 14 deletions .coveragerc

This file was deleted.

4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
API_KEY=
API_SECRET=
AFFILIATE_TAG=
COUNTRY_CODE=
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

12 changes: 0 additions & 12 deletions .githooks/pre-push

This file was deleted.

6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/---bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ assignees: ''
---

**Steps to reproduce**
1.
2.
3.
1.
2.
3.

**Code example**
```python
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/---feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

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

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Run linters and tests

on:
push:
branches:
- master
pull_request:

permissions:
pull-requests: read

jobs:
changelog:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Check CHANGELOG was updated
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^CHANGELOG.md$"; then
echo "✅ CHANGELOG.md was updated"
else
echo "❌ ERROR: CHANGELOG.md was not updated"
echo "Please add your changes to the CHANGELOG.md file"
exit 1
fi

check:
runs-on: ubuntu-latest
env:
API_KEY: ${{ secrets.API_KEY }}
API_SECRET: ${{ secrets.API_SECRET }}
AFFILIATE_TAG: ${{ secrets.AFFILIATE_TAG }}
COUNTRY_CODE: ${{ secrets.COUNTRY_CODE }}

steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"

- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Cache UV dependencies
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-

- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-

- name: Run all checks
run: |
uv run pre-commit run --all-files

test:
runs-on: ubuntu-latest
timeout-minutes: 2

strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]

steps:
- uses: actions/checkout@v5

- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Cache UV dependencies
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-py${{ matrix.python-version }}-

- name: Run tests
run: uv run --python "${{ matrix.python-version }}" pytest -rs --no-cov
94 changes: 0 additions & 94 deletions .github/workflows/lint-and-test.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Update version number
run: |
sed -i 's/version = ".*"/version = "${{ github.ref_name }}"/' pyproject.toml
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
31 changes: 0 additions & 31 deletions .github/workflows/python-publish.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Create Release

on:
workflow_dispatch:

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Extract version and notes from CHANGELOG
id: changelog
run: |
# Extract version from first ## [x.x.x] header
VERSION=$(grep -m1 -oP '## \[\K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md)
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Extract release notes (content between first and second ## headers)
NOTES=$(awk '/^## \['"$VERSION"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md)
# Handle multiline output
{
echo "notes<<EOF"
echo "$NOTES"
echo "EOF"
} >> $GITHUB_OUTPUT
- name: Check if tag already exists
id: check_tag
run: |
if git rev-parse "v${{ steps.changelog.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Create Release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.changelog.outputs.version }}
name: v${{ steps.changelog.outputs.version }}
body: ${{ steps.changelog.outputs.notes }}
draft: false
prerelease: false

- name: Skip release (tag exists)
if: steps.check_tag.outputs.exists == 'true'
run: |
echo "⚠️ Tag v${{ steps.changelog.outputs.version }} already exists. Skipping release creation."
exit 1
Loading