-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
17 changed files
with
260 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Check PR title | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, edited, synchronize] | ||
|
||
jobs: | ||
check_pr_title: | ||
name: Check PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Update new issue | ||
|
||
on: | ||
issues: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
label_issues: | ||
name: Label issues | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
|
||
steps: | ||
# Add the "t-tooling" label to all new issues | ||
- uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ["t-tooling"] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,64 @@ | ||
.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 | ||
.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 | ||
|
||
DIRS_WITH_CODE = src tests scripts | ||
|
||
# This is default for local testing, but GitHub workflows override it to a higher value in CI | ||
INTEGRATION_TESTS_CONCURRENCY = 1 | ||
|
||
clean: | ||
rm -rf build dist .mypy_cache .pytest_cache .ruff_cache src/*.egg-info __pycache__ | ||
rm -rf .mypy_cache .pytest_cache .ruff_cache build dist htmlcov .coverage | ||
|
||
install-dev: | ||
python3 -m pip install --upgrade pip | ||
pip install --no-cache-dir -e ".[dev]" | ||
pre-commit install | ||
python3 -m pip install --upgrade pip poetry | ||
poetry install --all-extras | ||
poetry run pre-commit install | ||
|
||
build: | ||
python3 -m build | ||
poetry build --no-interaction -vv | ||
|
||
publish: | ||
python3 -m twine upload dist/* | ||
|
||
twine-check: | ||
python3 -m twine check dist/* | ||
# APIFY_PYPI_TOKEN_CRAWLEE is expected to be set in the environment | ||
publish-to-pypi: | ||
poetry config pypi-token.pypi "${APIFY_PYPI_TOKEN_CRAWLEE}" | ||
poetry publish --no-interaction -vv | ||
|
||
lint: | ||
python3 -m ruff check $(DIRS_WITH_CODE) | ||
poetry run ruff format --check $(DIRS_WITH_CODE) | ||
poetry run ruff check $(DIRS_WITH_CODE) | ||
|
||
type-check: | ||
poetry run mypy $(DIRS_WITH_CODE) | ||
|
||
unit-tests: | ||
python3 -m pytest --numprocesses=auto --verbose -ra --cov=src/apify_client tests/unit | ||
poetry run pytest --numprocesses=auto --verbose --cov=src/apify_client tests/unit | ||
|
||
unit-tests-cov: | ||
python3 -m pytest --numprocesses=auto --verbose -ra --cov=src/apify_client --cov-report=html tests/unit | ||
poetry run pytest --numprocesses=auto --verbose --cov=src/apify_client --cov-report=html tests/unit | ||
|
||
integration-tests: | ||
python3 -m pytest --numprocesses=$(INTEGRATION_TESTS_CONCURRENCY) --verbose -ra tests/integration | ||
|
||
type-check: | ||
python3 -m mypy $(DIRS_WITH_CODE) | ||
|
||
check-code: lint check-async-docstrings type-check unit-tests | ||
poetry run pytest --numprocesses=$(INTEGRATION_TESTS_CONCURRENCY) tests/integration | ||
|
||
format: | ||
python3 -m ruff check --fix $(DIRS_WITH_CODE) | ||
python3 -m ruff format $(DIRS_WITH_CODE) | ||
poetry run ruff check --fix $(DIRS_WITH_CODE) | ||
poetry run ruff format $(DIRS_WITH_CODE) | ||
|
||
# The check-code target runs a series of checks equivalent to those performed by pre-commit hooks | ||
# and the run_checks.yaml GitHub Actions workflow. | ||
check-code: lint type-check unit-tests | ||
|
||
check-async-docstrings: | ||
python3 scripts/check_async_docstrings.py | ||
poetry run python scripts/check_async_docstrings.py | ||
|
||
fix-async-docstrings: | ||
python3 scripts/fix_async_docstrings.py | ||
poetry run python scripts/fix_async_docstrings.py | ||
|
||
check-version-availability: | ||
python3 scripts/check_version_availability.py | ||
poetry run python scripts/check_version_availability.py | ||
|
||
check-changelog-entry: | ||
python3 scripts/check_version_in_changelog.py | ||
poetry run python scripts/check_version_in_changelog.py | ||
|
||
build-api-reference: | ||
cd website && ./build_api_reference.sh | ||
|
||
run-doc: build-api-reference | ||
cd website && npm clean-install && npm run start |
Oops, something went wrong.