Skip to content

Commit e058329

Browse files
committed
chore: Replace Makefile with poethepoet task runner
1 parent 42947c8 commit e058329

File tree

7 files changed

+87
-102
lines changed

7 files changed

+87
-102
lines changed

.github/workflows/_release_docs.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,10 @@ jobs:
5050
python-version: ${{ env.PYTHON_VERSION }}
5151

5252
- name: Install Python dependencies
53-
run: make install-dev
54-
55-
- name: Build generated API reference
56-
run: make build-api-reference
53+
run: uv run poe install-dev
5754

5855
- name: Build Docusaurus docs
59-
run: make build-docs
56+
run: uv run poe build-docs
6057
env:
6158
APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }}
6259
SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }}

.github/workflows/on_schedule_tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ jobs:
5757

5858
# Sync the project, but no need to install the browsers into the test runner environment.
5959
- name: Install Python dependencies
60-
run: make install-sync
60+
run: uv run poe install-sync
6161

6262
- name: Run templates end-to-end tests
63-
run: make e2e-templates-tests args="-m ${{ matrix.http-client }} and ${{ matrix.crawler-type }} and ${{ matrix.package-manager }}"
63+
run: uv run poe e2e-templates-tests -- -m "${{ matrix.http-client }} and ${{ matrix.crawler-type }} and ${{ matrix.package-manager }}"
6464
env:
6565
APIFY_TEST_USER_API_TOKEN: ${{ secrets.APIFY_TEST_USER_API_TOKEN }}

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ repos:
33
hooks:
44
- id: lint-check
55
name: Lint check
6-
entry: make lint
6+
entry: uv run poe lint
77
language: system
88
pass_filenames: false
99

1010
- id: type-check
1111
name: Type check
12-
entry: make type-check
12+
entry: uv run poe type-check
1313
language: system
1414
pass_filenames: false

CONTRIBUTING.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ For local development, it is required to have Python 3.10 (or a later version) i
88

