Skip to content

Commit 9e07c86

Browse files
committed
feat!: rewrite the library as app-store-web-scraper
- `app-store-scraper` has been renamed to `app-store-web-scraper`. - `AppStore` is now `AppStoreEntry`. - The `review()` method is now named `reviews()` and returns an iterator of `AppReview` objects instead of a list of dicts. This makes the API more pleasant to use and offers more control for the caller. - `urllib3` is now used directly (instead of through `requests`). - HTTP connections are now reused across requests, which makes the library more efficient and reduces load on the App Store servers. In addition, an `AppStoreSession` class was introduced that allows reusing connections across multiple `AppStoreEntry` instances. - Python >= 3.10 is now required. - Support for podcasts has been dropped.
1 parent 3a11b58 commit 9e07c86

File tree

17 files changed

+741
-659
lines changed

17 files changed

+741
-659
lines changed

.github/PULL_REQUEST_TEMPLATE.md

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

.github/workflows/ci.yml

Lines changed: 15 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Build
1+
name: CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [main]
66
paths-ignore:
77
- '**.md'
88
pull_request:
9-
branches: [ master ]
9+
branches: [main]
1010
paths-ignore:
1111
- '**.md'
1212

@@ -15,117 +15,24 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
os: [ubuntu-latest, macos-latest, windows-latest]
19-
python-version: [3.6, 3.7, 3.8]
18+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
2019
steps:
2120
- name: Checkout
22-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
22+
2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
2525
with:
2626
python-version: ${{ matrix.python-version }}
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install black flake8 pytest
31-
pip install -r requirements.txt
32-
- name: Format with black
33-
run: |
34-
black . --check
35-
- name: Lint with flake8
36-
run: |
37-
flake8 . --ignore=E203 --count --show-source --statistics --max-line-length=90
38-
- name: Test with pytest
39-
run: |
40-
pytest
41-
release:
42-
runs-on: ubuntu-latest
43-
steps:
44-
- name: Checkout
45-
uses: actions/checkout@v2
46-
with:
47-
fetch-depth: 0
48-
- name: Check version bump and set versions as envvar
49-
if: github.ref != 'refs/heads/master'
50-
run: |
51-
FILES_CHANGED=$(echo -n $(git diff origin/${{ github.base_ref }} --name-only))
52-
if [[ $FILES_CHANGED != *.py ]]; then
53-
echo "No Python scripts are modified"
54-
echo "::set-env name=FILES_CHANGED::false"
55-
exit 0
56-
fi
57-
58-
SEMVER_PATTERN="([0-9]+)\.([0-9]+)\.([0-9]+)"
59-
VERSION=$(echo -n $(git diff origin/${{ github.base_ref }} -G '__version__' app_store_scraper/__version__.py))
60-
61-
if [ "$VERSION" = "" ]; then
62-
echo "Version must be bumped for every PR"
63-
exit 1
64-
fi
65-
66-
VERSION_OLD=$(echo "$VERSION" | sed -E "s/.*\-__version__ = \"($SEMVER_PATTERN).+/\1/")
67-
VERSION_OLD_MAJOR=$(echo "$VERSION_OLD" | sed -E "s/$SEMVER_PATTERN/\1/")
68-
VERSION_OLD_MINOR=$(echo "$VERSION_OLD" | sed -E "s/$SEMVER_PATTERN/\2/")
69-
VERSION_OLD_PATCH=$(echo "$VERSION_OLD" | sed -E "s/$SEMVER_PATTERN/\3/")
70-
71-
VERSION_NEW=$(echo "$VERSION" | sed -E "s/.*\+__version__ = \"($SEMVER_PATTERN).+/\1/")
72-
VERSION_NEW_MAJOR=$(echo "$VERSION_NEW" | sed -E "s/$SEMVER_PATTERN/\1/")
73-
VERSION_NEW_MINOR=$(echo "$VERSION_NEW" | sed -E "s/$SEMVER_PATTERN/\2/")
74-
VERSION_NEW_PATCH=$(echo "$VERSION_NEW" | sed -E "s/$SEMVER_PATTERN/\3/")
7527

