Skip to content

Repository files navigation

DataMaker

License: MIT uv Ruff

The official Python library for the Automators DataMaker API.

Installation

You can install the package using pip:

pip install datamaker-py

Quick start

Basic example:

from datamaker import DataMaker, Template

# Create an instance of DataMaker
datamaker = DataMaker()


def main():
    # Define the template
    template = Template(
        name="basic template",
        quantity=2,
        fields=[
            {"name": "first_name", "type": "First Name"},
            {"name": "last_name", "type": "Last Name"},
            {
                "name": "email",
                "type": "Derived",
                "options": {"value": "{{first_name}}.{{last_name}}@automators.com"},
            },
        ],
    )

    # Generate data using the template
    result = datamaker.generate(template)
    print(result)


if __name__ == "__main__":
    main()

Autocomplete Types

This SDK automatically generates TypeScript autocomplete definitions for use in the datamaker application.

The artifact is generated automatically on every push to the main branch and can be fetched from:

https://raw.githubusercontent.com/automators/datamaker-py/main/artifacts/autocomplete-types.ts

See artifacts/README.md for more details.

Development & Contibutions

See the contributing.md guide for details on how to contribute to this project.

Types

Response types are generated from the API's OpenAPI document, not hand-written:

spec/openapi.json  ->  src/datamaker/generated/schema.py  ->  src/datamaker/types.py

Import from datamaker.types, which resolves each spec schema name to the class that really matches it:

from datamaker.types import Project, Plan, Template

projects: list[Project] = dm.get_projects()

They are TypedDicts, so nothing changes at runtime — methods still return the plain dicts response.json() produces, and project["name"] works exactly as before. The types are checker-only.

To regenerate after the API changes:

python scripts/generate_schema.py

CI runs python scripts/generate_schema.py --check and fails if the committed types drift from the spec.

Three schemas cannot currently be generated (SetDetail, PackInstallListItem, SchemaGraphNavigation): they are composed with allOf, which the generator merges away rather than emitting as a named class. Methods returning those keep Dict. The generator script lists them explicitly and fails if the set grows.

About

The official Python package for the DataMaker API

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages