Repository navigation
feat: pure-Rust faker2 — Python binder + 151-locale engine + algorithmic formatters - #13
Merged
Merged
Conversation
Repackage native/ so the PyPI distribution and import module are both `faker2`: a thin Python binder (native/python/faker2/__init__.py) over the compiled Rust core `faker2._native`. `import faker2` runs the Rust engine; no fake-data logic in Python. - pyproject: name=faker2, version 40.28.1.post1, module-name faker2._native, dataset bundled into the wheel. - wheels.yml: build faker2 wheels (Linux x86_64/aarch64, macOS Intel/ARM, Windows) + an sdist, attach to the Release and publish to PyPI via trusted publishing (project faker2, workflow wheels.yml, environment pypi). Scope: the Rust core is en_US providers + 139-country name intelligence today; locales port into the core over time. Publishing this supersedes the pure-Python faker2 distribution — bump the version and retire the pure-Python publish workflow before releasing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… locales
Port all data-driven faker2 formatters to Rust via a declarative recipe map
(built by fanning out one sub-agent per provider) interpreted against the
extracted per-locale dataset:
- data/locales.json: every locale's provider data (151 locales, ~20 providers).
- data/recipes.json: 230 formatters classified CHOICE/FORMAT/NUMERIFY/BOTHIFY/
CONSTANT/ALGORITHMIC by the agents.
- rust/src/locale.rs (feature `locales`): Faker::gen(locale, formatter) resolves
recipes + a field-name fallback for locale-subclass tokens (gendered names,
city_name, company_prefix, ...) and a {{token}} template expander.
Coverage across 151 locales: name 150/151, job 151, company 146, city 145,
phone_number 141, address 47. Exposed on the pure-Rust `faker2` package:
faker2.Faker.gen(locale, name), faker2.locales() (151), faker2.locale_formatters().
The 193 ALGORITHMIC formatters (checksums, dates, Luhn, ...) are the remaining
port work, done in further agent waves.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…, ...) Second sub-agent wave: 15 providers' ALGORITHMIC formatters implemented in Rust under providers/algo/, dispatched from Faker::gen. ~140 formatters now work in pure Rust, e.g.: - credit_card_number (Luhn), ean8/13 + upc + jan (GS1 checksums), vin - iban (ISO 7064 mod-97), bban, aba, swift; barcode checksums - uuid4/1/7, md5/sha hex, password, ipv4/ipv6/mac, url, email, dga - hex/rgb/hsl colors (RandomColor HSV), catch_phrase/bs joins - credit_card_expire + date_time via civil-from-days (no date crate) - pyint/pybool/pyfloat, file names/paths, isbn/sbn, msisdn Each provider is a self-contained algo/<provider>.rs with a `dispatch` fn; gen() falls through data-driven -> algorithmic. rust-ci now lints+tests the `locales` feature too. (currency stub pending; a few binary/collection formatters intentionally skipped.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- currency.rs: currency/currency_code/currency_name, cryptocurrency_*, pricetag (currency + crypto tables hardcoded from the Python base provider). - tests/algo.rs: independently verify the ported checksums — credit_card_number passes Luhn, ean13 passes GS1 mod-10, iban passes ISO 7064 mod-97, plus currency/uuid shape checks. All green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13 +/- ##
==========================================
- Coverage 96.43% 96.40% -0.03%
==========================================
Files 838 838
Lines 12608 12608
==========================================
- Hits 12158 12155 -3
- Misses 450 453 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the
faker2PyPI package a pure-Rust engine with a thin Python binder (PyO3), and ports the bulk of faker to Rust via two sub-agent waves.What landed
faker2package (native/):import faker2loads the compiled Rust core (faker2._native). Self-contained wheels (dataset bundled), sdist, trusted publishing.rust/src/locale.rs, featurelocales): data-driven formatters via a declarative recipe map (extracted by 26 agents) + per-locale dataset.Faker.gen(locale, formatter).rust/src/providers/algo/, 15 providers via 16 agents): Luhn cards, EAN/UPC/JAN + VIN checksums, IBAN mod-97/BBAN/ABA/SWIFT, uuid/md5/sha/password, ipv4/6/mac/url/email/dga, hex/rgb/hsl colors, catch_phrase/bs, date_time (civil-from-days), pyint/pyfloat, currency, files, isbn/sbn, msisdn.Verified
tests/algo.rs).-D warnings+ tests now cover default / real-names / locales.Scope / remaining
ssn/passportper-locale checksums partial.🤖 Generated with Claude Code