Skip to main content

Python library and CLI tool for converting data to different Python data classes

Project description

data2model

kdpv

Tests

Python library and CLI tool (in the nearest future) for generating different Python data classes from data.

Supported data formats:

  • CSV

Supported data classes:

Requirements

  • Python 3.8+

Installation

pip install data2model

Usage

import asyncio
import pathlib

from data_to_model import ModelGenerator


files = [
    {"input": pathlib.Path("example.csv"), "output": pathlib.Path("example.py")},
]


async def model_generator(input_file: pathlib.Path, output_file: pathlib.Path):
    mg = ModelGenerator(input_file)
    model = await mg.get_model()
    await model.save(output_file)


async def main():
    tasks = [model_generator(i["input"], i["output"]) for i in files]
    await asyncio.gather(*tasks)


if __name__ == "__main__":
    asyncio.run(main())

output

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

data2model-0.1.0b0.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

data2model-0.1.0b0-py3-none-any.whl (13.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page