Files
codeberg-to-gitea-migrator/pyproject.toml
T
AlexKucera 137734673d
CI / test (push) Canceled after 0s
perf(migrator): parallelize and harden migration
The migrator was fully synchronous — every HTTP round-trip and git
op serialized over one blocking client, and a stalled git push could
hang it forever. Overlap the independent phases and bound the slow /
memory-heavy paths.

- clients: ApiClient is now thread-safe (per-thread httpx.Client) so
  labels, milestones, Pass-B comments, and release assets overlap via
  parallel(); --concurrency sizes it (default 8). Pass A issue/PR
  creation stays serial — entities are created in source-number order
  so the number map resolves forward cross-references.
- releases: stream assets through a spooled temp file instead of
  buffering each whole into memory; upload them concurrently.
- reliability: per-op --git-timeout (was unbounded hangs), a circuit
  breaker that aborts on a degraded target, jittered retry backoff,
  and a bulk timeout for large asset transfers.
- round-trips: set an issue's milestone in the create body; batch the
  deleted-branch PR-head git push and refs/pull/* pruning.
- fix: raw_get_stream 4xx/5xx raised AttributeError (resp.read().text
  on bytes) instead of ApiError — now decodes. Wrap mirror git ops in
  try/finally so tokenized remote URLs are scrubbed even on timeout.
- refactor: drop the typer dependency — the CLI is now stdlib argparse
  (same subcommands, flags, and env vars); remove dead code surfaced by
  a whole-repo audit (has_lfs, name_map, unused owner_repo param,
  stored-but-unread _base_url).
- ci: enable the uv download cache.

Tests cover parallel ordering, the circuit breaker, and the streamed
4xx path. CHANGELOG updated; the runtime dependency is now just httpx.
2026-08-11 13:36:11 +02:00

38 lines
1.1 KiB
TOML

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "codeberg-to-gitea-migrator"
version = "0.1.0"
description = "Migrate repositories (code, issues & PRs, releases & assets, labels & milestones) from Codeberg to a self-hosted Gitea instance."
readme = "README.md"
requires-python = ">=3.11"
license = "GPL-3.0-or-later"
license-files = ["LICENSE"]
authors = [{ name = "Alexander Kucera", email = "a.kucera@babylondreams.de" }]
keywords = ["migration", "codeberg", "gitea", "forgejo", "repository-migration"]
dependencies = ["httpx>=0.27"]
[project.optional-dependencies]
dev = ["pytest", "ruff"]
[project.scripts]
codeberg-to-gitea = "codeberg_to_gitea_migrator.cli:app"
[tool.hatch.build.targets.wheel]
packages = ["src/codeberg_to_gitea_migrator"]
[tool.ruff]
line-length = 100
target-version = "py311"
extend-exclude = ["audit"] # generated reports, not source
[tool.ruff.lint]
# Explicit rule set so locked-deps CI lints reproducibly (ruff's defaults drift
# across versions). Stable core: subset of pycodestyle + pyflakes.
select = ["E4", "E7", "E9", "F"]
[tool.pytest.ini_options]
testpaths = ["tests"]