|
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 |
2 | 2 |
|
3 | 3 | DIRS_WITH_CODE = src tests scripts |
4 | 4 |
|
5 | 5 | # This is default for local testing, but GitHub workflows override it to a higher value in CI |
6 | 6 | INTEGRATION_TESTS_CONCURRENCY = 1 |
7 | 7 |
|
8 | 8 | 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 |
10 | 10 |
|
11 | 11 | 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 |
15 | 15 |
|
16 | 16 | build: |
17 | | - python3 -m build |
| 17 | + poetry build --no-interaction -vv |
18 | 18 |
|
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 |
24 | 23 |
|
25 | 24 | 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) |
27 | 30 |
|
28 | 31 | 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 |
30 | 33 |
|
31 | 34 | 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 |
33 | 36 |
|
34 | 37 | 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 |
41 | 39 |
|
42 | 40 | 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 |
45 | 47 |
|
46 | 48 | check-async-docstrings: |
47 | | - python3 scripts/check_async_docstrings.py |
| 49 | + poetry run python scripts/check_async_docstrings.py |
48 | 50 |
|
49 | 51 | fix-async-docstrings: |
50 | | - python3 scripts/fix_async_docstrings.py |
| 52 | + poetry run python scripts/fix_async_docstrings.py |
51 | 53 |
|
52 | 54 | check-version-availability: |
53 | | - python3 scripts/check_version_availability.py |
| 55 | + poetry run python scripts/check_version_availability.py |
54 | 56 |
|
55 | 57 | check-changelog-entry: |
56 | | - python3 scripts/check_version_in_changelog.py |
| 58 | + poetry run python scripts/check_version_in_changelog.py |
57 | 59 |
|
58 | 60 | build-api-reference: |
59 | 61 | cd website && ./build_api_reference.sh |
| 62 | + |
| 63 | +run-doc: build-api-reference |
| 64 | + cd website && npm clean-install && npm run start |
0 commit comments