Skip to content

feat: Add es_PE locale with providers#2303

Open
AmoghDeshmukh wants to merge 3 commits intojoke2k:masterfrom
AmoghDeshmukh:feature/add-es_PE-locale
Open

feat: Add es_PE locale with providers#2303
AmoghDeshmukh wants to merge 3 commits intojoke2k:masterfrom
AmoghDeshmukh:feature/add-es_PE-locale

Conversation

@AmoghDeshmukh
Copy link
Copy Markdown

@AmoghDeshmukh AmoghDeshmukh commented Jan 2, 2026

A new directory was created at faker/providers/es_PE/ to house the following new provider modules:

  1. Provider Implementation
    address: Generates realistic Peruvian addresses, including departments, cities, and correctly formatted postal codes.
    automotive: Creates Peruvian vehicle license plates, supporting both the modern (LLL-NNN) and previous (LL-NNNN) formats.
    bank: Provides Peruvian banking data, including 20-digit Interbank Account Codes (CCI) and names of major local banks.
    company: Generates Peruvian company names with appropriate legal suffixes (e.g., S.A.C., E.I.R.L.).
    internet: Localizes internet data, ensuring generated email addresses and domains use the .pe top-level domain.
    person: Provides common Peruvian first names and last names, including some of indigenous origin, by extending the base Spanish provider.
    phone_number: Generates valid phone numbers with formats for mobile phones and landlines (both for Lima and other provinces).
    ssn: Creates Peruvian national identification numbers, including the 8-digit DNI (national identity document) and the 11-digit RUC (taxpayer registry number) with a valid check-digit calculation.
    color, currency, date_time, job: These providers were added by inheriting directly from the existing es_ES locale, as their data is largely identical.

  2. Testing
    tests/providers/test_es_PE.py: A new test file was created to validate all the custom es_PE providers. It includes specific tests for the formats and logic of addresses, license plates, bank accounts, phone numbers, DNI, and RUC, ensuring the generated data is accurate and conforms to Peruvian standards. It also includes basic checks for the cloned providers.

closes #2301

Comment thread faker/providers/person/es_PE/__init__.py
@AmoghDeshmukh
Copy link
Copy Markdown
Author

@fcurella can you please check the PR I have added the changes.

Copy link
Copy Markdown
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few of merge markers (>>>) that need to be cleaned up

# - Registro Nacional de Identidad y Estado Civil (RENIEC) — https://www.reniec.gob.pe
# - Supplemental verification from Wikipedia — "List of common Peruvian given names"
# Accessed: 2026-02-07
>>>>>>> origin/feature/add-es_PE-locale
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line needs to be removed


def company_prefix(self) -> str:
return self.random_element(self.company_prefixes)
>>>>>>> origin/feature/add-es_PE-locale
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line needs to be removed

if self.generator.random.randint(1, 4) > 1:
return self.mobile_number()
return self.landline_number()
>>>>>>> origin/feature/add-es_PE-locale
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line needs to be removed

Suggested change
>>>>>>> origin/feature/add-es_PE-locale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add es_PE providers

2 participants