No project description provided
Project description
Synthwave: A Stream of Synthetic Events
The goal here is to provide a stream of synthetic data similar to events you would see in a normal business. This can be used to generate data for testing, development, and for learning.
The user defines the events they want emitted and this will write them to stdout, a file, or POST as JSON data to a URL (not tested yet).
Name and email data generated by GPT-3.
Installation
You should use an environment manager like Poetry or venv.
With Poetry:
poetry add synthwave
Otherwise:
pip install synthwave
Usage
Define the events you want generated in a Python file. See example.py
for an example:
class AccountCreated(Event):
user_id = field.UUID(repeat_prob=0.5)
first_name = field.GivenName()
last_name = field.FamilyName()
age = field.Integer(13, 95)
email_address = field.EmailAddress()
location = field.Location()
class PageView(Event):
user_id = field.UUID(repeat_prob=0.5)
page_url = field.URL()
referring_url = field.URL("google.com")
Then start the generation, in your terminal:
python -m synthwave -e example.py --interval 0.1
Here, -e
points to the file with your event definitions and --interval
sets the time between synthetic events. You can also write the events to a file with the -o
flag:
python -m synthwave -e example.py --interval 0.1 -o outfile.txt
The above definition will emit events that look like:
{
'event': 'account_created',
'event_id': '24a4f6ae-06dc-4df9-b67d-faac490ce890',
'timestamp': '2023-05-25T15:22:55.419+00:00',
'user_id': 'b18a2f0e-7257-41c0-8f1c-9c63c275b342',
'properties': {
'first_name': 'Parron',
'last_name': 'Akori',
'age': 95,
'email_address': 'cleon@anache.net',
'location': None
}
{
'event': 'page_view',
'event_id': '8ad8e917-b9ff-4bca-83d1-d1a98cf97db3',
'timestamp': '2023-05-24T04:34:11.871+00:00',
'user_id': '7663a2a9-154b-4cc9-8a1b-44fcc806046f',
'properties': {
'page_url': 'https://wow.app/perpetual/arbitrary/egregious',
'referring_url': 'https://google.com/sequentially/achingly/egregious'
}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for synthwave-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff750a0f1a40a4746e97f3882dd27563614652041f89d60f420fe0cd22b2c571 |
|
MD5 | 12da1ca010a02fb47fe96d6cced9ed4c |
|
BLAKE2b-256 | 35b8ecd3e736f5948e7f530b14fa1ed8f163933b98166a4cc2e8c2ed4c499bab |