Skip to main content

pangu.py

PyPI Version Python Versions PyPI Downloads

Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).

Installation

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

Usage

In Python

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

In 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

Release files for pangu 6.0.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.0.0
File Size Uploaded
pangu-6.0.0.tar.gz 17.6 kB Details

Built distribution (wheel)

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

Total release size: 35.8 kB

Release files / pangu-6.0.0.tar.gz

Download URL pangu-6.0.0.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9c981a48468e6023f21be74b4c9fc70cb599f1f318af137eb449d7f5950599a0
BLAKE2b-256 checksum
How to use checksums
3d2b8a5e406b6e03a43a125a50995f25bd8fe4990aed33d68f7676c6f8146cc3
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 Sep 18, 2026.

Transparency log

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

Download URL pangu-6.0.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
581190a39736de0b61de32e22cab29193297d2eb2cf3d3071576a139bdac5f1a
BLAKE2b-256 checksum
How to use checksums
43282ca04cdb435f48cf3ddc6d0afee1436cdeea855a5f71f6fa6813a331f6f8
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 Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

6.0.0 This release

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