Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 7 additions & 4 deletions .github/workflows/_async_docstrings_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:

env:
PYTHON_VERSION: 3.12
PYTHON_VERSION: 3.13

jobs:
async_docstring_check:
Expand All @@ -20,10 +20,13 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

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

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

- name: Run async docstrings check
run: make check-async-docstrings
11 changes: 7 additions & 4 deletions .github/workflows/build_and_deploy_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
NODE_VERSION: 20
PYTHON_VERSION: 3.12
PYTHON_VERSION: 3.13

jobs:
build_and_deploy_docs:
Expand Down Expand Up @@ -54,10 +54,13 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Set up 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
14 changes: 7 additions & 7 deletions .github/workflows/pre_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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 @@ -30,29 +30,29 @@ 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

async_docstrings:
name: Async dostrings check
uses: ./.github/workflows/_async_docstrings_check.yaml

integration_tests:
name: Integration tests
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@switch-to-uv
secrets: inherit

update_changelog:
name: Update changelog
needs: [release_metadata, lint_check, type_check, unit_tests, integration_tests]
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 @@ -71,7 +71,7 @@ jobs:
url: https://pypi.org/project/apify-client
steps:
- name: Prepare distribution
uses: apify/workflows/prepare-pypi-distribution@main
uses: apify/workflows/prepare-pypi-distribution@switch-to-uv
with:
package_name: apify-client
is_prerelease: "yes"
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
release_metadata:
name: Prepare release metadata
runs-on: ubuntu-latest
outputs:
outputs:
version_number: ${{ steps.release_metadata.outputs.version_number }}
tag_name: ${{ steps.release_metadata.outputs.tag_name }}
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 All @@ -41,33 +41,33 @@ 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

async_docstrings:
name: Async dostrings check
uses: ./.github/workflows/_async_docstrings_check.yaml

integration_tests:
name: Integration tests
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@switch-to-uv
secrets: inherit

update_changelog:
name: Update changelog
needs: [release_metadata, lint_check, type_check, unit_tests, integration_tests]
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 }}
secrets:
secrets:
APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

create_github_release:
Expand Down Expand Up @@ -97,8 +97,8 @@ jobs:
url: https://pypi.org/project/apify-client
steps:
- name: Prepare distribution
uses: apify/workflows/prepare-pypi-distribution@main
with:
uses: apify/workflows/prepare-pypi-distribution@switch-to-uv
with:
package_name: apify-client
is_prerelease: ""
version_number: ${{ needs.release_metadata.outputs.version_number }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run_code_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ 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

async_docstrings:
name: Async dostrings check
uses: ./.github/workflows/_async_docstrings_check.yaml

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

integration_tests:
name: Integration tests
needs: [lint_check, type_check, unit_tests]
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@switch-to-uv
secrets: inherit
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

# Mise
mise.toml
.mise.toml
Expand Down
18 changes: 6 additions & 12 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 @@ -139,28 +139,22 @@ Publishing new versions to [PyPI](https://pypi.org/project/apify_client) is auto

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 = "apify_client"
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:
5. Set up the PyPI API token for authentication and upload the package to PyPI:

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

6. Upload the package to PyPI:

```shell
poetry publish
uv publish --token YOUR_API_TOKEN
```
35 changes: 17 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,51 @@ clean:
rm -rf .mypy_cache .pytest_cache .ruff_cache build dist htmlcov .coverage

install-dev:
poetry install --all-extras
poetry run pre-commit install
uv sync --all-extras
uv run pre-commit install

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/apify_client tests/unit
uv run pytest --numprocesses=auto --verbose --cov=src/apify_client tests/unit

unit-tests-cov:
poetry run pytest --numprocesses=auto --verbose --cov=src/apify_client --cov-report=html tests/unit
uv run pytest --numprocesses=auto --verbose --cov=src/apify_client --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

check-async-docstrings:
poetry run python scripts/check_async_docstrings.py
uv run python scripts/check_async_docstrings.py

# 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

fix-async-docstrings:
poetry run python scripts/fix_async_docstrings.py
uv run python scripts/fix_async_docstrings.py

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

build-docs:
cd website && npm clean-install && npm run build
cd website && uv run npm clean-install && uv run npm run build

run-docs: build-api-reference
cd website && npm clean-install && npm run start
cd website && uv run npm clean-install && uv run npm run start
2 changes: 1 addition & 1 deletion docs/01_overview/02_setting_up.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If these commands return the respective versions, you're ready to continue.

## Installation

Apify client for Python is available as the [`apify-client`](https://pypi.org/project/crawlee/) package on PyPI. To install it, run:
Apify client for Python is available as the [`apify-client`](https://pypi.org/project/apify-client/) package on PyPI. To install it, run:

```sh
pip install apify-client
Expand Down
Loading