Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ jobs:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .[test]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
38 changes: 28 additions & 10 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
description: 'Release version (optional, will be determined by setuptools_scm if not provided)'
required: false

jobs:
build:
Expand All @@ -14,16 +14,18 @@ jobs:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install wheel
pip install .[test]
pip install build twine

- name: Build Graph
run: |
Expand All @@ -37,17 +39,33 @@ jobs:
cp tn/*.fst graph
cp itn/*.fst graph

- name: Get version from setuptools_scm
id: scm_version
run: |
# Check if version is provided as input
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
# Get version from setuptools_scm
pip install setuptools_scm
VERSION=$(python -m setuptools_scm | tail -1)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
fi

- name: Upload Graph
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: release-graph-v${{ github.event.inputs.version}}
name: release-graph-v${{ steps.scm_version.outputs.VERSION }}
path: graph

- name: Build package
run: |
python -m build

- name: Publish on pypi.org
if: github.ref == 'refs/heads/master' && github.repository == 'wenet-e2e/WeTextProcessing'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel --version=${{ github.event.inputs.version}}
python -m pip install -U twine
python -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
python -m twine upload dist/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ build/
dist/
tn/*.far
itn/*.far

# Version file(setuptools_scm generated)
tn/_version.py
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[project]
name = "WeTextProcessing"
authors = [
{name = "Zhendong Peng", email = "pzd17@tsinghua.org.cn"},
{name = "Xingchen Song", email = "sxc19@tsinghua.org.cn"}
]
description = "WeTextProcessing, including TN & ITN"
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dynamic = ["version"]
dependencies = [
# Core dependencies for text processing functionality
"pynini>=2.1.6,<2.1.7",
"importlib_resources"
]

[project.urls]
Homepage = "https://github.com/wenet-e2e/WeTextProcessing"

[project.scripts]
wetn = "tn.main:main"
weitn = "itn.main:main"

[project.optional-dependencies]
test = [
"pytest",
"flake8"]
dev = [
# Development tools
"flake8",
"pre-commit==3.5.0",
"pytest"
]

[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "dirty-tag"
write_to = "tn/_version.py"
fallback_version = "1.0.5"

[tool.setuptools.packages.find]
where = ["."]
include = ["tn*", "itn*"]
namespaces = false

[tool.setuptools.package-data]
tn = ["*.fst", "chinese/data/*/*.tsv", "english/data/*/*.tsv", "english/data/*.tsv", "english/data/*/*.far"]
itn = ["*.fst", "chinese/data/*/*.tsv"]
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

51 changes: 0 additions & 51 deletions setup.py

This file was deleted.