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.1b6

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.1b6
File Size Uploaded Provenance Actions
legalsuffix-0.0.1b6.tar.gz 99.6 kB With provenance Details for legalsuffix-0.0.1b6.tar.gz

Built distribution (wheel)

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

Total release size: 197.5 kB

Release files / legalsuffix-0.0.1b6.tar.gz

Download URL legalsuffix-0.0.1b6.tar.gz
Size 99.6 kB
Tags Source
SHA-256 checksum
How to use checksums
15ff3d75e62ae071d91b5066a62312caec99ac54fd2dc9e888ff33b67845fd4f
BLAKE2b-256 checksum
How to use checksums
f12621de797a3872f714fa30f51caa2560487a038f146bf209e145f82e6260ad
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 11, 2026.

Transparency log

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

Download URL legalsuffix-0.0.1b6-py3-none-any.whl
Size 97.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66bbb470948f0102af078a11801ccaa8ad9b661e4789894bee1abcf0fe0f158f
BLAKE2b-256 checksum
How to use checksums
c8f38053c372017de9d149056b653cba368b89bc663d72956048ecf2de9b12ad
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 11, 2026.

Transparency log

Security for legalsuffix 0.0.1b6

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.1b6.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 11, 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