dataforger 0.1.1__tar.gz → 0.1.2__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.
- {dataforger-0.1.1/src/dataforger.egg-info → dataforger-0.1.2}/PKG-INFO +64 -8
- dataforger-0.1.2/README.md +113 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/pyproject.toml +17 -1
- {dataforger-0.1.1 → dataforger-0.1.2/src/dataforger.egg-info}/PKG-INFO +64 -8
- dataforger-0.1.1/README.md +0 -69
- {dataforger-0.1.1 → dataforger-0.1.2}/LICENSE +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/setup.cfg +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger/__init__.py +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger/cli.py +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger/core.py +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger/countries.json +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger/data.json +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger.egg-info/SOURCES.txt +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger.egg-info/dependency_links.txt +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger.egg-info/entry_points.txt +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/src/dataforger.egg-info/top_level.txt +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/tests/test_cli.py +0 -0
- {dataforger-0.1.1 → dataforger-0.1.2}/tests/test_core.py +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataforger
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Generate fake data from Python or the command line.
|
|
5
|
+
Author-email: Karmanshi Shrivastava <karmanshishrivastava20@gmail.com>
|
|
5
6
|
License: MIT License
|
|
6
7
|
|
|
7
8
|
Copyright (c) 2026 Karmanshi Shrivastava
|
|
@@ -24,12 +25,23 @@ License: MIT License
|
|
|
24
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
26
|
SOFTWARE.
|
|
26
27
|
|
|
28
|
+
Project-URL: Homepage, https://github.com/karmanshi/dataforger
|
|
29
|
+
Project-URL: Repository, https://github.com/karmanshi/dataforger
|
|
30
|
+
Project-URL: Issues, https://github.com/karmanshi/dataforger/issues
|
|
31
|
+
Keywords: fake-data,data-generation,csv,json,testing,cli
|
|
27
32
|
Classifier: Development Status :: 3 - Alpha
|
|
28
33
|
Classifier: Environment :: Console
|
|
29
34
|
Classifier: Intended Audience :: Developers
|
|
30
35
|
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
31
37
|
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
32
42
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
43
|
+
Classifier: Topic :: Software Development :: Testing
|
|
44
|
+
Classifier: Topic :: Utilities
|
|
33
45
|
Requires-Python: >=3.10
|
|
34
46
|
Description-Content-Type: text/markdown
|
|
35
47
|
License-File: LICENSE
|
|
@@ -80,12 +92,45 @@ all options directly:
|
|
|
80
92
|
dataforger --rows 100 --field name:name --field email:email --field age:age --format csv --output users.csv --seed 42
|
|
81
93
|
```
|
|
82
94
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
rows
|
|
95
|
+
### CLI options
|
|
96
|
+
|
|
97
|
+
| Option | Description | Default |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| `--field NAME:TYPE` | Output column name and the type of value to generate. Repeat to add fields. | Prompts for fields if omitted |
|
|
100
|
+
| `--rows COUNT` | Number of records. Must be a positive integer. | `10` |
|
|
101
|
+
| `--format {csv,json}` | Output file format. | `json` |
|
|
102
|
+
| `--output PATH` | Path to the output file. | `data.json` or `data.csv`, based on format |
|
|
103
|
+
| `--seed INTEGER` | Seed for repeatable output. | Random |
|
|
104
|
+
|
|
105
|
+
`NAME` is the column/key to write in the output; choose any non-empty name.
|
|
106
|
+
`TYPE` must be one of the supported field types below. For example,
|
|
107
|
+
`--field first_name:first_name` creates a column named `first_name` using
|
|
108
|
+
generated first names, while `--field given:first_name` creates the same kind
|
|
109
|
+
of values under the column name `given`.
|
|
110
|
+
|
|
111
|
+
### Supported field types
|
|
112
|
+
|
|
113
|
+
| Type | Generated value |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `name` | Full name |
|
|
116
|
+
| `first_name` | First name |
|
|
117
|
+
| `last_name` | Last name |
|
|
118
|
+
| `email` | Email address using a reserved example domain |
|
|
119
|
+
| `phone` | Phone-like number |
|
|
120
|
+
| `address` | Street address including a generated city |
|
|
121
|
+
| `city` | City from the bundled country-to-city data |
|
|
122
|
+
| `country` | Country from the bundled country-to-city data |
|
|
123
|
+
| `company` | Company name |
|
|
124
|
+
| `uuid` | UUID |
|
|
125
|
+
| `date` | Date between 1970-01-01 and today |
|
|
126
|
+
| `age` | Integer from 0 to 100 |
|
|
127
|
+
| `integer` | Integer from 0 to 100,000 |
|
|
128
|
+
| `float` | Decimal value from 0 to 100,000 |
|
|
129
|
+
| `boolean` | `true` or `false` |
|
|
130
|
+
|
|
131
|
+
When a record requests both `country` and `city`, the city is selected from
|
|
132
|
+
that country's city list. If it also requests `address`, its city matches
|
|
133
|
+
those fields.
|
|
89
134
|
|
|
90
135
|
## Python API
|
|
91
136
|
|
|
@@ -93,7 +138,14 @@ rows, JSON format, and `data.json`.
|
|
|
93
138
|
from dataforger import generate_data, write_data
|
|
94
139
|
|
|
95
140
|
records = generate_data(
|
|
96
|
-
{
|
|
141
|
+
{
|
|
142
|
+
"first_name": "first_name",
|
|
143
|
+
"last_name": "last_name",
|
|
144
|
+
"country": "country",
|
|
145
|
+
"city": "city",
|
|
146
|
+
"email": "email",
|
|
147
|
+
"age": "age",
|
|
148
|
+
},
|
|
97
149
|
rows=100,
|
|
98
150
|
seed=42,
|
|
99
151
|
)
|
|
@@ -104,3 +156,7 @@ write_data(records, "users.csv", "csv")
|
|
|
104
156
|
|
|
105
157
|
`generate_data` returns a list of dictionaries. Pass the resulting records,
|
|
106
158
|
an output path, and either `"csv"` or `"json"` to `write_data`.
|
|
159
|
+
Its parameters are `fields` (a mapping of output column names to supported
|
|
160
|
+
types), `rows` (positive record count), and optional `seed` (integer for
|
|
161
|
+
repeatable values). `write_data` takes `records`, `output` (path), and
|
|
162
|
+
`format` (`"csv"` or `"json"`).
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# dataforger
|
|
2
|
+
|
|
3
|
+
Generate realistic fake data from Python or the command line, and save it as
|
|
4
|
+
CSV or JSON. Dataforger uses only the Python standard library and has no
|
|
5
|
+
third-party runtime dependencies.
|
|
6
|
+
|
|
7
|
+
Built-in names, streets, companies, and email domains are stored in
|
|
8
|
+
`src/dataforger/data.json`. Country names and their associated cities are
|
|
9
|
+
stored in `src/dataforger/countries.json`; when generating a record with both
|
|
10
|
+
country and city fields, the city is selected from that country's list.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Requires Python 3.10 or later.
|
|
15
|
+
|
|
16
|
+
From a checkout of this repository:
|
|
17
|
+
|
|
18
|
+
```console
|
|
19
|
+
python -m pip install .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
After publishing the package to PyPI:
|
|
23
|
+
|
|
24
|
+
```console
|
|
25
|
+
python -m pip install dataforger
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Publishing to PyPI
|
|
29
|
+
|
|
30
|
+
The GitHub Actions workflow runs the tests on Python 3.10 through 3.13 and
|
|
31
|
+
builds wheel and source distributions on pushes and pull requests. To publish,
|
|
32
|
+
configure a PyPI trusted publisher for this GitHub repository, using workflow
|
|
33
|
+
`.github/workflows/publish.yml` and the GitHub environment `pypi`. Then create
|
|
34
|
+
and publish a GitHub Release; the workflow publishes its tested distributions
|
|
35
|
+
to PyPI using trusted publishing.
|
|
36
|
+
|
|
37
|
+
## Command line
|
|
38
|
+
|
|
39
|
+
Run `dataforger` without field options for an interactive prompt. Or specify
|
|
40
|
+
all options directly:
|
|
41
|
+
|
|
42
|
+
```console
|
|
43
|
+
dataforger --rows 100 --field name:name --field email:email --field age:age --format csv --output users.csv --seed 42
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### CLI options
|
|
47
|
+
|
|
48
|
+
| Option | Description | Default |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `--field NAME:TYPE` | Output column name and the type of value to generate. Repeat to add fields. | Prompts for fields if omitted |
|
|
51
|
+
| `--rows COUNT` | Number of records. Must be a positive integer. | `10` |
|
|
52
|
+
| `--format {csv,json}` | Output file format. | `json` |
|
|
53
|
+
| `--output PATH` | Path to the output file. | `data.json` or `data.csv`, based on format |
|
|
54
|
+
| `--seed INTEGER` | Seed for repeatable output. | Random |
|
|
55
|
+
|
|
56
|
+
`NAME` is the column/key to write in the output; choose any non-empty name.
|
|
57
|
+
`TYPE` must be one of the supported field types below. For example,
|
|
58
|
+
`--field first_name:first_name` creates a column named `first_name` using
|
|
59
|
+
generated first names, while `--field given:first_name` creates the same kind
|
|
60
|
+
of values under the column name `given`.
|
|
61
|
+
|
|
62
|
+
### Supported field types
|
|
63
|
+
|
|
64
|
+
| Type | Generated value |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `name` | Full name |
|
|
67
|
+
| `first_name` | First name |
|
|
68
|
+
| `last_name` | Last name |
|
|
69
|
+
| `email` | Email address using a reserved example domain |
|
|
70
|
+
| `phone` | Phone-like number |
|
|
71
|
+
| `address` | Street address including a generated city |
|
|
72
|
+
| `city` | City from the bundled country-to-city data |
|
|
73
|
+
| `country` | Country from the bundled country-to-city data |
|
|
74
|
+
| `company` | Company name |
|
|
75
|
+
| `uuid` | UUID |
|
|
76
|
+
| `date` | Date between 1970-01-01 and today |
|
|
77
|
+
| `age` | Integer from 0 to 100 |
|
|
78
|
+
| `integer` | Integer from 0 to 100,000 |
|
|
79
|
+
| `float` | Decimal value from 0 to 100,000 |
|
|
80
|
+
| `boolean` | `true` or `false` |
|
|
81
|
+
|
|
82
|
+
When a record requests both `country` and `city`, the city is selected from
|
|
83
|
+
that country's city list. If it also requests `address`, its city matches
|
|
84
|
+
those fields.
|
|
85
|
+
|
|
86
|
+
## Python API
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from dataforger import generate_data, write_data
|
|
90
|
+
|
|
91
|
+
records = generate_data(
|
|
92
|
+
{
|
|
93
|
+
"first_name": "first_name",
|
|
94
|
+
"last_name": "last_name",
|
|
95
|
+
"country": "country",
|
|
96
|
+
"city": "city",
|
|
97
|
+
"email": "email",
|
|
98
|
+
"age": "age",
|
|
99
|
+
},
|
|
100
|
+
rows=100,
|
|
101
|
+
seed=42,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
write_data(records, "users.json", "json")
|
|
105
|
+
write_data(records, "users.csv", "csv")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`generate_data` returns a list of dictionaries. Pass the resulting records,
|
|
109
|
+
an output path, and either `"csv"` or `"json"` to `write_data`.
|
|
110
|
+
Its parameters are `fields` (a mapping of output column names to supported
|
|
111
|
+
types), `rows` (positive record count), and optional `seed` (integer for
|
|
112
|
+
repeatable values). `write_data` takes `records`, `output` (path), and
|
|
113
|
+
`format` (`"csv"` or `"json"`).
|
|
@@ -4,23 +4,39 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dataforger"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "Generate fake data from Python or the command line."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
11
11
|
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Karmanshi Shrivastava", email = "karmanshishrivastava20@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["fake-data", "data-generation", "csv", "json", "testing", "cli"]
|
|
12
16
|
classifiers = [
|
|
13
17
|
"Development Status :: 3 - Alpha",
|
|
14
18
|
"Environment :: Console",
|
|
15
19
|
"Intended Audience :: Developers",
|
|
16
20
|
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
17
22
|
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
18
27
|
"Programming Language :: Python :: 3 :: Only",
|
|
28
|
+
"Topic :: Software Development :: Testing",
|
|
29
|
+
"Topic :: Utilities",
|
|
19
30
|
]
|
|
20
31
|
|
|
21
32
|
[project.scripts]
|
|
22
33
|
dataforger = "dataforger.cli:main"
|
|
23
34
|
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/karmanshi/dataforger"
|
|
37
|
+
Repository = "https://github.com/karmanshi/dataforger"
|
|
38
|
+
Issues = "https://github.com/karmanshi/dataforger/issues"
|
|
39
|
+
|
|
24
40
|
[tool.setuptools.packages.find]
|
|
25
41
|
where = ["src"]
|
|
26
42
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataforger
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Generate fake data from Python or the command line.
|
|
5
|
+
Author-email: Karmanshi Shrivastava <karmanshishrivastava20@gmail.com>
|
|
5
6
|
License: MIT License
|
|
6
7
|
|
|
7
8
|
Copyright (c) 2026 Karmanshi Shrivastava
|
|
@@ -24,12 +25,23 @@ License: MIT License
|
|
|
24
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
26
|
SOFTWARE.
|
|
26
27
|
|
|
28
|
+
Project-URL: Homepage, https://github.com/karmanshi/dataforger
|
|
29
|
+
Project-URL: Repository, https://github.com/karmanshi/dataforger
|
|
30
|
+
Project-URL: Issues, https://github.com/karmanshi/dataforger/issues
|
|
31
|
+
Keywords: fake-data,data-generation,csv,json,testing,cli
|
|
27
32
|
Classifier: Development Status :: 3 - Alpha
|
|
28
33
|
Classifier: Environment :: Console
|
|
29
34
|
Classifier: Intended Audience :: Developers
|
|
30
35
|
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
31
37
|
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
32
42
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
43
|
+
Classifier: Topic :: Software Development :: Testing
|
|
44
|
+
Classifier: Topic :: Utilities
|
|
33
45
|
Requires-Python: >=3.10
|
|
34
46
|
Description-Content-Type: text/markdown
|
|
35
47
|
License-File: LICENSE
|
|
@@ -80,12 +92,45 @@ all options directly:
|
|
|
80
92
|
dataforger --rows 100 --field name:name --field email:email --field age:age --format csv --output users.csv --seed 42
|
|
81
93
|
```
|
|
82
94
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
rows
|
|
95
|
+
### CLI options
|
|
96
|
+
|
|
97
|
+
| Option | Description | Default |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| `--field NAME:TYPE` | Output column name and the type of value to generate. Repeat to add fields. | Prompts for fields if omitted |
|
|
100
|
+
| `--rows COUNT` | Number of records. Must be a positive integer. | `10` |
|
|
101
|
+
| `--format {csv,json}` | Output file format. | `json` |
|
|
102
|
+
| `--output PATH` | Path to the output file. | `data.json` or `data.csv`, based on format |
|
|
103
|
+
| `--seed INTEGER` | Seed for repeatable output. | Random |
|
|
104
|
+
|
|
105
|
+
`NAME` is the column/key to write in the output; choose any non-empty name.
|
|
106
|
+
`TYPE` must be one of the supported field types below. For example,
|
|
107
|
+
`--field first_name:first_name` creates a column named `first_name` using
|
|
108
|
+
generated first names, while `--field given:first_name` creates the same kind
|
|
109
|
+
of values under the column name `given`.
|
|
110
|
+
|
|
111
|
+
### Supported field types
|
|
112
|
+
|
|
113
|
+
| Type | Generated value |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `name` | Full name |
|
|
116
|
+
| `first_name` | First name |
|
|
117
|
+
| `last_name` | Last name |
|
|
118
|
+
| `email` | Email address using a reserved example domain |
|
|
119
|
+
| `phone` | Phone-like number |
|
|
120
|
+
| `address` | Street address including a generated city |
|
|
121
|
+
| `city` | City from the bundled country-to-city data |
|
|
122
|
+
| `country` | Country from the bundled country-to-city data |
|
|
123
|
+
| `company` | Company name |
|
|
124
|
+
| `uuid` | UUID |
|
|
125
|
+
| `date` | Date between 1970-01-01 and today |
|
|
126
|
+
| `age` | Integer from 0 to 100 |
|
|
127
|
+
| `integer` | Integer from 0 to 100,000 |
|
|
128
|
+
| `float` | Decimal value from 0 to 100,000 |
|
|
129
|
+
| `boolean` | `true` or `false` |
|
|
130
|
+
|
|
131
|
+
When a record requests both `country` and `city`, the city is selected from
|
|
132
|
+
that country's city list. If it also requests `address`, its city matches
|
|
133
|
+
those fields.
|
|
89
134
|
|
|
90
135
|
## Python API
|
|
91
136
|
|
|
@@ -93,7 +138,14 @@ rows, JSON format, and `data.json`.
|
|
|
93
138
|
from dataforger import generate_data, write_data
|
|
94
139
|
|
|
95
140
|
records = generate_data(
|
|
96
|
-
{
|
|
141
|
+
{
|
|
142
|
+
"first_name": "first_name",
|
|
143
|
+
"last_name": "last_name",
|
|
144
|
+
"country": "country",
|
|
145
|
+
"city": "city",
|
|
146
|
+
"email": "email",
|
|
147
|
+
"age": "age",
|
|
148
|
+
},
|
|
97
149
|
rows=100,
|
|
98
150
|
seed=42,
|
|
99
151
|
)
|
|
@@ -104,3 +156,7 @@ write_data(records, "users.csv", "csv")
|
|
|
104
156
|
|
|
105
157
|
`generate_data` returns a list of dictionaries. Pass the resulting records,
|
|
106
158
|
an output path, and either `"csv"` or `"json"` to `write_data`.
|
|
159
|
+
Its parameters are `fields` (a mapping of output column names to supported
|
|
160
|
+
types), `rows` (positive record count), and optional `seed` (integer for
|
|
161
|
+
repeatable values). `write_data` takes `records`, `output` (path), and
|
|
162
|
+
`format` (`"csv"` or `"json"`).
|
dataforger-0.1.1/README.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# dataforger
|
|
2
|
-
|
|
3
|
-
Generate realistic fake data from Python or the command line, and save it as
|
|
4
|
-
CSV or JSON. Dataforger uses only the Python standard library and has no
|
|
5
|
-
third-party runtime dependencies.
|
|
6
|
-
|
|
7
|
-
Built-in names, streets, companies, and email domains are stored in
|
|
8
|
-
`src/dataforger/data.json`. Country names and their associated cities are
|
|
9
|
-
stored in `src/dataforger/countries.json`; when generating a record with both
|
|
10
|
-
country and city fields, the city is selected from that country's list.
|
|
11
|
-
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
Requires Python 3.10 or later.
|
|
15
|
-
|
|
16
|
-
From a checkout of this repository:
|
|
17
|
-
|
|
18
|
-
```console
|
|
19
|
-
python -m pip install .
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
After publishing the package to PyPI:
|
|
23
|
-
|
|
24
|
-
```console
|
|
25
|
-
python -m pip install dataforger
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Publishing to PyPI
|
|
29
|
-
|
|
30
|
-
The GitHub Actions workflow runs the tests on Python 3.10 through 3.13 and
|
|
31
|
-
builds wheel and source distributions on pushes and pull requests. To publish,
|
|
32
|
-
configure a PyPI trusted publisher for this GitHub repository, using workflow
|
|
33
|
-
`.github/workflows/publish.yml` and the GitHub environment `pypi`. Then create
|
|
34
|
-
and publish a GitHub Release; the workflow publishes its tested distributions
|
|
35
|
-
to PyPI using trusted publishing.
|
|
36
|
-
|
|
37
|
-
## Command line
|
|
38
|
-
|
|
39
|
-
Run `dataforger` without field options for an interactive prompt. Or specify
|
|
40
|
-
all options directly:
|
|
41
|
-
|
|
42
|
-
```console
|
|
43
|
-
dataforger --rows 100 --field name:name --field email:email --field age:age --format csv --output users.csv --seed 42
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
The `--field` option can be repeated. Supported field types are `name`,
|
|
47
|
-
`first_name`, `last_name`, `email`, `phone`, `address`, `city`, `country`,
|
|
48
|
-
`company`, `uuid`, `date`, `age`, `integer`, `float`, and `boolean`. If
|
|
49
|
-
`--field` is omitted, the command prompts for the row count, format, output
|
|
50
|
-
path, and fields. When using command-line field options, the defaults are 10
|
|
51
|
-
rows, JSON format, and `data.json`.
|
|
52
|
-
|
|
53
|
-
## Python API
|
|
54
|
-
|
|
55
|
-
```python
|
|
56
|
-
from dataforger import generate_data, write_data
|
|
57
|
-
|
|
58
|
-
records = generate_data(
|
|
59
|
-
{"name": "name", "email": "email", "age": "age"},
|
|
60
|
-
rows=100,
|
|
61
|
-
seed=42,
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
write_data(records, "users.json", "json")
|
|
65
|
-
write_data(records, "users.csv", "csv")
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
`generate_data` returns a list of dictionaries. Pass the resulting records,
|
|
69
|
-
an output path, and either `"csv"` or `"json"` to `write_data`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|