Skip to content

Add linked administrative regions#2390

Open
ylub wants to merge 2 commits into
joke2k:masterfrom
ylub:add-linked-admin-regions
Open

Add linked administrative regions#2390
ylub wants to merge 2 commits into
joke2k:masterfrom
ylub:add-linked-admin-regions

Conversation

@ylub

@ylub ylub commented Jun 15, 2026

Copy link
Copy Markdown

What does this change

This PR adds linked administrative region methods for the following European locales:

Country in Faker
Austria 'de_AT'
Czech Republic (Czechia) 'cz_CZ'
Germany 'de_DE'
France 'fr_FR'
Italy 'it_IT'
Poland 'pl_PL'
Slovakia sk_SK'
Slovenia 'sl_SI'

This is somewhat related to #2383, but adds considerably less weight to faker

What was missing

Several of these locales already included first-level administrative regions, while some also included second-level administrative regions. However, there was no consistent way to generate linked administrative subdivisions where a generated second-level region belongs to a specific first-level region.

How this addresses it

This PR adds methods for working with linked administrative regions:

fake.admin1() returns a random first-level administrative region.
fake.admin2() returns a random second-level administrative region.
fake.admin2_from_admin1(admin1) returns a random second-level administrative region belonging to the specified first-level administrative region.
fake.admin2_with_admin1() returns a randomly generated second-level administrative region together with its corresponding first-level administrative region.
fake.admin2_w_admin1(admin1) returns a second-level administrative region together with the specified first-level administrative region.

Administrative region data was sourced from Statoids, Wikipedia's ISO 3166-2 references and administrative subdivision pages, and official government sources where available.

AI Assistance Disclosure (REQUIRED)

  • If AI tools were used, I have disclosed which ones, and fully reviewed and verified their output.
    I used ChatGPT for help in finding sources for the information, as well as to fine tune the code and for the fork/pull request.

Checklist

  • I have read the documentation about CONTRIBUTING
  • I have read the documentation about Coding style
  • I have run black instead of make lint and I confirmed consistency.

@ylub

ylub commented Jun 29, 2026

Copy link
Copy Markdown
Author

Hello - just wondering if there's any updates on this PR

Thanks!

@fcurella

Copy link
Copy Markdown
Collaborator

Could you expand on how this PR adds less weight than #2383 ?

I really think we need to come up with some kind of compressed format if we want this to be sustainable.

@ylub

ylub commented Jun 30, 2026

Copy link
Copy Markdown
Author

I was under the impression that these smaller changes were not as heavy as that huge 3000 line one from #2383.

Perhaps the admin regions that already exist in each country's provider could be used as aliases and it would be a matter of adding what is missing as well as the commands that link them

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.

2 participants