Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/build_and_deploy_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv package manager
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Python dependencies
run: |
pipx install --python ${{ env.PYTHON_VERSION }} poetry
make install-dev
run: make install-dev

- name: Build generated API reference
run: make build-api-reference
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pre_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
tag_name: ${{ steps.release_metadata.outputs.tag_name }}
changelog: ${{ steps.release_metadata.outputs.changelog }}
steps:
- uses: apify/workflows/git-cliff-release@main
- uses: apify/workflows/git-cliff-release@switch-to-uv
id: release_metadata
name: Prepare release metadata
with:
Expand All @@ -47,7 +47,7 @@ jobs:
update_changelog:
name: Update changelog
needs: [release_metadata, wait_for_checks]
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@switch-to-uv
with:
version_number: ${{ needs.release_metadata.outputs.version_number }}
changelog: ${{ needs.release_metadata.outputs.changelog }}
Expand All @@ -74,7 +74,7 @@ jobs:
url: https://pypi.org/project/crawlee
steps:
- name: Prepare distribution
uses: apify/workflows/prepare-pypi-distribution@main
uses: apify/workflows/prepare-pypi-distribution@switch-to-uv
with:
package_name: crawlee
is_prerelease: "yes"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
changelog: ${{ steps.release_metadata.outputs.changelog }}
release_notes: ${{ steps.release_metadata.outputs.release_notes }}
steps:
- uses: apify/workflows/git-cliff-release@main
- uses: apify/workflows/git-cliff-release@switch-to-uv
name: Prepare release metadata
id: release_metadata
with:
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
update_changelog:
name: Update changelog
needs: [release_metadata, wait_for_checks]
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@switch-to-uv
with:
version_number: ${{ needs.release_metadata.outputs.version_number }}
changelog: ${{ needs.release_metadata.outputs.changelog }}
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
url: https://pypi.org/project/crawlee
steps:
- name: Prepare distribution
uses: apify/workflows/prepare-pypi-distribution@main
uses: apify/workflows/prepare-pypi-distribution@switch-to-uv
with:
package_name: crawlee
is_prerelease: ""
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run_code_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ on:
jobs:
lint_check:
name: Lint check
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
uses: apify/workflows/.github/workflows/python_lint_check.yaml@switch-to-uv

type_check:
name: Type check
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
uses: apify/workflows/.github/workflows/python_type_check.yaml@switch-to-uv

unit_tests:
name: Unit tests
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@switch-to-uv
secrets:
httpbin_url: ${{ secrets.APIFY_HTTPBIN_TOKEN && format('https://httpbin.apify.actor?token={0}', secrets.APIFY_HTTPBIN_TOKEN) || 'https://httpbin.org'}}

docs_check:
name: Docs check
uses: apify/workflows/.github/workflows/python_docs_check.yaml@main
uses: apify/workflows/.github/workflows/python_docs_check.yaml@switch-to-uv
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ __pycache__
.envrc
.python-version

# Poetry
poetry.toml

# Other Python tools
.ropeproject

Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Here you'll find a contributing guide to get started with development.

For local development, it is required to have Python 3.9 (or a later version) installed.

We use [Poetry](https://python-poetry.org/) for project management. Install it and set up your IDE accordingly.
We use [uv](https://docs.astral.sh/uv/) for project management. Install it and set up your IDE accordingly.

## Dependencies

Expand Down Expand Up @@ -129,37 +129,37 @@ make run-docs
Publishing new versions to [PyPI](https://pypi.org/project/crawlee) is automated through GitHub Actions.

- **Beta releases**: On each commit to the master branch, a new beta release is automatically published. The version number is determined based on the latest release and conventional commits. The beta version suffix is incremented by 1 from the last beta release on PyPI.
- **Stable releases**: A stable version release may be created by triggering the `run_release` GitHub Actions workflow. The version number is determined based on the latest release and conventional commits (`auto` release type), or it may be overriden using the `custom` release type.
- **Stable releases**: A stable version release may be created by triggering the `release` GitHub Actions workflow. The version number is determined based on the latest release and conventional commits (`auto` release type), or it may be overriden using the `custom` release type.

### Publishing to PyPI manually

1. **Do not do this unless absolutely necessary.** In all conceivable scenarios, you should use the `run_release` workflow instead.
1. **Do not do this unless absolutely necessary.** In all conceivable scenarios, you should use the `release` workflow instead.
2. **Make sure you know what you're doing.**

3. Update the version number:

- Modify the `version` field under `tool.poetry` in `pyproject.toml`.
- Modify the `version` field under `project` in `pyproject.toml`.

```toml
[tool.poetry]
[project]
name = "crawlee"
version = "x.z.y"
```

4. Generate the distribution archives for the package:

```shell
poetry build
uv build
```

5. Set up the PyPI API token for authentication:

```shell
poetry config pypi-token.pypi YOUR_API_TOKEN
uv config pypi-token.pypi YOUR_API_TOKEN
```

6. Upload the package to PyPI:

```shell
poetry publish
uv publish
```
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.PHONY: clean install-dev build publish-to-pypi lint type-check unit-tests unit-tests-cov integration-tests format check-code build-api-reference run-docs
.PHONY: clean install-dev build publish-to-pypi lint type-check unit-tests unit-tests-cov \
integration-tests format check-code build-api-reference run-docs

# This is default for local testing, but GitHub workflows override it to a higher value in CI
INTEGRATION_TESTS_CONCURRENCY = 1
Expand All @@ -7,48 +8,47 @@ clean:
rm -rf .mypy_cache .pytest_cache .ruff_cache build dist htmlcov .coverage

install-dev:
poetry install --all-extras
poetry run pre-commit install
poetry run playwright install
poetry run python -m browserforge update
uv sync --all-extras
uv run pre-commit install
uv run playwright install
uv run python -m browserforge update

build:
poetry build --no-interaction -vv
uv build --verbose

# 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
uv publish --verbose --token "${APIFY_PYPI_TOKEN_CRAWLEE}"

lint:
poetry run ruff format --check
poetry run ruff check
uv run ruff format --check
uv run ruff check

type-check:
poetry run mypy
uv run mypy

unit-tests:
poetry run pytest --numprocesses=auto --verbose --cov=src/crawlee tests/unit
uv run pytest --numprocesses=auto --verbose --cov=src/crawlee tests/unit

unit-tests-cov:
poetry run pytest --numprocesses=auto --verbose --cov=src/crawlee --cov-report=html tests/unit
uv run pytest --numprocesses=auto --verbose --cov=src/crawlee --cov-report=html tests/unit

integration-tests:
poetry run pytest --numprocesses=$(INTEGRATION_TESTS_CONCURRENCY) tests/integration
uv run pytest --numprocesses=$(INTEGRATION_TESTS_CONCURRENCY) --verbose tests/integration

format:
poetry run ruff check --fix
poetry run ruff format
uv run ruff check --fix
uv run ruff format

# 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

build-api-reference:
cd website && poetry run ./build_api_reference.sh
cd website && uv run ./build_api_reference.sh

build-docs:
cd website && corepack enable && yarn && poetry run yarn build
cd website && corepack enable && yarn && uv run yarn build

run-docs: build-api-reference
cd website && corepack enable && yarn && poetry run yarn start
cd website && corepack enable && yarn && uv run yarn start
Loading
Loading