📡 Morsecode Handler
Easily encode and decode Morse code in Python 🐍.
This library is simple, lightweight, and includes both a Python API and a Command-Line Interface (CLI).
✅ Learn Morse code
✅ Encode secret messages
✅ Use it in scripts, projects, or just for fun
🚀 Installation
Install from PyPI:
pip install morsecode_handler
🛠️ Usage in Python
import morsecode_handler
# Encode text
encoded = morsecode_handler.encode("HELLO WORLD")
print(encoded)
# .... . .-.. .-.. --- / .-- --- .-. .-.. -..
# Decode Morse back to text
decoded = morsecode_handler.decode(".... . .-.. .-.. --- / .-- --- .-. .-.. -..")
print(decoded)
# HELLO WORLD
Lenient Mode (skip unknown characters)
import morsecode_handler
morsecode_handler.encode("HELLO 🙂", strict=False, unknown="?")
# .... . .-.. .-.. --- / ?
💻 Command Line Tool
Once installed, you also get the morsecode CLI:
# Encode
morsecode_handler encode "HELLO WORLD"
# .... . .-.. .-.. --- / .-- --- .-. .-.. -..
# Decode
morsecode_handler decode ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."
# HELLO WORLD
# Lenient mode (replace unknown characters with '?')
morsecode_handler encode "HELLO 🙂" --lenient
# .... . .-.. .-.. --- / ?
🌍 Supported Languages
This library supports 41 languages across Latin, Cyrillic, Arabic, Hebrew, Greek, and Korean scripts.
We follow the ISO 639-1 standard for the two-letter language codes (e.g., EN for English, FR for French, RU for Russian).
| Code | Language | Code | Language | Code | Language | Code | Language |
|---|---|---|---|---|---|---|---|
| AF | Afrikaans | AR | Arabic | EU | Basque | CA | Catalan |
| HR | Croatian | CS | Czech | DA | Danish | NL | Dutch |
| EN | English | EO | Esperanto | ET | Estonian | FI | Finnish |
| FR | French | GL | Galician | DE | German | EL | Greek |
| HE | Hebrew | HU | Hungarian | IS | Icelandic | ID | Indonesian |
| GA | Irish | IT | Italian | KO | Korean | LV | Latvian |
| LT | Lithuanian | MS | Malay | NO | Norwegian | PL | Polish |
| PT | Portuguese | RO | Romanian | RU | Russian | SR | Serbian |
| SK | Slovak | SL | Slovenian | ES | Spanish | SV | Swedish |
| TL | Tagalog | TR | Turkish | UK | Ukrainian | VI | Vietnamese |
⚡ Features
- 🔑 Encode and decode Morse code
- 🎯 Strict mode (raise errors) or Lenient mode (skip unknowns)
- 💻 CLI for quick terminal use
- 🌍 Multi-language support via JSON dictionary
- 🚀 High Performance: Features lazy-loaded data and
@functools.lru_cachefor maximum speed during bulk encoding/decoding. - 📝 MIT licensed — free to use anywhere
🛠️ Development & Testing
We welcome contributions! To set up the development environment, clone the repo and install the dev dependencies:
git clone https://github.com/mricardo888/morsecode.git
cd morsecode-handler
pip install -e ".[dev]"
Run the pytest suite to ensure everything is working correctly:
pytest -v tests/
📜 License
Released under the MIT License. Created by Ricardo (mricardo888).
Metadata
Release files for morsecode-handler 0.1.0
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 |
|---|---|---|---|---|
| morsecode_handler-0.1.0.tar.gz | 11.9 kB | Without provenance | Details for morsecode_handler-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| morsecode_handler-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for morsecode_handler-0.1.0-py3-none-any.whl |
Total release size: 23.0 kB
Release files / morsecode_handler-0.1.0.tar.gz
| Download URL | morsecode_handler-0.1.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5d94dbde82ca2f53d24e6a29db242e95178f9ea34ac908ce34e84b702a1c858
|
|
BLAKE2b-256 checksum How to use checksums |
e9fa35fc5ccd79bcc6f480494e466400da08528d89c6391d36690d6a554cb95d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / morsecode_handler-0.1.0-py3-none-any.whl
| Download URL | morsecode_handler-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c427708f9058823cbe80f394d6f38c4f3a4a965f68dbd9da53d021f2a0170af7
|
|
BLAKE2b-256 checksum How to use checksums |
2aec396160f9ec3643df5e569f803950bb8c3b7e1ed1f119f42e98c45b6e6613
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for morsecode-handler 0.1.0
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.