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
88 changes: 88 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CD

on:
push:
branches: [ master ]
workflow_dispatch:

permissions:
contents: write
id-token: write

concurrency:
group: cd-${{ github.ref }}
cancel-in-progress: false

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: Install build tooling
run: |
python -m pip install --upgrade pip
python -m pip install build "setuptools>=69" "setuptools-scm[toml]>=8" wheel

- name: Find merged PR
id: pr
uses: actions-ecosystem/action-get-merged-pull-request@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Print PR info
run: |
echo "Merged PR number: ${{ steps.pr.outputs.number }}"
echo "Merged PR title : ${{ steps.pr.outputs.title }}"

- name: Decide bump from labels
id: bump
run: |
lbls="${{ steps.pr.outputs.labels }}"
bump=""
shopt -s nocasematch
if [[ "$lbls" == *"release:major"* ]]; then bump=major;
elif [[ "$lbls" == *"release:minor"* ]]; then bump=minor;
elif [[ "$lbls" == *"release:patch"* ]]; then bump=patch;
fi
echo "force=$bump" >> "$GITHUB_OUTPUT"

- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v10
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: ${{ steps.bump.outputs.force }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"

- name: Build artifacts
if: steps.release.outputs.released == 'true'
run: python -m build --sdist --wheel

- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@v10.4.1
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}

- name: Upload | Distribution Artifacts
if: steps.release.outputs.released == 'true'
uses: actions/upload-artifact@v4
with:
name: distribution-artifacts
path: dist
if-no-files-found: error

# - name: Publish to PyPI via OIDC
# if: steps.release.outputs.released == 'true'
# uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
name: CI

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.13']
python-version: ['3.10', '3.13']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
**/pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
9 changes: 9 additions & 0 deletions epitran/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
from importlib.metadata import version, PackageNotFoundError

from epitran._epitran import Epitran
from epitran.reromanize import ReRomanizer


try:
__version__ = version("epitran")
except PackageNotFoundError:
# package is not installed
pass

__all__ = ["Epitran", "ReRomanizer"]
1 change: 0 additions & 1 deletion epitran/_epitran.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import logging
from typing import Union

import panphon.featuretable
from epitran.epihan import Epihan, EpihanTraditional, EpiJpan, EpiCanto
Expand Down
2 changes: 0 additions & 2 deletions epitran/bin/migraterules.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

import glob
import re
import io
from typing import List, Optional

import csv


def build_rule(fields: List[str]) -> Optional[str]:
Expand Down
9 changes: 8 additions & 1 deletion epitran/epihan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- utf-8 -*-

import os.path
from typing import Optional, List, Tuple

import regex as re

Expand Down Expand Up @@ -46,6 +45,8 @@ def __init__(self, **kwargs) -> None:
cedict_file = kwargs.get('cedict_file', None)
rules_file = kwargs.get('rules_file', 'pinyin-to-ipa.txt')
tones = kwargs.get('tones', False)
assert ligatures is False, "Ligatures not supported for cmn-Hans"

if not cedict_file:
cedict_file = download.cedict()
if tones:
Expand Down Expand Up @@ -119,6 +120,8 @@ def __init__(self, **kwargs) -> None:
cedict_file = kwargs.get('cedict_file', None)
tones = kwargs.get('tones', False)
rules_file = kwargs.get('rules_file', 'pinyin-to-ipa.txt')
assert ligatures is False, "Ligatures not supported for cmn-Hant"

if not cedict_file:
cedict_file = download.cedict()
if tones:
Expand Down Expand Up @@ -147,6 +150,8 @@ def __init__(self, **kwargs) -> None:
cedict_file = kwargs.get('cedict_file', None)
tones = kwargs.get('tones', False)
rules_file = kwargs.get('rules_file', 'jyutping-to-ipa.txt')
assert ligatures is False, 'Ligatures not supported for yue-Hant'

if not cedict_file:
cedict_file = download.cc_canto()
if tones:
Expand All @@ -172,6 +177,8 @@ def __init__(self, **kwargs) -> None:
ligatures = kwargs.get('ligatures', False)
cedict_file = kwargs.get('cedict_file', None)
tones = kwargs.get('tones', False)
assert ligatures is False, 'Ligatures not supported for jpn-Jpan'

if not cedict_file:
cedict_file = download.opendict_ja()
self.cedict = cedict.CEDictTrieForJapanese(cedict_file)
Expand Down
3 changes: 1 addition & 2 deletions epitran/flite.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import logging
import os.path
import string
import sys
import unicodedata
from typing import Dict, List, Tuple, Any, Optional
from typing import Dict, List, Any

import regex as re

Expand Down
1 change: 0 additions & 1 deletion epitran/ppprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging
import os.path

from typing import Union

from importlib import resources

Expand Down
1 change: 0 additions & 1 deletion epitran/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from pathlib import Path

import regex as re
from importlib import resources

from epitran.exceptions import DatafileError

Expand Down
2 changes: 1 addition & 1 deletion epitran/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import csv
import unicodedata
from collections import defaultdict
from typing import DefaultDict, Callable, Any, Optional # pylint: disable=unused-import
from typing import DefaultDict, Callable, Any

from importlib import resources
import regex
Expand Down
2 changes: 1 addition & 1 deletion epitran/vector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import logging
from typing import List, Tuple, Any, Optional
from typing import List, Tuple, Optional

from epitran import Epitran
from epitran.space import Space
Expand Down
38 changes: 19 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["setuptools>=64", "wheel"]
requires = ["setuptools>=69", "setuptools-scm[toml]>=8", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "epitran"
version = "1.25.2"
dynamic = ["version"]
description = "Tools for transcribing languages into IPA."
readme = "README.md"
license = { text = "MIT-Modern-Variant"}
Expand Down Expand Up @@ -32,7 +32,6 @@ classifiers = [
]
keywords = ["linguistics", "phonetics", "IPA", "transliteration", "phonology"]
dependencies = [
"setuptools",
"regex",
"panphon>=0.20",
"marisa-trie",
Expand All @@ -42,10 +41,16 @@ dependencies = [

[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"
Repository = "https://github.com/dmort27/epitran"
Issues = "https://github.com/dmort27/epitran/issues"
Changelog = "https://github.com/dmort27/epitran/releases"

[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"
fallback_version = "0.0.0"


# Scripts will be handled via setuptools scripts configuration
# since they don't follow the standard entry point pattern
Expand Down Expand Up @@ -82,20 +87,15 @@ epitran = [
"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>=8.4.2",
"pytest-cov",
"black",
"flake8",
"mypy",
"ruff",
]
test = [
"pytest>=8.4.2",
"pytest-cov",
]

# Automated semantic versioning and release management
[tool.semantic_release]
version_source = "tag"
tag_format = "v{version}"
commit_parser = "conventional"
upload_to_pypi = false
Loading