|
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
|
|
|
|
|
|
if version_info < (3, 8):
|
|
exit("Sorry, Python >= 3.8 is required for IndicTransToolkit.")
|
|
|
|
|
|
with open("README.md", "r", errors="ignore", encoding="utf-8") as fh:
|
|
long_description = fh.read().strip()
|
|
|
|
|
|
version = write_version_py()
|
|
|
|
|
|
req_file = pathlib.Path("requirements.txt")
|
|
requirements = [str(req) for req in parse_requirements(req_file.open())]
|
|
|
|
|
|
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(),
|
|
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,
|
|
)
|
|
|