romkan2
romkan2 is a modernized, actively maintained fork of python-romkan, designed as a drop-in replacement for the original library.
This is a Romaji/Kana conversion library for Python, which is used to convert a Japanese Romaji (ローマ字) string to a Japanese Kana (仮名) string or vice versa.
Why romkan2?
The original python-romkan by Mort Yao has not been actively maintained in recent years. This fork aims to:
- Support modern Python versions (3.9+)
- Modernize the codebase with type hints and improved code structure
- Use contemporary Python packaging standards (pyproject.toml)
- Maintain full backward compatibility as a drop-in replacement
Heritage
This library is the Pythonic port of Ruby/Romkan, originally authored by Satoru Takabayashi and ported by Masato Hagiwara, then modernized by Mort Yao.
romkan2 handles both Katakana (片仮名) and Hiragana (平仮名) with the Hepburn (ヘボン式) romanization system, as well as the modern Kunrei-shiki (訓令式) romanization system.
Installation
Install via pip:
pip install romkan2
Or install from source:
git clone https://github.com/altescy/romkan2.git
cd romkan2
pip install -e .
Usage
import romkan2
# Convert Kana to Romaji
print(romkan2.to_roma("にんじゃ"))
# => ninja
print(romkan2.to_hepburn("にんじゃ"))
# => ninja
print(romkan2.to_kunrei("にんじゃ"))
# => ninzya
# Convert Romaji to Kana
print(romkan2.to_hiragana("ninja"))
# => にんじゃ
print(romkan2.to_katakana("ninja"))
# => ニンジャ
API Reference
to_katakana(string: str) -> str
Convert a Romaji (ローマ字) to a Katakana (片仮名).
to_hiragana(string: str) -> str
Convert a Romaji (ローマ字) to a Hiragana (平仮名).
to_kana(string: str) -> str
Convert a Romaji (ローマ字) to a Katakana (片仮名). (same as to_katakana)
to_hepburn(string: str) -> str
Convert a Kana (仮名) or a Kunrei-shiki Romaji (訓令式ローマ字) to a Hepburn Romaji (ヘボン式ローマ字).
to_kunrei(string: str) -> str
Convert a Kana (仮名) or a Hepburn Romaji (ヘボン式ローマ字) to a Kunrei-shiki Romaji (訓令式ローマ字).
to_roma(string: str) -> str
Convert a Kana (仮名) to a Hepburn Romaji (ヘボン式ローマ字).
Migration from python-romkan
romkan2 is a drop-in replacement for python-romkan. Simply replace:
# Old
import romkan
# New
import romkan2 as romkan
License
romkan2 is licensed under the BSD license.
Credits
- Original Ruby/Romkan: Satoru Takabayashi
- Python port: Masato Hagiwara
- python-romkan: Mort Yao
- romkan2 (this fork): Yasuhiro Yamaguchi
Metadata
Release files for romkan2 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| romkan2-0.1.1.tar.gz | 7.8 kB | Without provenance | Details for romkan2-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| romkan2-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for romkan2-0.1.1-py3-none-any.whl |
Total release size: 17.5 kB
Release files / romkan2-0.1.1.tar.gz
| Download URL | romkan2-0.1.1.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f05667dd6f91ea06e1aee918ce788fede25b78bc2158ddefe6e3d15b55647589
|
|
BLAKE2b-256 checksum How to use checksums |
a57d34af470e515e86cd9270fe565f4a9c5e84ddb9fd19c4f2c9fcee2e215dca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Release files / romkan2-0.1.1-py3-none-any.whl
| Download URL | romkan2-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a19f7f420eef384b214befc47ec0bef2722cf6fcc8c6cc66abf903fa343bbef
|
|
BLAKE2b-256 checksum How to use checksums |
5e130e1f09f24b04e146ea0074c9f94c5de3b54492bdeb22172323dfd5975602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Security for romkan2 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.