personnummer 
Validate Swedish personal identity numbers. Version 3+ only supports Python 3.
Installation
pip install personnummer
or
pip3 install personnummer
Examples
- All examples that uses
personnummer.Personnumer([params]), can be replaced withpersonnummer.parse([params]).
Validation
from personnummer import personnummer
personnummer.valid("8507099805")
# => True
personnummer.valid("198507099805")
# => True
Format
from personnummer import personnummer
# Short format
pn = personnummer.Personnummer(8507099805)
pn.format()
# => '850709-9805'
# Long format
pn = personnummer.Personnummer('8507099805')
pn.format(True)
# => '198507099805'
Get Date
New in version 3.2.0
from personnummer import personnummer
pn = personnummer.Personnummer('19121212+1212')
pn.get_date()
# => datetime.date(1912, 12, 12)
Get Age
from personnummer import personnummer
pn = personnummer.Personnummer("19121212+1212")
pn.get_age()
# => 106
See personnummer/tests/test_personnummer.py for more examples.
License
MIT
Metadata
Release files for personnummer 3.2.1
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 |
|---|---|---|---|---|
| personnummer-3.2.1.tar.gz | 5.6 kB | Without provenance | Details for personnummer-3.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| personnummer-3.2.1-py3-none-any.whl | Python 3 | none | any | Details for personnummer-3.2.1-py3-none-any.whl |
Total release size: 12.8 kB
Release files / personnummer-3.2.1.tar.gz
| Download URL | personnummer-3.2.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b319741d8b326ab4359427e1fa6b03101d48b19efc9d1a53cf17515fb4cc8b4
|
|
BLAKE2b-256 checksum How to use checksums |
eec5d9cbf6f8d368ed175240e757888f4c9ebe443b6cf36b11bee72d2bf4c51b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / personnummer-3.2.1-py3-none-any.whl
| Download URL | personnummer-3.2.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15d6c42f87e84bb4a486a6076d29f4d823346e4b0545e3ff6af92e6e06bd05ed
|
|
BLAKE2b-256 checksum How to use checksums |
2258cf8e6dd8e25ee52c7db20f9a8da1f3e492ec28a7ae57c30533f83a6c2dff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for personnummer 3.2.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.