Skip to main content

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_ethnicities representing 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 common and by_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

  1. Fork the repository
  2. Add or update entries in data/… (YAML or JSON).
  3. Run make build to regenerate all_ethnicities.py, by_region.py, etc.
  4. 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)

Source distribution for ethnicities 0.0.2
File Size Uploaded
ethnicities-0.0.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ethnicities 0.0.2
File Interpreter ABI Platform
ethnicities-0.0.2-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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