Thought for a couple of seconds
# Ethnicities
A lightweight Python package providing lists of the world’s most common ethnicities, organized by region and frequency. All keys are normalized to snake_case (lowercase ASCII, words joined with underscores).
## Installation
```bash
pip install ethnicities
Usage
from ethnicities import all_ethnicities, common, by_region, common_and_by_region
# List all 100 normalized ethnicity names
print(all_ethnicities[:5])
# → ['nigerian', 'ethiopian', 'congolese', 'egyptian', 'south_african']
# Get the “common” subset (e.g. top 20 by global population)
print(common)
# Look up by world region
print(by_region['Europe'])
# → ['russian', 'german', 'french', …, 'icelandic']
# Combined filter: ethnicities that are both “common” and in a given region
print(common_and_by_region['Asia'])
API
-
all_ethnicities List of all 100 normalized ethnicity identifiers.
-
common Subset of
all_ethnicitiesrepresenting the top ~20 by global population. -
by_region Dictionary mapping region names (e.g.
"Africa","Asia","Europe", etc.) to lists of normalized identifiers. -
common_and_by_region Dictionary mapping region names to the intersection of
commonandby_region[region].
Normalization Rules
- All identifiers are ASCII lowercase.
- Spaces, hyphens, and punctuation are replaced with underscores.
- No diacritics or non-English characters.
Example: “South African” →
south_african
Contributing
- Fork the repository
- Add or update entries in
data/…(YAML or JSON). - Run
make buildto regenerateall_ethnicities.py,by_region.py, etc. - Submit a pull request with tests and documentation updates.
License
Distributed under the MIT License. See LICENSE for details.
**Q1:** Would you like to include a code snippet demonstrating a reverse lookup (display name → normalized key)?
**Q2:** Should we add a CLI command (e.g. `ethnicities validate`) to enforce normalization rules on new entries?
**Q3:** Would embedding population metadata or external data-source links into the package enrich your use cases?
Metadata
Release files for ethnicities 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ethnicities-0.0.2.tar.gz | 4.0 kB | Without provenance | Details for ethnicities-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ethnicities-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for ethnicities-0.0.2-py3-none-any.whl |
Total release size: 9.4 kB
Release files / ethnicities-0.0.2.tar.gz
| Download URL | ethnicities-0.0.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0fadde2f01e549150df3d8b5809487e98e5736b22a68fa0e5f032bf0c620565
|
|
BLAKE2b-256 checksum How to use checksums |
79ea5474f5b5dad592d18a66d260e1d09a9ba0dd16d857d948d8b02dc71ddb79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / ethnicities-0.0.2-py3-none-any.whl
| Download URL | ethnicities-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8447abd975075b2a4fa27d571aeabdb21b5cc1ab7f8a61bb6bca899f6f6ffae0
|
|
BLAKE2b-256 checksum How to use checksums |
8e37bcdc99f9a9e6427fcd82d4add3a9927dbb4c72bbd654423d81cc2f2b33e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Security for ethnicities 0.0.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.