faker-rs 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ name: Bug Report
2
+ description: Report a bug or drop-in compatibility issue with faker-rs
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: textarea
7
+ id: description
8
+ attributes:
9
+ label: Description
10
+ description: A clear and concise description of what happened vs what you expected.
11
+ validations:
12
+ required: true
13
+ - type: textarea
14
+ id: repro
15
+ attributes:
16
+ label: Minimal Reproduction
17
+ description: Python snippet reproducing the issue.
18
+ render: python
19
+ validations:
20
+ required: true
21
+ - type: input
22
+ id: environment
23
+ attributes:
24
+ label: Environment
25
+ description: "e.g., Python 3.12, Windows 11 / Ubuntu 24.04, faker-rs 0.2.0"
26
+ validations:
27
+ required: true
@@ -0,0 +1,25 @@
1
+ name: Provider / Feature Request
2
+ description: Request a new Faker provider or feature
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: input
7
+ id: provider
8
+ attributes:
9
+ label: Faker Provider / Method Name
10
+ description: "e.g., fake.credit_card_number(), fake.slug()"
11
+ validations:
12
+ required: true
13
+ - type: textarea
14
+ id: details
15
+ attributes:
16
+ label: Expected Behavior & Drop-in Signature
17
+ description: Describe the expected return type, format, and optional parameters.
18
+ validations:
19
+ required: true
20
+ - type: checkboxes
21
+ id: batch
22
+ attributes:
23
+ label: Batch Support
24
+ options:
25
+ - label: I would also use a batch version (e.g., `method_names(n)`)
@@ -0,0 +1,12 @@
1
+ ## Summary
2
+
3
+ Describe the problem this PR solves or the provider/feature it adds.
4
+
5
+ ## Checklist
6
+
7
+ - [ ] `cargo test --locked` passes
8
+ - [ ] `cargo clippy --all-targets -- -D warnings` passes
9
+ - [ ] `pytest -v` passes
10
+ - [ ] `ruff check .` passes
11
+ - [ ] Added Rust unit tests and Python integration tests (including deterministic seeding)
12
+ - [ ] Updated `python/faker_rs/__init__.pyi` type stubs if public API changed
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "cargo"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
11
+ - package-ecosystem: "pip"
12
+ directory: "/"
13
+ schedule:
14
+ interval: "weekly"
@@ -0,0 +1,68 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ rust:
14
+ name: Rust (test & clippy)
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.11"
22
+
23
+ - uses: dtolnay/rust-toolchain@stable
24
+ with:
25
+ components: clippy
26
+
27
+ - uses: Swatinem/rust-cache@v2
28
+
29
+ - name: Run cargo test
30
+ run: cargo test
31
+
32
+ - name: Run cargo clippy
33
+ run: cargo clippy --all-targets -- -D warnings
34
+
35
+ python:
36
+ name: Python (pytest & ruff)
37
+ runs-on: ${{ matrix.os }}
38
+ strategy:
39
+ fail-fast: false
40
+ matrix:
41
+ os: [ubuntu-latest, macos-latest, windows-latest]
42
+ python-version: ["3.9", "3.11", "3.13"]
43
+ exclude:
44
+ - os: ubuntu-latest
45
+ python-version: "3.9"
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+
49
+ - uses: actions/setup-python@v5
50
+ with:
51
+ python-version: ${{ matrix.python-version }}
52
+
53
+ - uses: dtolnay/rust-toolchain@stable
54
+
55
+ - uses: Swatinem/rust-cache@v2
56
+
57
+ - name: Install dependencies and build extension
58
+ run: |
59
+ python -m pip install --upgrade pip
60
+ pip install maturin pytest ruff
61
+ maturin build --release --out dist
62
+ pip install --force-reinstall --no-deps --no-index --find-links dist faker-rs
63
+
64
+ - name: Run pytest
65
+ run: pytest -v
66
+
67
+ - name: Run ruff
68
+ run: ruff check .
@@ -0,0 +1,91 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ linux:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ target: [x86_64, aarch64]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: PyO3/maturin-action@v1
20
+ with:
21
+ target: ${{ matrix.target }}
22
+ args: --release --out dist
23
+ manylinux: auto
24
+ - uses: actions/upload-artifact@v4
25
+ with:
26
+ name: wheels-linux-${{ matrix.target }}
27
+ path: dist
28
+
29
+ macos:
30
+ runs-on: macos-latest
31
+ strategy:
32
+ matrix:
33
+ target: [x86_64, aarch64]
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: PyO3/maturin-action@v1
37
+ with:
38
+ target: ${{ matrix.target }}
39
+ args: --release --out dist
40
+ - uses: actions/upload-artifact@v4
41
+ with:
42
+ name: wheels-macos-${{ matrix.target }}
43
+ path: dist
44
+
45
+ windows:
46
+ runs-on: windows-latest
47
+ strategy:
48
+ matrix:
49
+ target: [x64]
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ - uses: PyO3/maturin-action@v1
53
+ with:
54
+ target: ${{ matrix.target }}
55
+ args: --release --out dist
56
+ - uses: actions/upload-artifact@v4
57
+ with:
58
+ name: wheels-windows-${{ matrix.target }}
59
+ path: dist
60
+
61
+ sdist:
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - uses: actions/checkout@v4
65
+ - uses: PyO3/maturin-action@v1
66
+ with:
67
+ command: sdist
68
+ args: --out dist
69
+ - uses: actions/upload-artifact@v4
70
+ with:
71
+ name: wheels-sdist
72
+ path: dist
73
+
74
+ publish:
75
+ name: Publish to PyPI
76
+ needs: [linux, macos, windows, sdist]
77
+ runs-on: ubuntu-latest
78
+ environment:
79
+ name: pypi
80
+ url: https://pypi.org/p/faker-rs
81
+ permissions:
82
+ id-token: write
83
+ steps:
84
+ - uses: actions/download-artifact@v4
85
+ with:
86
+ pattern: wheels-*
87
+ merge-multiple: true
88
+ path: dist
89
+
90
+ - name: Publish distributions to PyPI
91
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,47 @@
1
+ # Rust
2
+ /target/
3
+ **/*.rs.bk
4
+ *.pdb
5
+ Cargo.lock
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+ *.so
12
+ *.pyd
13
+ *.dylib
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+
31
+ # Virtual environments
32
+ .venv/
33
+ venv/
34
+ ENV/
35
+ env/
36
+
37
+ # Testing & linting
38
+ .pytest_cache/
39
+ .ruff_cache/
40
+ .coverage
41
+ htmlcov/
42
+
43
+ # IDEs & OS
44
+ .vscode/
45
+ .idea/
46
+ .DS_Store
47
+ Thumbs.db
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2026-11-21
9
+
10
+ ### Added
11
+ - **Expanded core providers** with matching batch (`*s(n)`) methods:
12
+ - Person: `first_name()`, `last_name()`, `user_name()`
13
+ - Address: `city()`, `state()`, `postcode()`, `country()`
14
+ - Company & Contact: `company()`, `job()`, `phone_number()`
15
+ - Internet: `url()`, `ipv4()`
16
+ - Text & Primitives: `sentence()`, `text(max_nb_chars=200)`, `boolean(chance_of_getting_true=50)`, `random_int(min=0, max=9999)`
17
+ - Date & Time: `iso8601()`
18
+ - **`fake.unique` proxy**: Per-provider uniqueness tracking with `fake.unique.clear()` and `UniquenessException` (exported from `faker_rs` and `faker_rs.exceptions`).
19
+ - **Open-source governance & templates**: `CHANGELOG.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`, GitHub issue/PR templates, and `dependabot.yml`.
20
+
21
+ ## [0.1.0] - 2026-11-21
22
+
23
+ ### Added
24
+ - Initial Rust + PyO3 (`abi3-py39`) implementation of `Faker` with `name()`, `email()`, `address()`, `date()`, `uuid4()`, and batch equivalents (`names(n)`, `emails(n)`, `addresses(n)`, `dates(n)`, `uuid4s(n)`).
25
+ - Deterministic global (`Faker.seed(n)`) and instance (`Faker(seed=n)`, `seed_instance(n)`) seeding powered by `fastrand::Rng`.
26
+ - GitHub Actions CI (`cargo test`, `cargo clippy`, `pytest`, `ruff`) and Trusted Publishing release workflow (`PyO3/maturin-action`).
@@ -0,0 +1,41 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ - Demonstrating empathy and kindness toward other people
14
+ - Being respectful of differing opinions, viewpoints, and experiences
15
+ - Giving and gracefully accepting constructive feedback
16
+ - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ - Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ - Trolling, insulting or derogatory comments, and personal or political attacks
23
+ - Public or private harassment
24
+ - Publishing others' private information, such as a physical or electronic address, without their explicit permission
25
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers via GitHub Issues or security/contact channels. All complaints will be reviewed and investigated promptly and fairly.
38
+
39
+ ## Attribution
40
+
41
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
@@ -0,0 +1,59 @@
1
+ # Contributing to `faker-rs`
2
+
3
+ Thank you for your interest in contributing to `faker-rs`!
4
+
5
+ ## Prerequisites
6
+
7
+ - **Rust** (stable toolchain via [rustup](https://rustup.rs/))
8
+ - **Python** 3.9+
9
+ - **uv** or **pip** + **venv**
10
+
11
+ ## Local Development Setup
12
+
13
+ 1. Clone the repository and create a virtual environment:
14
+
15
+ ```bash
16
+ git clone https://github.com/harrisonclough99/faker-rs.git
17
+ cd faker-rs
18
+ python -m venv .venv
19
+ # Linux / macOS:
20
+ source .venv/bin/activate
21
+ # Windows (PowerShell):
22
+ .venv\Scripts\Activate.ps1
23
+ ```
24
+
25
+ 2. Install development dependencies and build the Rust extension in-place:
26
+
27
+ ```bash
28
+ pip install maturin pytest ruff faker
29
+ maturin develop --release
30
+ ```
31
+
32
+ > Use `maturin develop` (without `--release`) for faster incremental debug builds while iterating, and `maturin develop --release` before running benchmarks.
33
+
34
+ 3. Run the test suites and linters:
35
+
36
+ ```bash
37
+ cargo test
38
+ cargo clippy --all-targets -- -D warnings
39
+ pytest -v
40
+ ruff check .
41
+ ```
42
+
43
+ 4. Run the benchmark suite:
44
+
45
+ ```bash
46
+ python benchmarks/bench.py
47
+ ```
48
+
49
+ ## Pull Request Scope Guidelines
50
+
51
+ - **Keep PRs focused**: One feature, provider, or bugfix per PR. Unrelated refactors should be submitted separately.
52
+ - **Drop-in compatibility**: New providers should match Python `Faker` method names, return types, and default formatting, and include a corresponding batch method (e.g., `foo()` + `foos(n)`).
53
+ - **Tests required**: Every change must include Rust unit tests (`cargo test`) and Python integration tests (`pytest`), including deterministic seeding checks.
54
+ - **No performance regressions**: Avoid unnecessary heap allocations inside hot provider loops; prefer `String::with_capacity` / `write!` and batch `PyList::new` construction.
55
+ - **Clean checks**: Ensure `cargo clippy --all-targets -- -D warnings` and `ruff check .` pass with zero warnings before opening a PR.
56
+
57
+ ## License
58
+
59
+ By contributing, you agree that your contributions will be dual-licensed under the [MIT License](LICENSE-MIT) and [Apache License 2.0](LICENSE-APACHE).
@@ -0,0 +1,187 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "cfg-if"
13
+ version = "1.0.5"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
16
+
17
+ [[package]]
18
+ name = "faker-rs"
19
+ version = "0.2.0"
20
+ dependencies = [
21
+ "fastrand",
22
+ "pyo3",
23
+ ]
24
+
25
+ [[package]]
26
+ name = "fastrand"
27
+ version = "2.5.0"
28
+ source = "registry+https://github.com/rust-lang/crates.io-index"
29
+ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
30
+
31
+ [[package]]
32
+ name = "heck"
33
+ version = "0.5.0"
34
+ source = "registry+https://github.com/rust-lang/crates.io-index"
35
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
36
+
37
+ [[package]]
38
+ name = "indoc"
39
+ version = "2.0.8"
40
+ source = "registry+https://github.com/rust-lang/crates.io-index"
41
+ checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
42
+ dependencies = [
43
+ "rustversion",
44
+ ]
45
+
46
+ [[package]]
47
+ name = "libc"
48
+ version = "0.2.191"
49
+ source = "registry+https://github.com/rust-lang/crates.io-index"
50
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
51
+
52
+ [[package]]
53
+ name = "memoffset"
54
+ version = "0.9.1"
55
+ source = "registry+https://github.com/rust-lang/crates.io-index"
56
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
57
+ dependencies = [
58
+ "autocfg",
59
+ ]
60
+
61
+ [[package]]
62
+ name = "once_cell"
63
+ version = "1.21.4"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
66
+
67
+ [[package]]
68
+ name = "portable-atomic"
69
+ version = "1.15.0"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
72
+
73
+ [[package]]
74
+ name = "proc-macro2"
75
+ version = "1.0.107"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
78
+ dependencies = [
79
+ "unicode-ident",
80
+ ]
81
+
82
+ [[package]]
83
+ name = "pyo3"
84
+ version = "0.23.5"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
87
+ dependencies = [
88
+ "cfg-if",
89
+ "indoc",
90
+ "libc",
91
+ "memoffset",
92
+ "once_cell",
93
+ "portable-atomic",
94
+ "pyo3-build-config",
95
+ "pyo3-ffi",
96
+ "pyo3-macros",
97
+ "unindent",
98
+ ]
99
+
100
+ [[package]]
101
+ name = "pyo3-build-config"
102
+ version = "0.23.5"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
105
+ dependencies = [
106
+ "once_cell",
107
+ "target-lexicon",
108
+ ]
109
+
110
+ [[package]]
111
+ name = "pyo3-ffi"
112
+ version = "0.23.5"
113
+ source = "registry+https://github.com/rust-lang/crates.io-index"
114
+ checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
115
+ dependencies = [
116
+ "libc",
117
+ "pyo3-build-config",
118
+ ]
119
+
120
+ [[package]]
121
+ name = "pyo3-macros"
122
+ version = "0.23.5"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
125
+ dependencies = [
126
+ "proc-macro2",
127
+ "pyo3-macros-backend",
128
+ "quote",
129
+ "syn",
130
+ ]
131
+
132
+ [[package]]
133
+ name = "pyo3-macros-backend"
134
+ version = "0.23.5"
135
+ source = "registry+https://github.com/rust-lang/crates.io-index"
136
+ checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
137
+ dependencies = [
138
+ "heck",
139
+ "proc-macro2",
140
+ "pyo3-build-config",
141
+ "quote",
142
+ "syn",
143
+ ]
144
+
145
+ [[package]]
146
+ name = "quote"
147
+ version = "1.0.47"
148
+ source = "registry+https://github.com/rust-lang/crates.io-index"
149
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
150
+ dependencies = [
151
+ "proc-macro2",
152
+ ]
153
+
154
+ [[package]]
155
+ name = "rustversion"
156
+ version = "1.0.23"
157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
158
+ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
159
+
160
+ [[package]]
161
+ name = "syn"
162
+ version = "2.0.119"
163
+ source = "registry+https://github.com/rust-lang/crates.io-index"
164
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
165
+ dependencies = [
166
+ "proc-macro2",
167
+ "quote",
168
+ "unicode-ident",
169
+ ]
170
+
171
+ [[package]]
172
+ name = "target-lexicon"
173
+ version = "0.12.16"
174
+ source = "registry+https://github.com/rust-lang/crates.io-index"
175
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
176
+
177
+ [[package]]
178
+ name = "unicode-ident"
179
+ version = "1.0.27"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
182
+
183
+ [[package]]
184
+ name = "unindent"
185
+ version = "0.2.4"
186
+ source = "registry+https://github.com/rust-lang/crates.io-index"
187
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
@@ -0,0 +1,23 @@
1
+ [package]
2
+ name = "faker-rs"
3
+ version = "0.2.0"
4
+ edition = "2021"
5
+ description = "A high-performance, drop-in replacement for Python's Faker library, backed by Rust and PyO3."
6
+ license = "MIT OR Apache-2.0"
7
+ readme = "README.md"
8
+ repository = "https://github.com/harrisonclough99/faker-rs"
9
+ keywords = ["faker", "fake-data", "pyo3", "python", "testing"]
10
+ categories = ["development-tools::testing"]
11
+
12
+ [lib]
13
+ name = "_faker_rs"
14
+ crate-type = ["cdylib"]
15
+
16
+ [dependencies]
17
+ fastrand = "2.3"
18
+ pyo3 = { version = "0.23", features = ["abi3-py39"] }
19
+
20
+ [profile.release]
21
+ lto = "thin"
22
+ codegen-units = 1
23
+ opt-level = 3