Skip to main content
https://img.shields.io/pypi/v/schwifty.svg?style=flat-square https://img.shields.io/github/actions/workflow/status/mdomke/schwifty/lint-and-test.yml?branch=main&style=flat-square https://img.shields.io/pypi/l/schwifty.svg?style=flat-square https://readthedocs.org/projects/schwifty/badge/?version=latest&style=flat-square https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square https://img.shields.io/codecov/c/gh/mdomke/schwifty?token=aJj1Yg0NUq&style=flat-square

Gotta get schwifty with your IBANs

schwifty is a Python library for working with bank account numbers and bank identifiers: IBANs (International Bank Account Numbers, ISO 13616), BICs (Business Identifier Codes, ISO 9362) and the national account numbers they are built from. It brings the knowledge needed to work with them along: the format of the account numbers of 127 countries, the national check digit algorithms of 24 of them, bank registries for 47 countries generated from their official sources, and the SEPA schemes that banks take part in.

>>> from schwifty import IBAN
>>> iban = IBAN("DE89 3704 0044 0532 0130 00", validate_bban=True)
>>> iban.bank_code, iban.account_code
('37040044', '0532013000')
>>> iban.bank.name, iban.bic
('Commerzbank', <BIC=COBADEFF>)
>>> from schwifty.domain import SEPAScheme
>>> SEPAScheme.CORE_DIRECT_DEBIT in iban.sepa_schemes
True

Features

IBANs

  • validate the check digits and the country specific format of IBANs, for the 105 countries of the SWIFT IBAN registry and 22 countries that use IBANs without being part of it

  • generate IBANs from country code, bank code and account number, including the national check digits, or random but valid ones for testing

  • access all components, e.g. bank code, branch code and account code, as attributes

  • use the IBAN and BIC types directly in Pydantic models

National account numbers

  • validate and compute the national check digits of domestic account numbers for 24 countries, with or without an IBAN, e.g. the check digit methods of German banks, the French RIB key or the Spanish dígitos de control

BICs and banks

  • validate the structure and country of BICs, and convert between bank codes and BICs

  • look up the bank behind a bank code or BIC in bank registries for 47 countries, generated from the official sources of central banks and banking associations where they are available

  • identify retired bank codes that IBANs in circulation still carry, and tell whether their bank merged into another one or closed

  • check which SEPA schemes the bank of an IBAN or BIC takes part in, from the SCL directory of the Deutsche Bundesbank

See the docs for more information.

Versioning

Since the IBAN specification and the mapping from BIC to bank_code is updated from time to time, schwifty uses CalVer for versioning with the scheme YY.0M.Micro.

Installation

To install schwifty, simply:

$ pip install schwifty

Development

The only prerequisite to work on schwifty is uv. Running uv sync creates a virtual environment with all development dependencies (including the tools mentioned below).

We use ruff as code formatter and linter. This avoids discussions about style preferences in the same way as gofmt does the job for Golang. The conformance to the formatting rules is checked in the CI pipeline, so that it is recommendable to install the configured prek-hook, in order to avoid long feedback-cycles.

$ uv sync --all-groups --all-extras
$ uv run prek install

You can also run uv run poe fmt to format the code or use one of the available editor integrations. See the contributing guide for the full list of development commands and the contribution workflow.

Project Information

schwifty is released under MIT license and its documentation lives at Read the Docs. The code is maintained on GitHub and packages are distributed on PyPI

Name

Since swift and swiftly were already taken by the OpenStack-project, but we somehow wanted to point out the connection to SWIFT, Rick and Morty came up with the idea to name the project schwifty.

https://i.cdn.turner.com/adultswim/big/video/get-schwifty-pt-2/rickandmorty_ep205_002_vbnuta15a755dvash8.jpg

Metadata

Release files for schwifty 2026.11.2

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

Source distribution (sdist)

Source distribution for schwifty 2026.11.2
File Size Uploaded Provenance Actions
schwifty-2026.11.2.tar.gz 1.0 MB Without provenance Details for schwifty-2026.11.2.tar.gz

Built distribution (wheel)

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

Total release size: 1.5 MB

Release files / schwifty-2026.11.2.tar.gz

Download URL schwifty-2026.11.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
76f9bf7715252fdfd9419696d8b07200f34c5cdae7b8010bf1a7d2dd73738c8c
BLAKE2b-256 checksum
How to use checksums
e10a74d0ebf308e45d2bdd44a64be9780929622f57b59902e98cff6a6c3a8400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / schwifty-2026.11.2-py3-none-any.whl

Download URL schwifty-2026.11.2-py3-none-any.whl
Size 494.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25a7171739b2bf2e3c8beb3d83230ef9f314d4a90f285330eba8d371cdaf1da0
BLAKE2b-256 checksum
How to use checksums
907b70661ee7e99a57c78faf195b649fb4666c43484f4b08d419ec01b368a40e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for schwifty 2026.11.2

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

2026.11.2 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