Files
remove-ai-watermarks/CLAUDE.md
T
test-userandClaude Opus 4.6 7eb32fedee refactor: enforce strict linting and type checking across codebase
- 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>
2026-04-01 11:42:42 -07:00

64 lines
2.6 KiB
Markdown

# Remove-AI-Watermarks
CLI tool and Python library for removing visible and invisible AI watermarks from images.
## Build & Run
```bash
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
```bash
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`, `batch`
- `gemini_engine.py` — visible watermark: reverse alpha blending + NCC detection
- `invisible_engine.py` — invisible watermark: diffusion regeneration wrapper
- `metadata.py` — EXIF/PNG/C2PA metadata detection and stripping
- `humanizer.py` — film grain + chromatic aberration (analog humanizer)
- `face_protector.py` — YOLO face detection + soft-blend restoration
- `noai/` — 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 `uv` for all package operations, never raw `pip`
- `_refs/` directory is excluded from all checks — contains third-party reference code
## Release Process
To create a new release, run:
```bash
./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