Skip to main content

PLMN to MCC and MNC Converter

This package provides tools to encode and decode PLMN (Public Land Mobile Network) identifiers to and from MCC (Mobile Country Code) and MNC (Mobile Network Code). The package includes a command-line interface (CLI) for easy usage.

Installation

You can install the plmn2mccmnc package using pip. It is recommended to use a virtual environment to avoid conflicts with other packages.

# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`

# Install the package
pip install plmn2mccmnc

Usage

Encoding

To encode MCC and MNC to a 3-byte hexadecimal PLMN, you can use the encode_mcc_mnc function.

from plmn2mccmnc.bitscoder import encode_mcc_mnc

mcc = "405"
mnc = "01"
plmn = encode_mcc_mnc(mcc, mnc)
print(plmn.hex())  # Output: 40f510

Decoding

To decode a 3-byte hexadecimal PLMN to MCC and MNC, you can use the decode_mcc_mnc function.

from plmn2mccmnc.bitscoder import decode_mcc_mnc

plmn = bytes.fromhex("40f510")
mcc, mnc = decode_mcc_mnc(plmn)
print(mcc, mnc)  # Output: 405 01

CLI Usage

The package includes a command-line interface (CLI) for encoding and decoding PLMN identifiers.

Encoding with CLI

To encode MCC and MNC using the CLI, run the following command:

python -m plmn2mccmnc encode 405 01

This will output:

40f510

Decoding with CLI

To decode a 3-byte hexadecimal PLMN using the CLI, run the following command:

python -m plmn2mccmnc decode 40f510

This will output:

405 01

CLI Help

To see the available options and usage instructions, use the --help flag:

python -m plmn2mccmnc --help

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your changes to your fork.
  5. Create a pull request to the main repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for plmn2mccmnc 0.1.1

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

Source distribution (sdist)

Source distribution for plmn2mccmnc 0.1.1
File Size Uploaded
plmn2mccmnc-0.1.1.tar.gz 4.4 kB Details

Built distribution (wheel)

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

Total release size: 9.0 kB

Release files / plmn2mccmnc-0.1.1.tar.gz

Download URL plmn2mccmnc-0.1.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8805699e0359c32edbb1b8ff0a92af987fbb90119edf61fb8098c0a8b5bfe5f1
BLAKE2b-256 checksum
How to use checksums
406d250e81eb31d6b9c8f59116ae79f9a9cb8101e232644a033d994ecd71dcd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.8

Release files / plmn2mccmnc-0.1.1-py3-none-any.whl

Download URL plmn2mccmnc-0.1.1-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48890a84c2ada40049092bf9296f67f1e8836cef9f0b58711ef90aceb4a06a66
BLAKE2b-256 checksum
How to use checksums
83c96330fffadac63bf000b0e1b2225ec5e24665683cd1064d9be225e19696e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.8

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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