Skip to content

Commit 042746f

Browse files
authored
chore: migrate to Poetry and update tooling just like in Crawlee (#262)
### Description - Migrate to Poetry for packaging and dependency management. - Update versions of dev tools. - Take some tooling settings from Crawlee. - Drop support for Python 3.8 as it's gonna be deprecated very soon - gonna release this as 1.8.0. ### Issues - Closes: #170 ### Testing - N/A ### Checklist - [x] CI passed
1 parent a19fe3a commit 042746f

17 files changed

+260
-169
lines changed

.github/workflows/check_pr_title.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check PR title
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
check_pr_title:
9+
name: Check PR title
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: amannn/action-semantic-pull-request@v5.5.3
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/integration_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
19+
python-version: ["3.9", "3.10", "3.11", "3.12"]
2020
max-parallel: 1 # no concurrency on this level, to not overshoot the test user limits
2121

2222
steps:

.github/workflows/lint_and_type_checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
12+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1313

1414
steps:
1515
- name: Checkout repository

.github/workflows/release.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,12 @@ jobs:
109109
if: steps.get-release-type.outputs.release_type != 'final'
110110
run: python ./scripts/update_version_for_prerelease.py ${{ steps.get-release-type.outputs.release_type }}
111111

112-
- # Build a source distribution and a python3-only wheel
113-
name: Build distribution files
112+
# Builds the package.
113+
- name: Build package
114114
run: make build
115115

116-
- # Check whether the package description will render correctly on PyPI
117-
name: Check package rendering on PyPI
118-
run: make twine-check
119-
120-
- # Publish package to PyPI using their official GitHub action
121-
name: Publish package to PyPI
116+
# Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication.
117+
- name: Publish package to PyPI
122118
uses: pypa/gh-action-pypi-publish@release/v1
123119

124120
- # Tag the current commit with the version tag if this is not made from the release event (releases are tagged with the release process)

.github/workflows/unit_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [ubuntu-latest, windows-latest]
12-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
12+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1313
runs-on: ${{ matrix.os }}
1414

1515
steps:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Update new issue
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
8+
jobs:
9+
label_issues:
10+
name: Label issues
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
15+
steps:
16+
# Add the "t-tooling" label to all new issues
17+
- uses: actions/github-script@v7
18+
with:
19+
script: |
20+
github.rest.issues.addLabels({
21+
issue_number: context.issue.number,
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
labels: ["t-tooling"]
25+
})

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ repos:
77
language: system
88
pass_filenames: false
99

10-
- id: check-async-docstrings
11-
name: Check whether async docstrings are aligned with sync ones
12-
entry: make check-async-docstrings
13-
language: system
14-
pass_filenames: false
15-
1610
- id: type-check
1711
name: Type-check codebase
1812
entry: make type-check
@@ -25,8 +19,14 @@ repos:
2519
language: system
2620
pass_filenames: false
2721

28-
- id: check-changelog
29-
name: Check whether current version is mentioned in changelog
22+
- id: check-async-docstrings
23+
name: Check whether async docstrings are aligned with sync ones
24+
entry: make check-async-docstrings
25+
language: system
26+
pass_filenames: false
27+
28+
- id: check-changelog-entry
29+
name: Check changelog entry
3030
entry: make check-changelog-entry
3131
language: system
3232
pass_filenames: false

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Changelog
22

3-
## [1.7.2](../../releases/tag/v1.7.2) - Unreleased
3+
## [1.8.0](../../releases/tag/v1.8.0) - Unreleased
44

55
### Added
66

77
- add `headers_template` kwarg to webhook create and update
88
- allow passing list of fields to `unwind` parameter in dataset item listing endpoints
99

10+
### Others
11+
12+
- drop support for Python 3.8
13+
1014
## [1.7.1](../../releases/tag/v1.7.1) - 2024-07-11
1115

1216
### Fixed

Makefile

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,64 @@
1-
.PHONY: clean install-dev build publish twine-check lint unit-tests integration-tests type-check check-code format check-async-docstrings fix-async-docstrings check-version-availability check-changelog-entry build-api-reference
1+
.PHONY: clean install-dev build publish-to-pypi lint type-check unit-tests unit-tests-cov integration-tests format check-code check-async-docstrings fix-async-docstrings check-version-availability check-changelog-entry build-api-reference run-doc
22

33
DIRS_WITH_CODE = src tests scripts
44

55
# This is default for local testing, but GitHub workflows override it to a higher value in CI
66
INTEGRATION_TESTS_CONCURRENCY = 1
77

88
clean:
9-
rm -rf build dist .mypy_cache .pytest_cache .ruff_cache src/*.egg-info __pycache__
9+
rm -rf .mypy_cache .pytest_cache .ruff_cache build dist htmlcov .coverage
1010

1111
install-dev:
12-
python3 -m pip install --upgrade pip
13-
pip install --no-cache-dir -e ".[dev]"
14-
pre-commit install
12+
python3 -m pip install --upgrade pip poetry
13+
poetry install --all-extras
14+
poetry run pre-commit install
1515

1616
build:
17-
python3 -m build
17+
poetry build --no-interaction -vv
1818

19-
publish:
20-
python3 -m twine upload dist/*
21-
22-
twine-check:
23-
python3 -m twine check dist/*
19+
# APIFY_PYPI_TOKEN_CRAWLEE is expected to be set in the environment
20+
publish-to-pypi:
21+
poetry config pypi-token.pypi "${APIFY_PYPI_TOKEN_CRAWLEE}"
22+
poetry publish --no-interaction -vv
2423

2524
lint:
26-
python3 -m ruff check $(DIRS_WITH_CODE)
25+
poetry run ruff format --check $(DIRS_WITH_CODE)
26+
poetry run ruff check $(DIRS_WITH_CODE)
27+
28+
type-check:
29+
poetry run mypy $(DIRS_WITH_CODE)
2730

2831
unit-tests:
29-
python3 -m pytest --numprocesses=auto --verbose -ra --cov=src/apify_client tests/unit
32+
poetry run pytest --numprocesses=auto --verbose --cov=src/apify_client tests/unit
3033

3134
unit-tests-cov:
32-
python3 -m pytest --numprocesses=auto --verbose -ra --cov=src/apify_client --cov-report=html tests/unit
35+
poetry run pytest --numprocesses=auto --verbose --cov=src/apify_client --cov-report=html tests/unit
3336

3437
integration-tests:
35-
python3 -m pytest --numprocesses=$(INTEGRATION_TESTS_CONCURRENCY) --verbose -ra tests/integration
36-
37-
type-check:
38-
python3 -m mypy $(DIRS_WITH_CODE)
39-
40-
check-code: lint check-async-docstrings type-check unit-tests
38+
poetry run pytest --numprocesses=$(INTEGRATION_TESTS_CONCURRENCY) tests/integration
4139

4240
format:
43-
python3 -m ruff check --fix $(DIRS_WITH_CODE)
44-
python3 -m ruff format $(DIRS_WITH_CODE)
41+
poetry run ruff check --fix $(DIRS_WITH_CODE)
42+
poetry run ruff format $(DIRS_WITH_CODE)
43+
44+
# The check-code target runs a series of checks equivalent to those performed by pre-commit hooks
45+
# and the run_checks.yaml GitHub Actions workflow.
46+
check-code: lint type-check unit-tests
4547

4648
check-async-docstrings:
47-
python3 scripts/check_async_docstrings.py
49+
poetry run python scripts/check_async_docstrings.py
4850

4951
fix-async-docstrings:
50-
python3 scripts/fix_async_docstrings.py
52+
poetry run python scripts/fix_async_docstrings.py
5153

5254
check-version-availability:
53-
python3 scripts/check_version_availability.py
55+
poetry run python scripts/check_version_availability.py
5456

5557
check-changelog-entry:
56-
python3 scripts/check_version_in_changelog.py
58+
poetry run python scripts/check_version_in_changelog.py
5759

5860
build-api-reference:
5961
cd website && ./build_api_reference.sh
62+
63+
run-doc: build-api-reference
64+
cd website && npm clean-install && npm run start

mypy.ini

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

0 commit comments

Comments
 (0)