mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-05-21 12:16:46 +02:00
7eb32fedee
- Expand ruff rules (B, S, SIM, RET, COM, C4, G, PT, PIE, T20, DTZ, ICN, TCH, RUF, ANN) - Switch pyright to strict mode with relaxed test environment - Replace try-except-pass with contextlib.suppress throughout - Move type-only imports into TYPE_CHECKING blocks - Replace ambiguous Unicode chars (en dash, multiplication sign, Greek alpha) with ASCII - Move color-matcher from base deps to [gpu], remove unused requests dep - Add pyright to dev deps, update dependabot to uv ecosystem - Fix hardcoded version in test_version, unused unpacked vars in tests - Update maintain.sh, CLAUDE.md, .gitignore, .claude/settings.json - Remove obsolete .agents/rules/project.md - Upgrade all dependencies (Pygments vulnerability fix) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Remove-AI-Watermarks
CLI tool and Python library for removing visible and invisible AI watermarks from images.
Build & Run
uv pip install -e . # base install (visible removal + metadata)
uv pip install -e ".[gpu]" # + invisible removal (torch, diffusers, ultralytics)
uv pip install -e ".[dev]" # + dev tools (pytest, ruff, pyright)
Test & Lint
uv run pytest # run tests
uv run ruff check --fix # lint
uv run ruff format # format
uv run pyright # type check
./maintain.sh # all of the above + dependency audit
Architecture
src/remove_ai_watermarks/— main package (src-layout, hatchling build)cli.py— Click CLI with commands:visible,invisible,metadata,all,batchgemini_engine.py— visible watermark: reverse alpha blending + NCC detectioninvisible_engine.py— invisible watermark: diffusion regeneration wrappermetadata.py— EXIF/PNG/C2PA metadata detection and strippinghumanizer.py— film grain + chromatic aberration (analog humanizer)face_protector.py— YOLO face detection + soft-blend restorationnoai/— vendored invisible removal core (watermark_remover, cleaner, ctrlregen/)assets/— embedded alpha maps (gemini_bg_48.png, gemini_bg_96.png)tests/— pytest suite (uses tmp_path, no external data deps)
Key Conventions
- Python 3.10+, ruff line-length 120, pyright strict mode, type hints everywhere
- GPU/ML modules (invisible_engine, ctrlregen, watermark_remover) are optional — guard imports with
is_available()checks - Tests for ML modules are limited to availability checks (require multi-GB downloads)
- Use
uvfor all package operations, never rawpip _refs/directory is excluded from all checks — contains third-party reference code
Release Process
To create a new release, run:
./release.sh <version> # e.g. ./release.sh 0.4.0
The script will: validate version format (X.Y.Z) → run all checks (ruff, pytest, pyright) → update version in pyproject.toml and src/remove_ai_watermarks/__init__.py → commit → create git tag vX.Y.Z → push. GitHub Actions will then automatically create a GitHub Release with build artifacts.
When asked to make a release, always use ./release.sh.
Pre-commit Hook
Git hooks live in .githooks/. Run ./maintain.sh once to activate them (sets core.hooksPath). The pre-commit hook runs ruff check, ruff format --check, and pytest.
Language
- Code, comments, docstrings, commits, docs: English only
- Communication with the user: Russian