Skip to main content

quiclabel-coco-sync

CLI to incrementally sync a QuicLabel COCO dataset (annotations + images) from quiclabel-admin. Pulls a fresh annotations-YYYYMMDD-HHMMSS.json next to your existing dataset and multi-threadedly downloads only the images you don't already have.

Prerequisites

  • uv — Python package & runtime manager. Install:
    • macOS / Linux: curl -LsSf https://astral.sh/uv/install.sh | sh
    • Windows: winget install astral-sh.uv (or irm https://astral.sh/uv/install.ps1 | iex)
    • via pipx: pipx install uv
  • An API key — get one from quiclabel-admin: Settings → API Keys → New key. Copy the qk_... value immediately (it's only shown once).

No clone, no install — uvx downloads, caches and runs in one shot:

uvx quiclabel-coco-sync path/to/annotations.json \
  --admin-url https://quiclabel-admin.example.com \
  --api-key qk_xxxxxxxxxxxxxxxxxxxxxx

Or set env vars and call it bare:

export QUICLABEL_ADMIN_URL=https://quiclabel-admin.example.com
export QUICLABEL_API_KEY=qk_xxxxxxxxxxxxxxxxxxxxxx
uvx quiclabel-coco-sync path/to/annotations.json

Prefer a persistent install? Use uv tool:

uv tool install quiclabel-coco-sync
quiclabel-coco-sync path/to/annotations.json --admin-url ... --api-key ...

From the monorepo (contributors)

# From the repo root
pnpm sync-project-coco path/to/annotations.json \
  --admin-url https://quiclabel-admin.example.com \
  --api-key qk_xxxxxxxxxxxxxxxxxxxxxx

Or directly with uv against this app directory:

cd apps/quiclabel-sync-project-coco
uv sync
uv run quiclabel-coco-sync path/to/annotations.json \
  --admin-url https://quiclabel-admin.example.com \
  --api-key qk_xxxxxxxxxxxxxxxxxxxxxx

What it does

  1. Reads path/to/annotations.json and its meta block (added by the COCO exporter).
  2. Calls GET /api/v1/projects/<project_id>/coco with the same filters, paging by cursor — so 10k+ task projects don't blow up server memory.
  3. Writes path/to/annotations-20260519-143045.json (timestamped — never overwrites your input), or replaces the input file when --replace is set.
  4. Downloads any image referenced by the fresh dataset that is missing from path/to/images/ — both newly-added tasks and images that were already in your annotations.json but absent on disk — using a thread pool. Files already on disk are skipped by file name.

By default the input annotations.json and existing images/* files are never touched. Pass --replace to save the latest dataset under the input file name, backing up the original to annotations.backup-YYYYMMDD-HHMMSS.json next to it.

Each image entry carries the fields returned by the API — including source_path, the image's original path (from task.meta.sourcePath, null when absent) — so the synced annotations.json records where each image came from.

Configuration priority

Each value is resolved in this order — first wins:

  1. CLI flag (--project-id, --statuses, …)
  2. Env var (QUICLABEL_ADMIN_URL, QUICLABEL_API_KEY)
  3. meta block of the input json

If anything required is missing from all three, the CLI exits with a clear message naming the missing key and where to provide it.

Recovery

  • Partial failure (some images failed mid-run): just re-run the same command. Already-downloaded files are skipped by file name, so retry only fetches the remaining ones. The CLI tells you this in the failure summary.
  • Corrupt image file: delete it, then re-run.
  • A .part file in images/ indicates a crashed download. Safe to delete.

Development

cd apps/quiclabel-sync-project-coco
uv sync --group dev
uv run pytest

Releasing to PyPI (maintainers)

Releases are tag-driven. Pushing a coco-sync-v<version> tag triggers .github/workflows/coco-sync-release.yml, which builds, runs tests, and publishes to PyPI via Trusted Publishers (OIDC — no API token needed).

cd apps/quiclabel-sync-project-coco

# 1. bump version in pyproject.toml (e.g. 0.0.1 -> 0.0.2)
# 2. add a section in CHANGELOG.md
# 3. commit, then tag the exact same version
git add pyproject.toml CHANGELOG.md
git commit -m "coco-sync: release v0.0.2"
git tag coco-sync-v0.0.2
git push && git push origin coco-sync-v0.0.2

The release workflow asserts git tag ↔ pyproject.toml agreement and fails the publish if they drift.

One-time PyPI Trusted Publisher setup

In https://pypi.org/manage/project/quiclabel-coco-sync/settings/publishing/, add a publisher with:

Field Value
Owner weavejam
Repository quiclabel
Workflow name coco-sync-release.yml
Environment pypi

Also create a pypi environment in GitHub repo settings (optional protection rules: required reviewers, branch restrictions).

Manual fallback

If the workflow is unavailable, publish from your machine. Note that uv publish does not read ~/.pypirc (unlike twine) — pass the token via UV_PUBLISH_TOKEN or --token:

cd apps/quiclabel-sync-project-coco
uv build
# Powershell: extract token from ~/.pypirc and publish
$env:UV_PUBLISH_TOKEN = (Get-Content (Join-Path $env:USERPROFILE '.pypirc') |
  Where-Object { $_ -match '^password\s*=' } |
  ForEach-Object { ($_ -replace '^password\s*=\s*','').Trim() } |
  Select-Object -First 1)
uv publish

# bash equivalent:
export UV_PUBLISH_TOKEN=$(grep '^password' ~/.pypirc | head -1 | sed 's/^password *= *//')
uv publish

Get a PyPI API token at https://pypi.org/manage/account/token/.

⚠️ PyPI versions are immutable. Once a version is published it cannot be overwritten or re-uploaded — even after yank. Every release must bump the version in pyproject.toml (e.g. 0.0.1 → 0.0.2).

Metadata

Release files for quiclabel-coco-sync 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quiclabel-coco-sync 0.0.5
File Size Uploaded Provenance Actions
quiclabel_coco_sync-0.0.5.tar.gz 35.4 kB With provenance Details for quiclabel_coco_sync-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quiclabel-coco-sync 0.0.5
File Interpreter ABI Platform Actions
quiclabel_coco_sync-0.0.5-py3-none-any.whl Python 3 none any Details for quiclabel_coco_sync-0.0.5-py3-none-any.whl

Total release size: 49.2 kB

Release files / quiclabel_coco_sync-0.0.5.tar.gz

Download URL quiclabel_coco_sync-0.0.5.tar.gz
Size 35.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1847eaec9530bb03979d56046374bbd29116f6f6cf5ee2d4609f7c3d6119e6f
BLAKE2b-256 checksum
How to use checksums
b6851e48018556e54cfcf223b697abb75cd0e57f026c005636c01b58910e4c1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Release files / quiclabel_coco_sync-0.0.5-py3-none-any.whl

Download URL quiclabel_coco_sync-0.0.5-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1a220df23e0211b2aff46c6c423002e0d0e57fab39aae59d72e380611daaf35
BLAKE2b-256 checksum
How to use checksums
e00724a68074c233b6097f55ee482fcc2ee86c0c896d7fd264014a9cce837546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Security for quiclabel-coco-sync 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for quiclabel_coco_sync-0.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page