Skip to main content

PySerialNumbers

The PySerialNumbers library offers functionalities for manipulating serial numbers. In particular the possibility of reading a character string formatted according to the ad hoc grammar, then of converting it into a list of serial numbers.

Version: 1.0.1 (2025-05-05)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You can consult the GNU General Public License on http://www.gnu.org/licenses/gpl-3.0.html.

Install

This installs a package that can be used from Python (import serialnumbers).

To install for all users on the system, administrator rights (root) may be required.

PySerialNumbers library requires Python 3.4 or later.

From PyPI

PySerialNumbers can be installed from PyPI:

python -m pip install PySerialNumbers

Use python or python3 depending on your system. Usually python on a Windows system and python3 on a GNU/Linux system.

From source

Download the archive from https://github.com/dassym/PySerialNumbes/releases. Unpack the archive, enter the PySerialNumbers-x.y.z directory and run:

python -m pip install -e ./

Use python or python3 depending on your system. Usually python on a Windows system and python3 on a GNU/Linux system.

Documentation

You can find the documentation on https://pyserialnumbers.readthedocs.io/en/latest/.

Usage samples

This example shows how to create a list of 20 serial numbers from SN01 to SN20 according a string defining this list.

import serialnumbers
list(serialnumbers.SerialNumberList('SN01-SN10'))

The same example but with a different way of describing the list.

list(serialnumbers.SerialNumberList('SN01:20'))

This example shows how to create a list of 16 serial numbers from SN01 to SN04 and SN09 to SN20 .

list(serialnumbers.SerialNumberList('SN01-SN20;-SN05:4'))

The serial number list ad hoc grammar is described bellow according ANTLR notation.

/**
 * Grammar to define one or more serial numbers.
 */

grammar serialnumbers;

/**
 * List of serial numbers ranges
 */
list : range ( ';' range )* ;

/**
 * Range of serial numbers.
 */
range : '-'? sn ( '-' sn | ':' DIGIT+ )? ;

/**
 * serial number.
 */
sn : ALPHANUM* DIGIT+ ALPHA* ;

/**
 * Digit characters
 */
DIGIT : [0-9] ;

/**
 * Alphabetic characters
 */
ALPHA : [A-Za-z] | '+' | '/' | '*' | '.' | ',' | '$' | '#' | '@' | '~' | '_' ;

/**
 * Alphabetic and numeric characters
 */
ALPHANUM : ALPHA | DIGIT ;

Release files for PySerialNumbers 1.0.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 PySerialNumbers 1.0.1
File Size Uploaded
pyserialnumbers-1.0.1.tar.gz 9.1 kB Details

Built distribution (wheel)

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

Total release size: 19.3 kB

Release files / pyserialnumbers-1.0.1.tar.gz

Download URL pyserialnumbers-1.0.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a7b634c9736b96c4cf4724273b9ec95069a3c7cfc5bcc1b636a884de4cf937eb
BLAKE2b-256 checksum
How to use checksums
a1b0b8fc255f74ca4f87a61fe1ebec0bfb199c536c76e0c3110efcfbe98a23fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / pyserialnumbers-1.0.1-py3-none-any.whl

Download URL pyserialnumbers-1.0.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5be54d7b54eb040302161cf54a6a21aa983d747a5a99bdf6a56cc93e22dc758
BLAKE2b-256 checksum
How to use checksums
9a676f6c2c19af65765132aeae7c670b4654a7a847c4f210120a953fe8491c33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.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