99
We use [uv](https://docs.astral.sh/uv/) for project management. Install it and set up your IDE accordingly.
1010

11+
We use [Poe the Poet](https://poethepoet.natn.io/) as a task runner, similar to npm scripts in `package.json`.
12+
All tasks are defined in `pyproject.toml` under `[tool.poe.tasks]` and can be run with `uv run poe <task>`.
13+
1114
## Dependencies
1215

1316
To install this package and its development dependencies, run:
1417

1518
```sh
16-
make install-dev
19+
uv run poe install-dev
1720
```
1821

1922
## Code checking
2023

2124
To execute all code checking tools together, run:
2225

2326
```sh
24-
make check-code
27+
uv run poe check-code
2528
```
2629

2730
### Linting
@@ -31,7 +34,7 @@ We utilize [ruff](https://docs.astral.sh/ruff/) for linting, which analyzes code
3134
To run linting:
3235

3336
```sh
34-
make lint
37+
uv run poe lint
3538
```
3639

3740
### Formatting
@@ -41,35 +44,33 @@ Our automated code formatting also leverages [ruff](https://docs.astral.sh/ruff/
4144
To run formatting:
4245

4346
```sh
44-
make format
47+
uv run poe format
4548
```
4649

4750
### Type checking
4851

4952
Type checking is handled by [ty](https://docs.astral.sh/ty/), verifying code against type annotations. Configuration settings can be found in `pyproject.toml`.
5053

51-
To run type checking:
54+
To run type-check:
5255

5356
```sh
54-
make type-check
57+
uv run poe type-check
5558
```
5659

5760
### Unit tests
5861

59-
We employ pytest as our testing framework, equipped with various plugins. Check pyproject.toml for configuration details and installed plugins.
60-
6162
We use [pytest](https://docs.pytest.org/) as a testing framework with many plugins. Check `pyproject.toml` for configuration details and installed plugins.
6263

6364
To run unit tests:
6465

6566
```sh
66-
make unit-tests
67+
uv run poe unit-tests
6768
```
6869

69-
To run unit tests with HTML coverage report:
70+
To run unit tests with coverage report:
7071

7172
```sh
72-
make unit-tests-cov
73+
uv run poe unit-tests-cov
7374
```
7475

7576
## End-to-end tests
@@ -79,11 +80,10 @@ Pre-requisites for running end-to-end tests:
7980
- `apify-cli` available in `PATH` environment variable
8081
- Your [apify token](https://docs.apify.com/platform/integrations/api#api-token) is available in `APIFY_TEST_USER_API_TOKEN` environment variable
8182

82-
8383
To run end-to-end tests:
8484

8585
```sh
86-
make e2e-templates-tests
86+
uv run poe e2e-templates-tests
8787
```
8888

8989
## Documentation
@@ -95,7 +95,7 @@ Our API documentation is generated from these docstrings using [pydoc-markdown](
9595
To run the documentation locally, ensure you have `Node.js` 20+ installed, then run:
9696

9797
```sh
98-
make run-docs
98+
uv run poe run-docs
9999
```
100100

101101
## Release process

Makefile

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

pyproject.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ dev = [
102102
"build<2.0.0", # For e2e tests.
103103
"dycw-pytest-only<3.0.0",
104104
"fakeredis[probabilistic,json,lua]<3.0.0",
105+
"poethepoet<1.0.0",
105106
"pre-commit<5.0.0",
106107
"proxy-py<3.0.0",
107108
"pydoc-markdown<5.0.0",
@@ -255,3 +256,44 @@ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:", "assert_never()"]
255256

256257
[tool.ipdb]
257258
context = 7
259+
260+
# Run tasks with: uv run poe <task>
261+
[tool.poe.tasks]
262+
clean = "rm -rf .uv_cache .pytest_cache .ruff_cache .uv-cache build dist htmlcov .coverage"
263+
install-sync = "uv sync --all-extras"
264+
build = "uv build --verbose"
265+
publish-to-pypi = "uv publish --verbose --token ${APIFY_PYPI_TOKEN_CRAWLEE}"
266+
type-check = "uv run ty check"
267+
check-code = ["lint", "type-check", "unit-tests"]
268+
269+
[tool.poe.tasks.install-dev]
270+
shell = "uv sync --all-extras && uv run pre-commit install && uv run playwright install"
271+
272+
[tool.poe.tasks.lint]
273+
shell = "uv run ruff format --check && uv run ruff check"
274+
275+
[tool.poe.tasks.format]
276+
shell = "uv run ruff check --fix && uv run ruff format"
277+
278+
[tool.poe.tasks.unit-tests]
279+
shell = """
280+
uv run pytest --numprocesses=1 --verbose -m "run_alone" tests/unit && \
281+
uv run pytest --numprocesses=auto --verbose -m "not run_alone" tests/unit
282+
"""
283+
284+
[tool.poe.tasks.unit-tests-cov]
285+
shell = """
286+
uv run pytest --numprocesses=1 --verbose -m "run_alone" --cov=src/crawlee --cov-report=xml:coverage-unit.xml tests/unit && \
287+
uv run pytest --numprocesses=auto --verbose -m "not run_alone" --cov=src/crawlee --cov-report=xml:coverage-unit.xml --cov-append tests/unit
288+
"""
289+
290+
[tool.poe.tasks.e2e-templates-tests]
291+
cmd = "uv run pytest --numprocesses=${E2E_TESTS_CONCURRENCY:-1} --verbose tests/e2e/project_template --timeout=600"
292+
293+
[tool.poe.tasks.build-docs]
294+
shell = "./build_api_reference.sh && corepack enable && yarn && yarn build"
295+
cwd = "website"
296+
297+
[tool.poe.tasks.run-docs]
298+
shell = "./build_api_reference.sh && corepack enable && yarn && yarn start"
299+
cwd = "website"

uv.lock

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)