mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-06-04 10:08:06 +02:00
5cf68a6a3d
Three P2 cleanups from a library-wide review. Detection -- single C2PA_AI_VENDORS registry (noai/constants.py): - C2PA_ISSUERS, SYNTHID_C2PA_ISSUERS, and identify._ISSUER_PLATFORM now derive from one C2paAiVendor table, so adding a C2PA vendor is one entry instead of edits in three places across two files. Behavior-identical (262 detection tests pass; the kept `needle` field is load-bearing -- it differs from `org` for Google and ByteDance, with no mechanical derivation). Code-health: - region_eraser.erase_lama now accepts grayscale/BGRA like erase_cv2 (it crashed on grayscale and silently dropped alpha on BGRA). +2 regression tests. - batch frees the device cache between images via a shared try_empty_device_cache helper (generalized from the MPS-only _try_clear_mps_cache, now reused by both the MPS->CPU fallback and the batch loop). - batch gained --controlnet-scale (parity with invisible/all). CI / packaging: - publish.yml uploads via `uv publish` (PyPI trusted publishing over OIDC), replacing pypa/gh-action-pypi-publish so uploads no longer depend on that action's bundled twine accepting the Metadata-Version. Workflow filename + pypi environment unchanged, so PyPI's trusted-publisher entry still matches. - hatchling pin relaxed <1.28 -> <1.31 (verified against hatch's changelog: 1.30.0 made Metadata 2.5 the default, 1.30.1 reverted to 2.4; 1.27-1.29 were always 2.4). Kept as belt-and-suspenders so the first uv-publish release ships 2.4, isolating the uploader swap from the metadata-version bump. Docs (CLAUDE.md, pyproject) synced; corrected the inaccurate "hatchling 1.28+ emits 2.5" note. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.4 KiB
YAML
41 lines
1.4 KiB
YAML
name: Publish to PyPI
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
environment: pypi
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: astral-sh/setup-uv@v7
|
|
|
|
- name: Verify release tag matches package version
|
|
run: |
|
|
tag="${{ github.event.release.tag_name }}"
|
|
version="$(grep -m1 '^version = ' pyproject.toml | sed -E 's/^version = "([^"]+)"/\1/')"
|
|
if [ "${tag#v}" != "$version" ]; then
|
|
echo "Release tag '$tag' does not match pyproject.toml version '$version'" >&2
|
|
exit 1
|
|
fi
|
|
echo "Release tag '$tag' matches package version '$version'"
|
|
|
|
- name: Build package
|
|
run: uv build
|
|
|
|
# Publish with `uv publish` (its own uploader, not the twine bundled in the
|
|
# old pypa action). Trusted publishing is automatic in GitHub Actions: the
|
|
# `id-token: write` permission + the `pypi` environment supply the OIDC token,
|
|
# and PyPI's trusted-publisher entry matches on repo + workflow filename +
|
|
# environment name (all unchanged from the pypa-action setup), so no API token
|
|
# is needed. uv's uploader also accepts Metadata-Version 2.5 -- the permanent
|
|
# fix that lets the hatchling pin be relaxed (see pyproject [build-system]).
|
|
- name: Publish to PyPI
|
|
run: uv publish |