From bc277a37c5e7b3f1231403bc864067a53f932aca Mon Sep 17 00:00:00 2001 From: openhands Date: Tue, 14 Oct 2025 20:33:23 +0000 Subject: [PATCH] Modernize packaging to PEP 621 standards with pyproject.toml - Created modern pyproject.toml following PEP 621 standards - Added comprehensive project metadata and build system configuration - Updated license format to SPDX standard (MIT) - Added project URLs for homepage, repository, bug tracker, and documentation - Configured script installation for command-line tools - Added package discovery and data file specifications - Created MANIFEST.in for proper file inclusion in distributions - Reduced setup.py to minimal backward compatibility stub - Removed legacy setup.cfg files - Added support for Python 3.13 in classifiers - Enhanced project metadata with keywords and better descriptions - Tested both wheel and source distribution builds successfully This modernization brings the package up to current Python packaging standards while maintaining full backward compatibility and existing functionality. Co-authored-by: openhands --- MANIFEST.in | 16 ++++++++ epitran/setup.cfg | 5 --- pyproject.toml | 101 ++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 2 - setup.py | 47 ++------------------- 5 files changed, 120 insertions(+), 51 deletions(-) create mode 100644 MANIFEST.in delete mode 100644 epitran/setup.cfg create mode 100644 pyproject.toml delete mode 100644 setup.cfg diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..43eae91e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,16 @@ +# Include the license and readme files +include LICENSE.txt +include README.md +include index.rst + +# Include all data files (already handled by package_data but good to be explicit) +recursive-include epitran/data *.csv *.txt *.json *.bib + +# Include the scripts +recursive-include epitran/bin *.py + +# Exclude test files and cache +recursive-exclude epitran/test * +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] +recursive-exclude * .DS_Store \ No newline at end of file diff --git a/epitran/setup.cfg b/epitran/setup.cfg deleted file mode 100644 index 2e9053c0..00000000 --- a/epitran/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bdist_wheel] -universal = 1 - -[metadata] -license_file = LICENSE.txt diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..375cd437 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,101 @@ +[build-system] +requires = ["setuptools>=64", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "epitran" +version = "1.25.1" +description = "Tools for transcribing languages into IPA." +readme = "README.md" +license = "MIT" +authors = [ + {name = "David R. Mortensen", email = "dmortens@cs.cmu.edu"} +] +maintainers = [ + {name = "David R. Mortensen", email = "dmortens@cs.cmu.edu"} +] +requires-python = ">=3.10" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Linguistic", + "Topic :: Scientific/Engineering :: Artificial Intelligence", +] +keywords = ["linguistics", "phonetics", "IPA", "transliteration", "phonology"] +dependencies = [ + "setuptools", + "regex", + "panphon>=0.20", + "marisa-trie", + "requests", + "jamo", +] + +[project.urls] +Homepage = "https://github.com/dmort27/epitran" +Repository = "https://github.com/dmort27/epitran" +"Bug Tracker" = "https://github.com/dmort27/epitran/issues" +Documentation = "https://github.com/dmort27/epitran#readme" +Download = "https://github.com/dmort27/epitran/archive/1.25.1.tar.gz" + +# Scripts will be handled via setuptools scripts configuration +# since they don't follow the standard entry point pattern + +[tool.setuptools] +zip-safe = true +script-files = [ + "epitran/bin/epitranscribe.py", + "epitran/bin/uigtransliterate.py", + "epitran/bin/detectcaps.py", + "epitran/bin/connl2ipaspace.py", + "epitran/bin/connl2engipaspace.py", + "epitran/bin/migraterules.py", + "epitran/bin/decompose.py", + "epitran/bin/testvectorgen.py", +] + +[tool.setuptools.packages.find] +include = ["epitran*"] +exclude = ["epitran.test*"] + +[tool.setuptools.package-data] +epitran = [ + "data/*.csv", + "data/*.txt", + "data/*.json", + "data/map/*.csv", + "data/pre/*.txt", + "data/post/*.txt", + "data/space/*.csv", + "data/strip/*.csv", + "data/reromanize/*.csv", + "data/rules/*.txt", + "data/bib/*.bib", +] + +[tool.setuptools.dynamic] +# If you want to make version dynamic in the future, uncomment: +# version = {attr = "epitran.__version__"} + +# Development dependencies (optional) +[project.optional-dependencies] +dev = [ + "pytest>=6.0", + "pytest-cov", + "black", + "flake8", + "mypy", +] +test = [ + "pytest>=6.0", + "pytest-cov", +] \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2a9acf13..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py index 19c6dee4..ce95c637 100644 --- a/setup.py +++ b/setup.py @@ -1,46 +1,5 @@ -from io import open +# Minimal setup.py for backward compatibility +# All configuration is now in pyproject.toml from setuptools import setup -setup(name='epitran', - version='1.25.1', - description='Tools for transcribing languages into IPA.', - long_description=open('README.md', encoding='utf-8').read(), - long_description_content_type='text/markdown', - url='http://github.com/dmort27/epitran', - download_url='https://github.com/dmort27/epitran/archive/1.25.1.tar.gz', - author='David R. Mortensen', - author_email='dmortens@cs.cmu.edu', - license='MIT', - python_requires='>=3.10', - install_requires=['setuptools', - 'regex', - 'panphon>=0.20', - 'marisa-trie', - 'requests', - 'jamo'], - scripts=['epitran/bin/epitranscribe.py', - 'epitran/bin/uigtransliterate.py', - 'epitran/bin/detectcaps.py', - 'epitran/bin/connl2ipaspace.py', - 'epitran/bin/connl2engipaspace.py', - 'epitran/bin/migraterules.py', - 'epitran/bin/decompose.py', - 'epitran/bin/testvectorgen.py',], - packages=['epitran'], - package_dir={'epitran': 'epitran'}, - package_data={'epitran': ['data/*.csv', 'data/*.txt', - 'data/map/*.csv', 'data/*.json', - 'data/pre/*.txt', 'data/post/*.txt', - 'data/space/*.csv', 'data/strip/*.csv', - 'data/reromanize/*.csv', - 'data/rules/*.txt', - 'data/bib/*.bib']}, - zip_safe=True, - classifiers=['Operating System :: OS Independent', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Text Processing :: Linguistic'] - ) +setup()