Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

LegalSuffix logo

legalsuffix

Coverage PyPI Python License: MIT

Detect, normalize, and strip legal entity suffixes (LLC, LTD, GmbH, OOO, 株式会社…) in 20+ languages. Parse company names safely.

Operations

The package exposes these operations from legalsuffix. Country and language filters are optional; country codes use ISO 3166-1 alpha-2 and language codes use ISO 639-1 two-letter codes.

from legalsuffix import (
    get_suffixes,
    match_legal_suffix,
    normalize_legal_suffix,
    parse_company_name,
    strip_legal_suffix,
)

Get suffix records

get_suffixes returns LegalSuffix records. Filters are optional.

suffixes = get_suffixes(country_code="DE", language_code="de")
for suffix in suffixes[:5]:
    print(suffix.elf_code, suffix.entity_legal_form_name_local_name)

Match a suffix

match_legal_suffix finds a legal form in the company name. Some registry names place the legal form before additional descriptive text. It returns None if there is no match. The end offset is exclusive.

company = "Musterfirma GmbH"
match = match_legal_suffix(company, country_code="DE")
if match is not None:
    print(match.suffix)  # "GmbH"
    print(match.start_pos, match.end_pos)  # 12 16
    print(match.records[0].elf_code)  # ELF code for this legal form

Normalize a suffix

Normalization trims surrounding whitespace, ignores punctuation and accents, and lowercases the suffix.

normalize_legal_suffix(" GmbH. ")  # "gmbh"

Parse a company name

parse_company_name returns the company name with the matched legal form removed, along with the optional suffix match. Text after the form is preserved.

parsed = parse_company_name("Musterfirma GmbH", country_code="DE")
print(parsed.name)  # "Musterfirma"
if parsed.suffix is not None:
    print(parsed.suffix.suffix)  # "GmbH"

Strip a suffix

strip_legal_suffix removes the recognized legal form and preserves any text that follows it.

strip_legal_suffix("Musterfirma GmbH", country_code="DE")  # "Musterfirma"

Country codes use ISO 3166-1 alpha-2, and language codes use ISO 639-1 two-letter codes.

Development hooks

Install the pre-commit hook to run the unit tests and refresh the coverage badge before a commit that changes a Python file under src/:

uv run pre-commit install

If the badge changes, stage README.md and retry the commit so the updated coverage is included.

Data Source

ISO 20275: Entity Legal Forms Code List: Entity Legal Forms Code List (Version 1.6 )

Metadata

Release files for legalsuffix 0.0.1b4

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

Source distribution (sdist)

Source distribution for legalsuffix 0.0.1b4
File Size Uploaded Provenance Actions
legalsuffix-0.0.1b4.tar.gz 99.3 kB With provenance Details for legalsuffix-0.0.1b4.tar.gz

Built distribution (wheel)

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

Total release size: 197.2 kB

Release files / legalsuffix-0.0.1b4.tar.gz

Download URL legalsuffix-0.0.1b4.tar.gz
Size 99.3 kB
Tags Source
SHA-256 checksum
How to use checksums
82c582cd1c6999487d57b6c0edc0fcbb0be533c47fe1e9376777c73d22c14460
BLAKE2b-256 checksum
How to use checksums
24eaf9368d27758cbfbb35a5a98472605b68020c44c0f77ebe2df2cfbeb22602
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Release files / legalsuffix-0.0.1b4-py3-none-any.whl

Download URL legalsuffix-0.0.1b4-py3-none-any.whl
Size 97.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51bc0f7de83a023c95b0128cb26ed22fcda97a34ee1de29ecc936482b317a8dc
BLAKE2b-256 checksum
How to use checksums
c12be9cdcc38e13c716ca5854cfb30d67f55603fa548bd4f28ec74ad1e619045
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Security for legalsuffix 0.0.1b4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for legalsuffix-0.0.1b4.tar.gz

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 Nov 10, 2026.

Transparency log

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.

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