Skip to main content

Bankkonto

Build and Test Upload Python Package

A tool for cleaning, parsing and ultimately validating Swedish bank account numbers, primarily written to be used for web applications with form data.

Installation

pip install bankkonto

Documentation

Will be available on ReadTheDocs eventually.

Usage

Direct usage for validating a bank account number:

>>> import bankkonto

>>> bankkonto.validate('9029', '5735211')
True

>>> bankkonto.validate('9029', '5735214')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hbldh/Repos/bankkonto/account.py", line 117, in validate
    bank_account_number, bank_name, bank_account_number[-1]))
bankkonto.exceptions.BankkontoValidationError: Bank account number 5735214 for Länsförsäkringar Bank has invalid control digit: 4`

Clean an entered string containing both clearing number and bank account number:

>>> import bankkonto
>>> cn, bn = bankkonto.clean_and_split('8156-6 111.222.333-2')
>>> print(cn)
'81566'
>>> print(bn)
'1112223332'
>>> bankkonto.validate(cn, bn)
True

There is also a WTForms validator at bankkonto.flask.BankkontoValidator that can be used with e.g. Flask-WTF.

Tests

Run with pytest:

pytest tests

Install pytest-cov first, and get coverage report:

pytest tests --cov bankkonto --cov-report term-missing

Metadata

Release files for bankkonto 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 bankkonto 1.0.1
File Size Uploaded
bankkonto-1.0.1.tar.gz 9.8 kB Details

Built distribution (wheel)

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

Total release size: 20.2 kB

Release files / bankkonto-1.0.1.tar.gz

Download URL bankkonto-1.0.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
afda5bc1fdcaa426a7cade2a7a9814886b303d4cb24b731e0a164316d08c6d81
BLAKE2b-256 checksum
How to use checksums
d7b278446d46833217333e11d38ad0274026761750c40dc11b258db1de7075e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 27, 2025.

Transparency log

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

Download URL bankkonto-1.0.1-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dead47bf59ad8c12365f223cb20376a05b9e2618b4b0e94b31332029bae3419
BLAKE2b-256 checksum
How to use checksums
488ee11ad0a02ab74ab3f0640434eb8323e29b74b8e4e4b7a0160498052baa55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 27, 2025.

Transparency log

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