Skip to main content

Klingon Serial Python Module

klingon-serial unit tests Pre-PR Merge CI .github/workflows/post-pr-merge.yaml

Overview

The klingon_serial Python module is designed to generate a unique hexadecimal serial number, avoiding serial conflicts in a distributed environment. The serial number is a concatenation of the machine's MAC address, the process ID (PID), and the current time in epoch format with millisecond precision. The module aims to offer a robust method for generating serials that are virtually collision-free.

Installation

To install the module, you can use pip:

pip install klingon-serial

Serial Components

  1. MAC Address: A unique identifier assigned to network interfaces for communications. 12 characters in hexadecimal.
  2. Process ID (PID): Unique ID for each running process. Up to 6 characters in hexadecimal.
  3. Timestamp: Millisecond-precision epoch time. Up to 10 characters in hexadecimal.

These components are concatenated to form a unique serial number.

Usage

Here is how you can use the klingon_serial module:

import klingon_serial

# Generate a unique serial number
unique_serial = klingon_serial.generate()
print(f"Generated Serial: {unique_serial}")

Serial Number Structure

The generated serial number has the following structure:

[ 12 characters MAC ][ Up to 6 characters PID ][ 10 characters Timestamp ]

Example

An example serial number might look like this:

02C3F642A1EC3A4B9B0985F53E

Testing

To run the test suite, you can use:

python -m unittest discover -s tests

Contributing

Feel free to fork this repository and submit pull requests for improvements or additional features.

Metadata

Release files for klingon-serial 0.1.15

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

Source distribution (sdist)

Source distribution for klingon-serial 0.1.15
File Size Uploaded
klingon-serial-0.1.15.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for klingon-serial 0.1.15
File Interpreter ABI Platform
klingon_serial-0.1.15-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / klingon-serial-0.1.15.tar.gz

Download URL klingon-serial-0.1.15.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e622f6440125933644c24393fac6de1c64a01881e95e737d68d031cfa5a14331
BLAKE2b-256 checksum
How to use checksums
fc217f45911a13b68f9b154a7b3a7c378f5d3f04910d749442e164d927296cc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / klingon_serial-0.1.15-py3-none-any.whl

Download URL klingon_serial-0.1.15-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b3d4f3ffeecbaf25dffd08d05d9c17b1f8c5f5cf2dc29b8e770cc5e34fbc4a2
BLAKE2b-256 checksum
How to use checksums
689095a7882907157e45a5a2818e1fac6c70f8588b2753205de02cd6541e68df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.15 This release

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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