From 2f96781879c4a5c3755a74ca905c0d0efc017ee4 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Tue, 28 Jul 2026 22:25:31 +0200 Subject: [PATCH 1/4] build: replace hatchling with the uv_build backend Also migrates the license metadata to PEP 639 (`license` as an SPDX expression plus `license-files`), which is what uv_build reads to ship LICENSE inside the wheel. The resulting wheel is content-identical to the hatchling one. The `allow-direct-references` hatch setting is dropped - no dependency uses a direct reference. --- .rules.md | 2 +- pyproject.toml | 26 +++++++------------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.rules.md b/.rules.md index 7f15c3e2..047895db 100644 --- a/.rules.md +++ b/.rules.md @@ -4,7 +4,7 @@ This file provides guidance to programming agents when working with code in this ## Project Overview -The Apify SDK for Python (`apify` package on PyPI) is the official library for creating [Apify Actors](https://docs.apify.com/platform/actors) in Python. It provides Actor lifecycle management, storage access (datasets, key-value stores, request queues), event handling, proxy configuration, and pay-per-event charging. It builds on top of the [Crawlee](https://crawlee.dev/python) web scraping framework and the [Apify API Client](https://docs.apify.com/api/client/python). Supports Python 3.11–3.14. Build system: hatchling. +The Apify SDK for Python (`apify` package on PyPI) is the official library for creating [Apify Actors](https://docs.apify.com/platform/actors) in Python. It provides Actor lifecycle management, storage access (datasets, key-value stores, request queues), event handling, proxy configuration, and pay-per-event charging. It builds on top of the [Crawlee](https://crawlee.dev/python) web scraping framework and the [Apify API Client](https://docs.apify.com/api/client/python). Supports Python 3.11–3.14. Build system: uv_build. ## Common Commands diff --git a/pyproject.toml b/pyproject.toml index 607778bd..c3912811 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,20 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["uv_build>=0.12.0,<0.13.0"] +build-backend = "uv_build" [project] name = "apify" version = "4.0.0" description = "Apify SDK for Python" authors = [{ name = "Apify Technologies s.r.o.", email = "support@apify.com" }] -license = { file = "LICENSE" } +license = "Apache-2.0" +license-files = ["LICENSE"] readme = "README.md" requires-python = ">=3.11" classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -88,21 +88,9 @@ dev = [ "werkzeug<4.0.0", # Werkzeug is used by httpserver ] -[tool.hatch.build.targets.wheel] -packages = ["src/apify"] - -[tool.hatch.build.targets.sdist] -only-include = [ - "src/apify", - "CHANGELOG.md", - "CONTRIBUTING.md", - "LICENSE", - "README.md", - "pyproject.toml", -] - -[tool.hatch.metadata] -allow-direct-references = true +# The module, pyproject.toml, README, and LICENSE are included in the sdist by default. +[tool.uv.build-backend] +source-include = ["CHANGELOG.md", "CONTRIBUTING.md"] [tool.ruff] line-length = 120 From fc411b03b1ff649e6745e953af071099e0dac846 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Tue, 28 Jul 2026 22:25:32 +0200 Subject: [PATCH 2/4] docs: bump uv to 0.12 in the uv project guide Dockerfile --- docs/03_guides/code/uv_project/Dockerfile | 4 ++-- .../version-4.0/03_guides/code/uv_project/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/03_guides/code/uv_project/Dockerfile b/docs/03_guides/code/uv_project/Dockerfile index 24e7a44b..77a247e9 100644 --- a/docs/03_guides/code/uv_project/Dockerfile +++ b/docs/03_guides/code/uv_project/Dockerfile @@ -4,8 +4,8 @@ # You can also use any other image from Docker Hub. FROM apify/actor-python:3.14 -# Add the uv binary from its official distroless image (pinned to the 0.11.x line). -COPY --from=ghcr.io/astral-sh/uv:0.11 /uv /uvx /bin/ +# Add the uv binary from its official distroless image (pinned to the 0.12.x line). +COPY --from=ghcr.io/astral-sh/uv:0.12 /uv /uvx /bin/ # Configure uv for container builds: # - compile installed packages to bytecode, so the Actor starts faster, diff --git a/website/versioned_docs/version-4.0/03_guides/code/uv_project/Dockerfile b/website/versioned_docs/version-4.0/03_guides/code/uv_project/Dockerfile index 24e7a44b..77a247e9 100644 --- a/website/versioned_docs/version-4.0/03_guides/code/uv_project/Dockerfile +++ b/website/versioned_docs/version-4.0/03_guides/code/uv_project/Dockerfile @@ -4,8 +4,8 @@ # You can also use any other image from Docker Hub. FROM apify/actor-python:3.14 -# Add the uv binary from its official distroless image (pinned to the 0.11.x line). -COPY --from=ghcr.io/astral-sh/uv:0.11 /uv /uvx /bin/ +# Add the uv binary from its official distroless image (pinned to the 0.12.x line). +COPY --from=ghcr.io/astral-sh/uv:0.12 /uv /uvx /bin/ # Configure uv for container builds: # - compile installed packages to bytecode, so the Actor starts faster, From 12107cf9390bb5455dc200f3b22c2a1188bf2dec Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 29 Jul 2026 08:21:52 +0200 Subject: [PATCH 3/4] build: drop the version constraint on the uv_build requirement --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c3912811..ffe7cba5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["uv_build>=0.12.0,<0.13.0"] +requires = ["uv_build"] build-backend = "uv_build" [project] From 0b5afe9c0264b0798b1dd63bb92bdde250209cbc Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 29 Jul 2026 08:42:20 +0200 Subject: [PATCH 4/4] build: move the sdist include comment inside the uv build-backend section --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ffe7cba5..3e49e538 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,8 +88,8 @@ dev = [ "werkzeug<4.0.0", # Werkzeug is used by httpserver ] -# The module, pyproject.toml, README, and LICENSE are included in the sdist by default. [tool.uv.build-backend] +# The module, pyproject.toml, README, and LICENSE are included in the sdist by default. source-include = ["CHANGELOG.md", "CONTRIBUTING.md"] [tool.ruff]