Skip to content

Commit e0fb6d6

Browse files
authored
Merge pull request #117 from sergioteula/release-code-format-and-pipeline
Release code format and pipeline
2 parents 6613782 + 2b360f9 commit e0fb6d6

File tree

154 files changed

+1271
-20646
lines changed

Some content is hidden

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

154 files changed

+1271
-20646
lines changed

.coveragerc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[run]
2+
branch = True
3+
source = amazon_paapi
4+
relative_files = True
5+
omit = **/sdk/**
6+
7+
[report]
8+
fail_under = 80
9+
skip_covered = true
10+
skip_empty = true
11+
12+
[html]
13+
directory = coverage_html_report
14+
skip_covered = false

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = W503,E203,F401
4+
exclude = */sdk/*

.githooks/pre-push

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#! /bin/bash -e
2+
3+
ROOT_DIR="$(git rev-parse --show-toplevel)"
4+
source "${ROOT_DIR}/scripts/helpers"
5+
6+
./scripts/check_isort
7+
./scripts/check_black
8+
./scripts/check_flake8
9+
./scripts/check_pylint
10+
./scripts/run_tests
11+
12+
header "Proceeding with push"

.github/workflows/codecov-upload.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Lint and test
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
pull-requests: read
8+
9+
jobs:
10+
11+
isort:
12+
runs-on: ubuntu-latest
13+
container:
14+
image: sergioteula/pytools
15+
volumes:
16+
- ${{github.workspace}}:/code
17+
steps:
18+
- name: Check out code
19+
uses: actions/checkout@v3
20+
- name: Check imports order
21+
run: ./scripts/check_isort
22+
23+
black:
24+
runs-on: ubuntu-latest
25+
container:
26+
image: sergioteula/pytools
27+
volumes:
28+
- ${{github.workspace}}:/code
29+
steps:
30+
- name: Check out code
31+
uses: actions/checkout@v3
32+
- name: Check code format
33+
run: ./scripts/check_black
34+
35+
flake8:
36+
runs-on: ubuntu-latest
37+
container:
38+
image: sergioteula/pytools
39+
volumes:
40+
- ${{github.workspace}}:/code
41+
steps:
42+
- name: Check out code
43+
uses: actions/checkout@v3
44+
- name: Check code errors
45+
run: ./scripts/check_flake8
46+
47+
pylint:
48+
runs-on: ubuntu-latest
49+
container:
50+
image: sergioteula/pytools
51+
volumes:
52+
- ${{github.workspace}}:/code
53+
steps:
54+
- name: Check out code
55+
uses: actions/checkout@v3
56+
- name: Check code errors
57+
run: ./scripts/check_pylint
58+
59+
test:
60+
runs-on: ubuntu-latest
61+
container:
62+
image: sergioteula/pytools
63+
volumes:
64+
- ${{github.workspace}}:/code
65+
steps:
66+
- name: Check out code
67+
uses: actions/checkout@v3
68+
- name: Run tests
69+
run: ./scripts/run_tests
70+
- name: Save code coverage file
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: coverage
74+
path: coverage.xml
75+
76+
sonar:
77+
runs-on: ubuntu-latest
78+
needs: [test]
79+
steps:
80+
- name: Check out code
81+
uses: actions/checkout@v3
82+
with:
83+
fetch-depth: 0
84+
- name: Download a single artifact
85+
uses: actions/download-artifact@v3
86+
with:
87+
name: coverage
88+
- name: Check code errors
89+
uses: SonarSource/sonarcloud-github-action@master
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/python-publish.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
41
name: Upload Python Package
52

63
on:
74
release:
85
types: [created]
96

107
jobs:
11-
deploy:
128

9+
deploy:
1310
runs-on: ubuntu-latest
14-
1511
steps:
16-
- uses: actions/checkout@v2
12+
- name: Check out code
13+
uses: actions/checkout@v3
1714
- name: Set up Python
18-
uses: actions/setup-python@v2
15+
uses: actions/setup-python@v4
1916
with:
2017
python-version: '3.x'
2118
- name: Install dependencies
2219
run: |
2320
python -m pip install --upgrade pip
2421
pip install setuptools wheel twine
22+
- name: Update version number
23+
run: |
24+
sed -i 's/<PACKAGE_VERSION>/${{ github.ref_name }}/' setup.py
2525
- name: Build and publish
2626
env:
2727
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.DS_Store
44
secrets.py
55
test.py
6+
coverage_html_report
67

78

89
# Byte-compiled / optimized / DLL files

.shellcheckrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ~/.shellcheckrc
2+
3+
disable=SC1091

README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Amazon Product Advertising API 5.0 wrapper for Python
22

3-
A simple Python wrapper for the [last version of the Amazon Product Advertising API](https://webservices.amazon.com/paapi5/documentation/quick-start/using-sdk.html). This module allows interacting with Amazon using the official API in an easier way.
3+
A simple Python wrapper for the [last version of the Amazon Product Advertising
4+
API](https://webservices.amazon.com/paapi5/documentation/quick-start/using-sdk.html).
5+
This module allows interacting with Amazon using the official API in an easier way.
46

57
[![PyPI](https://img.shields.io/pypi/v/python-amazon-paapi?color=%231182C2&label=PyPI)](https://pypi.org/project/python-amazon-paapi/)
68
[![Python](https://img.shields.io/badge/Python->3.6-%23FFD140)](https://www.python.org/)
79
[![License](https://img.shields.io/badge/License-MIT-%23e83633)](https://github.com/sergioteula/python-amazon-paapi/blob/master/LICENSE)
810
[![Amazon API](https://img.shields.io/badge/Amazon%20API-5.0-%23FD9B15)](https://webservices.amazon.com/paapi5/documentation/)
9-
[![Codecov](https://img.shields.io/codecov/c/github/sergioteula/python-amazon-paapi?label=Coverage)](https://app.codecov.io/gh/sergioteula/python-amazon-paapi/)
11+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=sergioteula_python-amazon-paapi&metric=coverage)](https://sonarcloud.io/summary/new_code?id=sergioteula_python-amazon-paapi)
12+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=sergioteula_python-amazon-paapi&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=sergioteula_python-amazon-paapi)
1013
[![Support](https://img.shields.io/badge/Support-Good-brightgreen)](https://github.com/sergioteula/python-amazon-paapi/issues)
1114
[![PyPI - Downloads](https://img.shields.io/pypi/dm/python-amazon-paapi?label=Installs)](https://pypi.org/project/python-amazon-paapi/)
1215

13-
> If you are still using the old version, go [here](https://github.com/sergioteula/python-amazon-paapi/blob/master/amazon/README.md) for documentation or check our
14-
[migration guide](https://github.com/sergioteula/python-amazon-paapi/blob/master/docs/pages/migration-guide.md).
15-
1616
## Features
1717

1818
- Object oriented interface for simple usage.
@@ -92,13 +92,30 @@ asin = get_asin('https://www.amazon.com/dp/B01N5IB20Q')
9292

9393
**Throttling:**
9494

95-
Throttling value represents the wait time in seconds between API calls, being the default value 1 second. Use it to avoid reaching Amazon request limits.
95+
Throttling value represents the wait time in seconds between API calls, being the
96+
default value 1 second. Use it to avoid reaching Amazon request limits.
9697

9798
```python
9899
amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=4) # Makes 1 request every 4 seconds
99100
amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=0) # No wait time between requests
100101
```
101102

103+
## Contribution
104+
105+
Creating pull requests for this repo is higly appreciated to add new features or solve
106+
bugs. To help during development process, githooks can be activated to run some scripts
107+
before pushing new commits. This will run checks for code format and tests, to ensure
108+
everything follows this repo guidelines. Use next command to activate them:
109+
110+
```
111+
git config core.hooksPath .githooks
112+
```
113+
114+
The same checks will also run on the repo with GitHub Actions to ensure all tests pass
115+
before merge.
116+
102117
## License
103118

104-
Copyright © 2021 Sergio Abad. See [license](https://github.com/sergioteula/python-amazon-paapi/blob/master/LICENSE) for details.
119+
Copyright © 2021 Sergio Abad. See
120+
[license](https://github.com/sergioteula/python-amazon-paapi/blob/master/LICENSE) for
121+
details.

amazon/README.md

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

0 commit comments

Comments
 (0)