Use published deps and isolate runner tasks
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Build Debian package / build (amd64) (push) Waiting to run
Build Debian package / build (arm64) (push) Waiting to run
Build Debian package / test (amd64, ubuntu-24.04) (push) Blocked by required conditions
Build Debian package / test (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Build Debian package / release (push) Blocked by required conditions
Build Docker image / buildx (push) Waiting to run
Run linters / lint (push) Waiting to run
Build Pip package / build (push) Waiting to run
Release State / release-state (push) Waiting to run
Parallel Tests / Discover test files (push) Waiting to run
Parallel Tests / ${{ matrix.test.name }} (push) Blocked by required conditions
Parallel Tests / Plugin tests (push) Waiting to run
Run tests / python_tests (ubuntu-22.04, 3.13) (push) Waiting to run
Run tests / docker_tests (push) Waiting to run

This commit is contained in:
Nick Sweeting 2026-05-14 17:24:26 -07:00
parent 9b9d4b275c
commit 2c3146549a
No known key found for this signature in database
10 changed files with 65 additions and 2965 deletions

View File

@ -97,7 +97,7 @@ jobs:
- name: Build local wheel
run: |
uv sync --locked --all-extras --no-install-project --no-install-workspace --no-sources
uv sync --all-extras --no-install-project --no-install-workspace --no-sources
uv build --wheel --out-dir /tmp/wheels/
- name: Download .deb artifact

View File

@ -55,7 +55,7 @@ jobs:
- name: Build local sdist
run: |
uv sync --locked --all-extras --no-install-project --no-install-workspace --no-sources
uv sync --all-extras --no-install-project --no-install-workspace --no-sources
uv build --sdist --out-dir /tmp/sdist/
- name: Generate formula from local sdist

View File

@ -39,7 +39,7 @@ jobs:
version: 1.0
- name: UV install archivebox dev + run sub-dependencies
run: uv sync --locked --all-extras --no-install-project --no-install-workspace --no-sources
run: uv sync --all-extras --no-install-project --no-install-workspace --no-sources
- name: UV build archivebox and archivebox/pkgs/* packages
run: |
@ -53,7 +53,7 @@ jobs:
password: ${{ secrets.PYPI_PAT_SECRET }}
- name: UV install archivebox and archivebox/pkgs/* locally for tests
run: uv sync --locked --all-extras --no-sources
run: uv sync --all-extras --no-sources
- name: UV run archivebox init + archivebox version
run: |

View File

@ -100,7 +100,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/uv
key: ${{ runner.os }}-${{ matrix.python }}-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }}
key: ${{ runner.os }}-${{ matrix.python }}-uv-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python }}-uv-
@ -160,7 +160,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/uv
key: ${{ runner.os }}-3.13-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }}
key: ${{ runner.os }}-3.13-uv-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-3.13-uv-

View File

@ -57,7 +57,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/uv
key: ${{ runner.os }}-${{ matrix.python }}-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }}
key: ${{ runner.os }}-${{ matrix.python }}-uv-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python }}-uv-

View File

@ -340,27 +340,26 @@ RUN ( \
######### Build Dependencies ####################################
# Install ArchiveBox Python venv dependencies from uv.lock
# Install ArchiveBox Python venv dependencies from pyproject.toml.
RUN --mount=type=bind,source=pyproject.toml,target=/app/pyproject.toml \
--mount=type=bind,source=uv.lock,target=/app/uv.lock \
--mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$TARGETVARIANT \
--mount=type=cache,target=/root/.cache/uv,sharing=locked,id=uv-$TARGETARCH$TARGETVARIANT \
echo "[+] PIP Installing ArchiveBox dependencies from pyproject.toml and uv.lock..." \
echo "[+] PIP Installing ArchiveBox dependencies from pyproject.toml..." \
&& apt-get update -qq \
&& apt-get install -qq -y --no-install-recommends build-essential gcc python3-dev \
&& uv sync \
--frozen \
--inexact \
--all-extras \
--no-install-project \
--no-install-workspace \
--no-sources \
&& apt-get purge -y python3-dev build-essential gcc \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# installs the pip packages that archivebox depends on, defined in pyproject.toml and uv.lock dependencies
# installs the pip packages that archivebox depends on, defined in pyproject.toml dependencies
# Install ArchiveBox Python package from the checked-out source.
# Sibling abx-* packages are installed from uv.lock inside the container, not copied from the local checkout.
# Sibling abx-* packages are installed from PyPI inside the container, not copied from the local checkout.
COPY --chown=root:root --chmod=755 "." "$CODE_DIR/"
RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked,id=uv-$TARGETARCH$TARGETVARIANT \
echo "[*] Installing ArchiveBox Python source code from $CODE_DIR..." \

View File

@ -1,6 +1,7 @@
from __future__ import annotations
import asyncio
import contextvars
import json
import os
import shutil
@ -41,6 +42,7 @@ from abx_dl.orchestrator import (
)
from abx_dl.services.process_service import ProcessService as HookProcessService
from abx_dl.services.snapshot_service import SnapshotService as HookSnapshotService
from abxbus.event_bus import EventBus
from .archive_result_service import ArchiveResultService
from .binary_service import BinaryService
@ -66,6 +68,14 @@ def _normalize_runtime_config(config: dict[str, Any]) -> dict[str, Any]:
return {key: value for key, value in json.loads(json.dumps(config, default=str)).items() if value is not None}
def _runner_task_context() -> contextvars.Context:
context = contextvars.copy_context()
context.run(EventBus.current_event_context.set, None)
context.run(EventBus.current_handler_id_context.set, None)
context.run(EventBus.current_eventbus_context.set, None)
return context
async def _emit_machine_config(
bus,
*,
@ -211,7 +221,7 @@ class CrawlRunner:
task = self.snapshot_tasks.get(snapshot_id)
if task is not None and not task.done():
return
task = asyncio.create_task(self.run_snapshot(snapshot_id))
task = asyncio.create_task(self.run_snapshot(snapshot_id), context=_runner_task_context())
self.snapshot_tasks[snapshot_id] = task
async def wait_for_snapshot_tasks(self) -> None:

View File

@ -187,6 +187,46 @@ def test_ensure_background_runner_skips_when_orchestrator_running(monkeypatch):
assert started is False
def test_runner_task_context_clears_inherited_abxbus_handler_context(tmp_path):
from abx_dl.events import CrawlEvent, MachineEvent
from abx_dl.orchestrator import create_bus
from abxbus.event_bus import in_handler_context
from archivebox.services import runner as runner_module
bus = create_bus(name="test_runner_task_context_clears_inherited_abxbus_handler_context")
observations = []
async def emit_from_runner_task():
observations.append(("in_handler_context", in_handler_context()))
machine_event = bus.emit(MachineEvent(config={"ABX_RUNTIME": "archivebox"}, config_type="user"))
await machine_event.now()
observations.append(("machine_event_path", bool(machine_event.event_path)))
async def on_crawl(event):
assert in_handler_context() is True
task = asyncio.create_task(emit_from_runner_task(), context=runner_module._runner_task_context())
await task
bus.on(CrawlEvent, on_crawl)
async def run_test():
await bus.emit(
CrawlEvent(
url="https://example.com",
snapshot_id="snapshot-1",
output_dir=str(tmp_path),
),
).now()
await bus.wait_until_idle()
asyncio.run(run_test())
assert observations == [
("in_handler_context", False),
("machine_event_path", True),
]
def test_runner_prepare_refreshes_network_interface_and_attaches_current_process(monkeypatch):
from archivebox.base_models.models import get_or_create_system_user_pk
from archivebox.crawls.models import Crawl

View File

@ -1,6 +1,6 @@
[project]
name = "archivebox"
version = "0.9.30rc6"
version = "0.9.30rc7"
requires-python = ">=3.13"
description = "Self-hosted internet archiving solution."
authors = [{name = "Nick Sweeting", email = "pyproject.toml@archivebox.io"}]
@ -81,7 +81,7 @@ dependencies = [
"abxbus>=2.5.0", # EventBus API
"abxpkg>=1.10.7", # for: detecting, versioning, and installing binaries via apt/brew/pip/npm
"abx-plugins>=1.10.32", # shared ArchiveBox plugin package with install_args-only overrides
"abx-dl>=1.10.35", # shared ArchiveBox downloader package with install_args-only overrides
"abx-dl>=1.10.37", # shared ArchiveBox downloader package with install_args-only overrides
### UUID7 backport for Python <3.14
"uuid7>=0.1.0; python_version < '3.14'", # provides the uuid_extensions module on Python 3.13
]
@ -158,11 +158,6 @@ exclude-newer = "5 days"
exclude-newer-package = { abx-plugins = "1 second", abx-dl = "1 second", abxpkg = "1 second", abxbus = "1 second" }
# compile-bytecode = true
[tool.uv.sources]
abxpkg = { git = "https://github.com/ArchiveBox/abxpkg.git", branch = "main" }
abx-plugins = { git = "https://github.com/ArchiveBox/abx-plugins.git", branch = "main" }
abx-dl = { git = "https://github.com/ArchiveBox/abx-dl.git", branch = "main" }
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

2944
uv.lock

File diff suppressed because it is too large Load Diff