Skip to content

Commit d2d9d78

Browse files
jqueguinerclaude
andcommitted
refactor!: rename the Python package faker -> faker2 (import faker2)
The distribution AND the import name are now faker2, so it can coexist with upstream Faker in the same environment: 'import faker2 as faker' works. All internal module paths, string references, sphinx regexes, MANIFEST, entry points and tests updated. CLI entry point is now 'faker2'. Adds .github/workflows/publish.yml (PyPI Trusted Publishing, environment 'pypi'). Full suite: 2742 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 01c0b2c commit d2d9d78

904 files changed

Lines changed: 774 additions & 697 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Publish faker2 to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
target:
9+
description: "Where to publish"
10+
required: true
11+
default: testpypi
12+
type: choice
13+
options: [testpypi, pypi]
14+
15+
jobs:
16+
build:
17+
name: Build distributions
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
- name: Install build tooling
25+
run: python -m pip install --upgrade pip build twine
26+
- name: Run the test suite
27+
run: |
28+
python -m pip install -e .
29+
python -m pip install pytest pytest-mock validators freezegun
30+
python -m pytest tests -q
31+
- name: Build sdist + wheel
32+
run: python -m build
33+
- name: Check metadata
34+
run: python -m twine check dist/*
35+
- uses: actions/upload-artifact@v4
36+
with:
37+
name: dist
38+
path: dist/
39+
40+
publish:
41+
name: Publish to PyPI
42+
needs: build
43+
runs-on: ubuntu-latest
44+
# Trusted Publishing: no API token needed, PyPI verifies this workflow +
45+
# environment via OIDC. Configure the publisher on PyPI with:
46+
# owner: jqueguiner / repo: faker2 / workflow: publish.yml / environment: pypi
47+
environment:
48+
name: pypi
49+
url: https://pypi.org/p/faker2
50+
permissions:
51+
id-token: write
52+
if: github.event_name == 'release' || inputs.target == 'pypi'
53+
steps:
54+
- uses: actions/download-artifact@v4
55+
with:
56+
name: dist
57+
path: dist/
58+
- uses: pypa/gh-action-pypi-publish@release/v1
59+
60+
publish-testpypi:
61+
name: Publish to TestPyPI
62+
needs: build
63+
runs-on: ubuntu-latest
64+
environment:
65+
name: testpypi
66+
url: https://test.pypi.org/p/faker2
67+
permissions:
68+
id-token: write
69+
if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
70+
steps:
71+
- uses: actions/download-artifact@v4
72+
with:
73+
name: dist
74+
path: dist/
75+
- uses: pypa/gh-action-pypi-publish@release/v1
76+
with:
77+
repository-url: https://test.pypi.org/legacy/

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ include VERSION
77
include CITATION.cff
88
include mypy.ini
99
include tox.ini
10-
include faker/proxy.pyi
10+
include faker2/proxy.pyi
1111
recursive-include tests *.json
1212
recursive-include tests *.py
13-
recursive-exclude faker/sphinx *.py
13+
recursive-exclude faker2/sphinx *.py
1414
recursive-exclude tests/sphinx *.py
1515

1616
global-exclude *.py[cod] __pycache__ *.so

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
extensions = [
2828
"sphinx.ext.todo",
2929
"sphinx.ext.intersphinx",
30-
"faker.sphinx.autodoc",
30+
"faker2.sphinx.autodoc",
3131
]
3232

3333
# Add any paths that contain templates here, relative to this directory.
@@ -222,7 +222,7 @@
222222

223223
# One entry per manual page. List of tuples
224224
# (source start file, name, description, authors, manual section).
225-
man_pages = [("index", "faker", "Faker Documentation", ["Daniele Faraglia"], 1)]
225+
man_pages = [("index", "faker2", "Faker Documentation", ["Daniele Faraglia"], 1)]
226226

227227
# If true, show URL addresses after external links.
228228
# man_show_urls = False

faker/__init__.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

faker2/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from faker2.factory import Factory
2+
from faker2.generator import Generator
3+
from faker2.proxy import Faker
4+
5+
VERSION = "40.28.1"
6+
7+
__all__ = ("Factory", "Generator", "Faker")
File renamed without changes.

faker/cli.py renamed to faker2/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def print_doc(
8888
fake = Faker(locale=lang, includes=includes)
8989
fake.seed_instance(seed)
9090

91-
from faker.providers import BaseProvider
91+
from faker2.providers import BaseProvider
9292

9393
base_provider_formatters = list(dir(BaseProvider))
9494

faker/config.py renamed to faker2/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
DEFAULT_LOCALE = "en_US"
66

77
META_PROVIDERS_MODULES = [
8-
"faker.providers",
8+
"faker2.providers",
99
]
1010

1111
PROVIDERS = find_available_providers([import_module(path) for path in META_PROVIDERS_MODULES])

0 commit comments

Comments
 (0)