76-
echo "::set-env name=VERSION_OLD::$VERSION_OLD"
77-
echo "::set-env name=VERSION_OLD_MAJOR::$VERSION_OLD_MAJOR"
78-
echo "::set-env name=VERSION_OLD_MINOR::$VERSION_OLD_MINOR"
79-
echo "::set-env name=VERSION_OLD_PATCH::$VERSION_OLD_PATCH"
28+
- name: Install Hatch
29+
uses: pypa/hatch@install
8030

81-
echo "::set-env name=VERSION_NEW::$VERSION_NEW"
82-
echo "::set-env name=VERSION_NEW_MAJOR::$VERSION_NEW_MAJOR"
83-
echo "::set-env name=VERSION_NEW_MINOR::$VERSION_NEW_MINOR"
84-
echo "::set-env name=VERSION_NEW_PATCH::$VERSION_NEW_PATCH"
31+
- name: Set up Python environment
32+
run: hatch env create
8533

86-
echo "Old version: $VERSION_OLD"
87-
echo "New version: $VERSION_NEW"
88-
- name: Check for patch version bump
89-
if: ${{ !startsWith(github.head_ref, 'release') && github.ref != 'refs/heads/master' }}
90-
run: |
91-
if [ "$FILES_CHANGED" = false ]; then
92-
echo "No Python scripts are modified"
93-
exit 0
94-
fi
34+
- name: Check code and formatting
35+
run: hatch fmt --check
9536

96-
if [ "$VERSION_OLD_MAJOR" = "$VERSION_NEW_MAJOR" ] &&
97-
[ "$VERSION_OLD_MINOR" = "$VERSION_NEW_MINOR" ]; then
98-
if (($VERSION_OLD_PATCH < $VERSION_NEW_PATCH)); then
99-
echo "Bumped patch version $VERSION_OLD -> $VERSION_NEW"
100-
exit 0
101-
else
102-
echo "Bump patch version in __version__"
103-
exit 1
104-
fi
105-
else
106-
echo "Major / minor version must be bumped in a release branch"
107-
exit 1
108-
fi
109-
- name: Check for major / minor version bump
110-
if: ${{ startsWith(github.head_ref, 'release') && github.ref != 'refs/heads/master' }}
111-
run: |
112-
if (($VERSION_OLD_MAJOR < $VERSION_NEW_MAJOR)); then
113-
echo "Bumped major version $VERSION_OLD -> $VERSION_NEW"
114-
exit 0
115-
elif (($VERSION_OLD_MINOR < $VERSION_NEW_MINOR)); then
116-
echo "Bumped minor version $VERSION_OLD -> $VERSION_NEW"
117-
exit 0
118-
else
119-
echo "Major / minor version must be bumped for release"
120-
exit 1
121-
fi
122-
- name: Create and push tag
123-
if: github.ref == 'refs/heads/master'
124-
run: |
125-
version=$(echo -n $(git diff HEAD^1 -G '__version__' app_store_scraper/__version__.py))
126-
version=$(echo "$version" | sed -E "s/.*\+__version__.*([0-9]+\.[0-9]+\.[0-9]+).+/\1/")
127-
if [ "$version" != "" ]; then
128-
echo "Create and push v$version tag"
129-
git tag -f v"$version"
130-
git push origin v"$version"
131-
fi
37+
- name: Run unit tests
38+
run: hatch test

.github/workflows/publish.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
12+
1213
- name: Set up Python
13-
uses: actions/setup-python@v2
14+
uses: actions/setup-python@v4
1415
with:
15-
python-version: '3.x'
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
20-
- name: Build and publish 🐍 📦 to PyPi
21-
env:
22-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24-
run: |
25-
python setup.py sdist bdist_wheel
26-
twine upload dist/*
16+
python-version: 3.12
17+
18+
- name: Install Hatch
19+
uses: pypa/hatch@install
20+
21+
- name: Build package
22+
run: hatch build
23+
24+
- name: Publish package
25+
run: hatch publish

0 commit comments

Comments
 (0)