File size: 2,035 Bytes
616e23d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
import pathlib
from sys import version_info, exit
from setuptools import setup, find_packages
from Cython.Build import cythonize
from pkg_resources import parse_requirements

def write_version_py():
    version_txt_path = os.path.join("IndicTransToolkit", "version.txt")
    with open(version_txt_path, "r", encoding="utf-8") as f:
        version = f.read().strip()

    version_py_path = os.path.join("IndicTransToolkit", "version.py")
    with open(version_py_path, "w", encoding="utf-8") as f:
        f.write(f'__version__ = "{version}"\n')
    return version

# Enforce Python >= 3.8
if version_info < (3, 8):
    exit("Sorry, Python >= 3.8 is required for IndicTransToolkit.")

# Read long description from README
with open("README.md", "r", errors="ignore", encoding="utf-8") as fh:
    long_description = fh.read().strip()

# Write version.py from version.txt
version = write_version_py()

# Parse requirements.txt
req_file = pathlib.Path("requirements.txt")
requirements = [str(req) for req in parse_requirements(req_file.open())]

# Cython files to compile (adjust if your .pyx name differs)
cython_extensions = cythonize(
    [
        "IndicTransToolkit/processor.pyx",
    ],
    compiler_directives={"language_level": "3", "boundscheck": False},
)

setup(
    name="IndicTransToolkit",
    version=version,
    author="Varun Gumma",
    author_email="[email protected]",
    description="A simple, consistent, and extendable module for IndicTrans2 tokenizer compatible with HuggingFace models",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/VarunGumma/IndicTransToolkit",
    packages=find_packages(),  # Auto-detect packages
    license="MIT",
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires=">=3.8",
    install_requires=requirements,
    ext_modules=cython_extensions,
    zip_safe=False,
)