fix: Resolve installation bug #292 and modernize package management#325
Open
WhizZest wants to merge 1 commit intowenet-e2e:masterfrom
Open
fix: Resolve installation bug #292 and modernize package management#325WhizZest wants to merge 1 commit intowenet-e2e:masterfrom
WhizZest wants to merge 1 commit intowenet-e2e:masterfrom
Conversation
…agement - Fix IndexError in setup.py version extraction logic - Upgrade pynini dependency to support post-release versions - Replace manual version management with setuptools_scm - Migrate to modern pyproject.toml configuration - Remove obsolete setup.py and requirements.txt - Enable coexistence with nemo_text_processing in ChatTTS ecosystem
This was referenced Feb 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📑 语言切换 / Language Switch
🌐 English Description
Fix WeTextProcessing Installation Bug and Modernize Package Management System
🎯 Problem Background and Motivation
Core Issue Description
Encountered serious dependency conflict when using ChatTTS:
Dependency Conflict Scenario:
nemo_text_processing, which requirespynini==2.1.6.post1pynini==2.1.6, not supporting post-release versionsInstallation Failure Process:
pip install WeTextProcessing --no-deps- installation succeeded but ChatTTS reported WeTextProcessing missing (missing data files)pip install git+https://github.com/wenet-e2e/WeTextProcessing.git- encountered setup.py error: "IndexError: list index out of range"pip install "setuptools<70" "wheel"+--no-build-isolation- same IndexError occurred🔧 Solution Evolution Process
Phase 1: Attempt Non-Code Modification Solutions
Approach 1: Dependency Isolation Installation
pip install WeTextProcessing --no-deps # Result: Installation successful but runtime missing data filesApproach 2: Direct Source Installation
pip install git+https://github.com/wenet-e2e/WeTextProcessing.git # Result: Encountered "IndexError: list index out of range" errorApproach 3: Toolchain Downgrade
Phase 2: Attempt Internal setup.py Fixes
Attempt 1: Improve Version Extraction Method
Attempt 2: Use Git Commands to Get Tag
Attempt 3: Add VERSION File
Phase 3: Introduce Professional Solution
Final Choice: setuptools_scm
🚀 Final Implemented Improvements
1. Core Bug Fix
2. Dependency Compatibility Improvement
pynini==2.1.6incompatible with post-release versionspynini>=2.1.6,<2.2.0supports broader version range3. Complete Modernization Refactoring
🔧 Technical Changes Details
File Changes
New Files:
pyproject.toml: Complete modern packaging configurationDeleted Files:
setup.py: Completely removed, no longer neededrequirements.txt: Runtime dependencies (consolidated into pyproject.toml)Modified Files:
Configuration Mapping Table
name="WeTextProcessing"[project.name] = "WeTextProcessing"version=versiondynamic = ["version"]+[tool.setuptools_scm]author="Zhendong Peng, Xingchen Song"[project.authors]listauthor_email="..."[project.authors]listlong_description(read from README.md)[project.readme] = "README.md"long_description_content_type="text/markdown"[project.readme]implicitdescription="WeTextProcessing, including TN & ITN"[project.description]url="https://github.com/wenet-e2e/WeTextProcessing"[project.urls.Homepage]packages=find_packages()[tool.setuptools.packages.find]package_data={...}[tool.setuptools.package-data]install_requires=[...][project.dependencies]entry_points={...}[project.scripts]tests_require=["pytest"][project.optional-dependencies.test]classifiers=[...][project.classifiers]Key Configuration Improvements
Dependency Constraint Optimization:
Modernized Version Management:
Completely pyproject.toml-based Building:
✅ Test Verification
Functional Regression Testing
Installation Compatibility Testing
Configuration Completeness Verification
📈 Improvement Benefits
Direct Benefits (Solving Core Issues)
Long-term Benefits (Architectural Improvements)
🚀 Usage Instructions
User Installation (Dependency Conflict Resolved)
Developer Workflow
📝 Technical Decision Rationale
Why Delete setup.py?
Why Choose setuptools_scm?
Why Consolidate to pyproject.toml?
This PR resolves core installation bugs and implements complete modernization refactoring. Strongly recommended for merge.
Back to Top / 返回顶部
🇨🇳 中文描述
修复 WeTextProcessing 安装 bug 并现代化包管理系统
🎯 问题背景与动机
核心问题描述
在使用 ChatTTS 时遇到了严重的依赖冲突问题:
依赖冲突场景:
nemo_text_processing,而 nemo_text_processing 要求pynini==2.1.6.post1pynini==2.1.6,不支持 post-release 版本安装失败过程:
pip install WeTextProcessing --no-deps安装成功,但运行时 ChatTTS 认为 WeTextProcessing 不存在(缺少数据文件)pip install git+https://github.com/wenet-e2e/WeTextProcessing.git遇到 setup.py 代码错误:"IndexError: list index out of range"pip install "setuptools<70" "wheel"+--no-build-isolation,仍然出现相同错误🔧 解决方案演进过程
第一阶段:尝试不修改代码的方案
方案1:依赖隔离安装
pip install WeTextProcessing --no-deps # 结果:安装成功但运行时缺失数据文件方案2:直接从源码安装
pip install git+https://github.com/wenet-e2e/WeTextProcessing.git # 结果:遇到 "IndexError: list index out of range" 错误方案3:工具链降级
第二阶段:尝试在 setup.py 内部修复
尝试1:改进版本获取方式
尝试2:使用 git 命令获取 tag
尝试3:添加 VERSION 文件
第三阶段:引入专业解决方案
最终选择:setuptools_scm
🚀 最终实施的改进
1. 核心 bug 修复
2. 依赖兼容性改进
pynini==2.1.6不兼容 post-release 版本pynini>=2.1.6,<2.2.0支持更广泛的版本范围3. 完全现代化重构
_version.pypackage-data 声明🔧 技术变更详情
文件变更
新增文件:
pyproject.toml:完整的现代化打包配置删除文件:
setup.py:完全移除,不再需要requirements.txt:运行时依赖(已整合到 pyproject.toml)修改文件:
配置映射对照表
name="WeTextProcessing"[project.name] = "WeTextProcessing"version=versiondynamic = ["version"]+[tool.setuptools_scm]author="Zhendong Peng, Xingchen Song"[project.authors]列表author_email="..."[project.authors]列表long_description(从 README.md 读取)[project.readme] = "README.md"long_description_content_type="text/markdown"[project.readme]隐含description="WeTextProcessing, including TN & ITN"[project.description]url="https://github.com/wenet-e2e/WeTextProcessing"[project.urls.Homepage]packages=find_packages()[tool.setuptools.packages.find]package_data={...}[tool.setuptools.package-data]install_requires=[...][project.dependencies]entry_points={...}[project.scripts]tests_require=["pytest"][project.optional-dependencies.test]classifiers=[...][project.classifiers]关键配置改进
版本管理现代化:
完全基于 pyproject.toml 的构建:
版本管理现代化:
✅ 测试验证
功能回归测试
安装兼容性测试
配置完整性验证
📈 改进收益
直接收益(解决核心问题)
长期收益(架构改进)
🚀 使用说明
用户安装(已解决依赖冲突)
开发者工作流
📝 技术决策说明
为什么选择 setuptools_scm?
为什么整合到 pyproject.toml?
此 PR 解决了核心安装 bug 并实现了完全现代化重构,强烈建议合并。
返回顶部 / Back to Top