Skip to main content

poland-py (alpha)

A lightweight, zero-dependency Python utility for validating and extracting metadata from Polish PESEL numbers.

Installation

pip install poland-py

Usage

Basic validation and parsing

from poland_py import PESEL

pesel = PESEL("80010112345")

if pesel.is_valid():
    print("Valid PESEL")
    print(f"Birth date: {pesel.birth_date}")
    print(f"Year: {pesel.year}")
    print(f"Month: {pesel.month}")
    print(f"Day: {pesel.day}")
    print(f"Gender: {pesel.gender}")
    print(f"Age: {pesel.age}")
else:
    print("Invalid PESEL")

print(repr(pesel))  # <PESEL raw='80010112345' valid=True>

Invalid PESEL handling

from poland_py import PESEL

pesel = PESEL("12345")
print(pesel.is_valid())      # False
print(pesel.birth_date)      # None
print(pesel.gender)          # None
print(pesel.age)             # None

API

class PESEL

Constructor

  • PESEL(raw_value: str) – creates a PESEL object from a string (whitespace is stripped).

Methods

  • is_valid() -> bool – returns True if the PESEL number passes validation (length, checksum, date validity).

Properties

  • raw -> str – original input string (stripped).
  • birth_date -> Optional[date] – parsed birth date (datetime.date) or None if invalid.
  • year -> Optional[int], month -> Optional[int], day -> Optional[int] – date components, or None if invalid.
  • gender -> Optional[str] – "male" or "female", or None if invalid.
  • age -> Optional[int] – calculated age in years based on today's date, or None if invalid.

Representation

  • __repr__() -> str – e.g. <PESEL raw='80010112345' valid=True>.

Validation rules

The PESEL number is considered valid if:

  • it consists of exactly 11 digits,
  • the checksum (with weights 1, 3, 7, 9, 1, 3, 7, 9, 1, 3) matches the 11th digit,
  • the encoded birth date is a valid calendar date,
  • the month encoding corresponds to a supported century range (1800–2299).

Design goals

  • Zero dependencies – no external libraries required.
  • Simple API – single class for validation and parsing.
  • Educational and utility use – suitable for demos, prototypes, and lightweight tooling.

Disclaimer

This package is provided for informational and utility purposes only, on an “as is” basis, without warranties of any kind. It is not affiliated with or endorsed by any Polish government institution. The authors are not liable for any damages arising from its use, including but not limited to incorrect validation results, data misinterpretation, or business interruptions.

Do not rely on this package as the sole source of truth for legal, financial, or official identification purposes. Always verify critical data against official sources.

Metadata

Release files for poland-py 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 poland-py 0.1.1
File Size Uploaded Provenance
poland_py-0.1.1.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 7.1 kB

Release files / poland_py-0.1.1.tar.gz

Download URL poland_py-0.1.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ef0d429382e3a3b4aeee2f29b12e9a7c06ce7ad41319825916447418271a8297
BLAKE2b-256 checksum
How to use checksums
c8e6130477bc060cfc0d929c620a073380d6f6aadd06cbb5ffb2d45e6ed8e936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL poland_py-0.1.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5020cde8c39d666fd53c3fe315c7ca5331743a0609d96bacce14135eb331b4e8
BLAKE2b-256 checksum
How to use checksums
b416ca5e200b62c0379b2698b711703b8eff9d7a0eff1dd61b78350c7035e761
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for poland-py 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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