"""PyPI description = README.md without the Hugging Face model-card header, with repository links made absolute. Everything else is in pyproject.toml.""" import re from pathlib import Path from setuptools import setup REPO = "https://huggingface.co/docsumo/sumoOCR-tiny" def _absolute(m: "re.Match") -> str: image, label, target = m.group(1), m.group(2), m.group(3) kind = "resolve" if image else ("blob" if "." in target.rsplit("/", 1)[-1] else "tree") return f"{image}[{label}]({REPO}/{kind}/main/{target})" text = Path(__file__).with_name("README.md").read_text(encoding="utf-8") text = re.sub(r"\A---\n.*?\n---\n+", "", text, flags=re.S) text = re.sub(r"(!?)\[([^\]]*)\]\((?!https?://|#)([^)]+)\)", _absolute, text) setup( long_description=text, long_description_content_type="text/markdown", options={"sdist": {"owner": "root", "group": "root"}}, # no local user name in the source archive )