Skip to main content

Add your description here

Project description

slow-learner-convert

A library to convert slow-learner output to different data model frameworks.

Usage

Following the example provided in the slow-learner announcing post and assuming Release.py is in the current directory, one would generate msgspec structs equivalent to the typing.TypedDict objects in Release.py by executing:

slow-learner-convert --input-file Release.py --output-file Release_msgspec.py --framework msgspec

More specifically, if example.py contains

from typing import TypedDict


class Foo(TypedDict):
    bar: str
	

Baz = TypedDict("Baz", {"qux": int})

then the command line program

slow-learner-convert --input-file example.py --framework attrs

will generate example_attrs.py, containing the following code.

import attrs
from typing import TypedDict


@attrs.define
class Foo:
    bar: str


@attrs.define
class Baz:
    qux: int

Currently four frameworks are supported:

Installation

I'm hoping to publish this to PyPI. On the meantime:

git clone git@github.com:gorkaerana/slow-learner-convert.git
cd slow-learner-convert
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -U pip
python3 -m pip install .

Development

I used rye (with uv backend) while developing this:

git clone git@github.com:gorkaerana/slow-learner-convert.git
cd slow-learner-convert
rye sync

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

slow_learner_convert-0.1.0.tar.gz (7.5 kB view hashes)

Uploaded Source

Built Distribution

slow_learner_convert-0.1.0-py3-none-any.whl (6.3 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