Skip to main content

pangu.py

PyPI Version Python Versions PyPI Downloads

Opinionated paranoid text spacing in Python: automatically inserts whitespace between CJK (Chinese, Japanese, Korean) and ANS (alphabetical letters, numerical digits and symbols).

Installation

$ uv add pangu
# or
$ pip install -U pangu

Usage

Python Library

import pangu

new_text = pangu.space_text("你從什麼時候開始產生了我沒使用Monkey Patch的錯覺?")
# new_text = "你從什麼時候開始產生了我沒使用 Monkey Patch 的錯覺?"

new_content = pangu.space_file("path/to/file.txt", encoding="utf-8")
# new_content = "與 PM 戰鬥的人,應當小心自己不要成為 PM"

pangu.has_proper_spacing("聽說 Hadoop 工程師睡不著的時候都會 Map/Reduce 羊")
# True

CLI

$ pangu-py "為了讓公司的開發流程正常化,有人提議要導入DevOps,但是因為有部分工程師反對,主管決定讓大家投票表決,有三個選項1.導入2.不導入3.維持現狀"
為了讓公司的開發流程正常化,有人提議要導入 DevOps,但是因為有部分工程師反對,主管決定讓大家投票表決,有三個選項 1. 導入 2. 不導入 3. 維持現狀

$ pangu-py -t "為什麼小明有問題都不Google?因為他有Bing"
為什麼小明有問題都不 Google?因為他有 Bing

$ pangu-py -f path/to/file.txt
未來的某一天,Gmail 配備的 AI 可能會得出一個結論:想要消滅垃圾郵件最好的辦法就是消滅人類

$ pangu-py -c "心裡想的是Microservice,手裡做的是Distributed Monolith"; echo $?
Corrected: 心裡想的是 Microservice,手裡做的是 Distributed Monolith
1

$ echo "Workaround雖可恥但有用" | pangu-py
Workaround 雖可恥但有用

$ uv run python -m pangu "聽說新來的工程師喜歡玩密室逃脫,但是看他玩了一個下午都還沒離開Vim呢"
聽說新來的工程師喜歡玩密室逃脫,但是看他玩了一個下午都還沒離開 Vim 呢

$ uvx pangu "聽說桐島rm -rf /*了"
聽說桐島 rm -rf /* 了

License

Released under the MIT License.

Author

Metadata

Release files for pangu 6.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pangu 6.1.0
File Size Uploaded
pangu-6.1.0.tar.gz 20.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pangu 6.1.0
File Interpreter ABI Platform
pangu-6.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.4 kB

Release files / pangu-6.1.0.tar.gz

Download URL pangu-6.1.0.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ac6f361aedc0da8706518c4eb515d81d81825d4ae0b3bfba22f7817b0c7d8362
BLAKE2b-256 checksum
How to use checksums
0c91f4b30efbda15e900e3279942f586e2e36b50906a62c9ba81c91bd8b58d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / pangu-6.1.0-py3-none-any.whl

Download URL pangu-6.1.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39e06483e647da65b4600d2804a208c4f599f14396b0a1fe491b59717a371a58
BLAKE2b-256 checksum
How to use checksums
b5c1bc80ddfd5f7564ba9e206f2515505ce5a72cf33bbc3eef5d1597f8b0f452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

6.1.0 This release

2 release files

6.0.0

2 release files

5.0.0

2 release files

3.3.0.1

1 release file

3.0.0

2 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page