Skip to main content
Pre-release

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

LegalSuffix logo

legalsuffix

Coverage 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.1a2

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

Built distribution (wheel)

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

Total release size: 196.9 kB

Release files / legalsuffix-0.0.1a2.tar.gz

Download URL legalsuffix-0.0.1a2.tar.gz
Size 99.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2c486d7cd203ad5a9c2f193589a9b0c564b0911d91753a284a6cce186693a3b0
BLAKE2b-256 checksum
How to use checksums
9a038b592f030e926ac38393543d088aab7b901842eb0f3e06b006cc8e032aa7
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.1a2-py3-none-any.whl

Download URL legalsuffix-0.0.1a2-py3-none-any.whl
Size 97.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f4c0532c9179bee3c27639b53e0642c2e6c5bebe97dcb2a3c06707aee1931dc
BLAKE2b-256 checksum
How to use checksums
0a6c083ff13daa800d8e864ea3d9b4352987af811bad0fb9ab8e71e6e51981c8
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.1a2

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