Skip to content

Commit d2bbc55

Browse files
committed
feat(ci): add pypi release
1 parent 9491dde commit d2bbc55

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.github/workflows/release.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish Python Package
2+
on:
3+
release:
4+
types: [ created ]
5+
6+
jobs:
7+
pypi-publish:
8+
name: Upload release to PyPI
9+
runs-on: ubuntu-latest
10+
environment:
11+
name: pypi
12+
url: https://pypi.org/p/signwriting
13+
permissions:
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v5
17+
18+
- uses: actions/setup-python@v6
19+
with:
20+
python-version: "3.12"
21+
22+
- name: Extract release version
23+
id: get_version
24+
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
25+
26+
- name: Update version in pyproject.toml
27+
run: |
28+
sed -i 's/^version = .*/version = "${{ env.version }}"/' pyproject.toml
29+
30+
- name: Install build dependencies
31+
run: pip install build
32+
33+
- name: Build a binary wheel dist
34+
run: |
35+
rm -rf dist
36+
python -m build
37+
38+
- name: Publish distribution 📦 to PyPI
39+
uses: pypa/gh-action-pypi-publish@release/v1

signwriting/formats/swu.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import re
22

3+
import regex
4+
35
re_swu = {
46
'symbol': r'[\U00040001-\U0004FFFF]',
57
'coord': r'[\U0001D80C-\U0001DFFF]{2}',
@@ -28,3 +30,6 @@ def swu_add_prefix(swu_text: str) -> str:
2830
def is_swu(text: str) -> bool:
2931
# Using the regex pattern instead of the compiled regex for performance (about 30% faster)
3032
return bool(re.fullmatch(re_swu['sign_with_whitespace'], text))
33+
34+
def is_sgnw(text: str) -> bool:
35+
return bool(regex.fullmatch("\p{Sutton_SignWriting}+", text))

0 commit comments

Comments
 (0)