Skip to main content

dz-format

Validate and parse Algerian formats: phone numbers, CCP accounts, RIP and RIB keys, vehicle plates, postal codes, NIN, NIF, NIS, RC numbers, wilayas and communes. The Python twin of the npm package @syscli/dz-format: same rules, same answers, checked in CI against the npm package on thousands of inputs.

pip install dz-format
pip install "dz-format[place]"   # for wilaya and commune names
from dz_format import phone, rip, rip_of, ccp, rib, plate, postal_code, rc

phone("0661 23 45 67")
# {"valid": True, "value": "+213661234567", "national": "0661234567",
#  "type": "mobile", "operator": "Mobilis"}

rip_of("200")                       # "00799999000000020091"
rib("002 00112 1123000001 47")      # {"valid": False, "reason": "key"}
plate("12345 116 16")["year"]       # 2016
rc("01B 0015609-16/00")["canonical"]  # "16/00-0015609 B 01"

from dz_format.place import commune
commune("El Marsa")                 # ambiguous, with 3 suggestions
commune("El Marsa", wilaya="Alger") # valid, code "1640"

Every function takes values the way people type them (spaces, dashes, +213, Arabic-Indic digits) and returns a dict: the parts of a valid value, or the reason it was rejected (empty, chars, length, prefix, key, range, unknown, ambiguous, format).

Valid means well formed, not that the account, line or company exists. The source of every rule is listed in https://github.com/syscli/dz-format/blob/main/sources/README.md. The RIB key leaves out the bank code: it is not the French RIB key.

Try it in the browser: https://syscli.github.io/dz-format/

No dependencies (syscli-algeria for the place module). Python 3.9 or later.

License

MIT

Metadata

Release files for dz-format 0.1.0

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

Source distribution (sdist)

Source distribution for dz-format 0.1.0
File Size Uploaded
dz_format-0.1.0.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dz-format 0.1.0
File Interpreter ABI Platform
dz_format-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.0 kB

Release files / dz_format-0.1.0.tar.gz

Download URL dz_format-0.1.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
089766e8f87cc0e0e30fa246b9efe9176805288d7ab51fb39dd77d341afeae3d
BLAKE2b-256 checksum
How to use checksums
ba9ae484506b1efae422f9d191f43668c946cc5aa16bc7b99e463c6de565f4a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / dz_format-0.1.0-py3-none-any.whl

Download URL dz_format-0.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2b86a1aba739f4b8cdb0598203331301261ff3fd55c21a54023c604a50d8d0c
BLAKE2b-256 checksum
How to use checksums
25512bda2817021c11cfd4d9bed60e4cc374ef354e82c409cafbec582002e3af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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