Registry / data / cleanco

cleanco

JSON →
library2.3pypypi✓ verified 28d ago

Cleanco is a Python library (current version 2.3) designed to process company names. It cleans names by stripping away terms indicating organization type (like 'Ltd.' or 'Corp.'), deduces the business entity type (e.g., 'limited liability company'), and suggests possible countries of establishment. Releases are somewhat irregular, with recent updates in late 2023 and early 2024.

pip install cleanco
INSTALL
IMPORT
SIG · CLEANCO
C
cleanco
datapythonv2.3
Install
1.7s avg
Import
10ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.006s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

basename
✓ from cleanco import basename
✗ from cleanco import cleanco; x = cleanco(name); x.clean_name()
The old class-based API (cleanco.cleanco().clean_name()) was removed in version 2.2. Use the functional API (cleanco.basename()) instead.
custom_basename
✓ from cleanco import custom_basename
Use this function for advanced customization with your own terms.
prepare_default_terms
✓ from cleanco import prepare_default_terms
✗ from cleanco import prepare_terms
`prepare_terms()` was renamed to `prepare_default_terms()` in version 2.2.

This example demonstrates how to clean a company name, deduce its business type, and suggest possible countries of origin using the primary functions of the cleanco library.

from cleanco import basename, typesources, matches, countrysources business_name = "Some Big Pharma, LLC" cleaned_name = basename(business_name) print(f"Cleaned name: {cleaned_name}") classification_sources = typesources() business_types = matches(business_name, classification_sources) print(f"Business types: {business_types}") country_classification_sources = countrysources() possible_countries = matches(business_name, country_classification_sources) print(f"Possible countries: {possible_countries}")
Debug
Known issues
breakingThe old class-based API, such as `cleanco.cleanco(name).clean_name()`, was entirely removed in version 2.2.
fix
Migrate to the new functional API, primarily `from cleanco import basename` and `basename(name)`.
affects: >=2.2
breakingThe function `prepare_terms()` was renamed to `prepare_default_terms()` in version 2.2.
fix
Update imports and function calls from `prepare_terms` to `prepare_default_terms`.
affects: >=2.2
breakingCleanco moved to be Python 3 only from version 2.0.1.
fix
Ensure your project runs on Python 3.6 or newer (2.3 supports 3.8-3.12).
affects: >=2.0.1
gotchaFrom version 2.2 onwards, terms no longer need to be explicitly passed to `basename()`, simplifying its usage. If you need custom terms, use `custom_basename()` instead.
fix
Review calls to `basename()` and remove redundant `terms` arguments. For custom terms, switch to `custom_basename()`.
affects: >=2.2
gotchaFor company names with multiple suffixes, you might need to run `basename()` more than once to ensure all suffixes are stripped, as the internal term data might cover these iteratively.
fix
Consider applying `basename()` in a loop or twice on names where multiple suffixes are common (e.g., 'Company, Inc. Ltd.').
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cleanco'
The 'cleanco' library has not been installed in your Python environment or the environment where your script is being run.
fix
Install the library using pip: `pip install cleanco`
cleanco basename not working / cleanco returns empty string
The `basename()` function might not correctly strip suffixes or might return an empty string for company names with unusual punctuation, multiple suffixes, or specific formatting that the default terms list doesn't fully cover.
fix
For complex cases, consider running `basename()` multiple times or using `custom_basename()` with a tailored list of terms. You can also inspect the `cleanco` GitHub issues for similar edge cases and potential workarounds or updates. Example: `from cleanco import basename; cleaned_name = basename(basename('Your Company Name, Inc. Ltd.'))`
AttributeError: module 'cleanco' has no attribute 'typesources'
You are attempting to access `typesources` (or `countrysources`) as an attribute of the `cleanco` module directly, but these are functions that need to be explicitly imported from the `cleanco` package.
fix
Import `typesources` (or `countrysources`) directly from the `cleanco` module: `from cleanco import typesources, matches` and then call `classification_sources = typesources()`
Upgrade
Version history
2.3latest on PyPI · released May 15, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
16
OpenAI (training)
1
Resources
cleanco — pip install cleanco · libregistry