File size: 929 Bytes
10469c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""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
)