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

python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -U pip
python3 -m pip install slow-learner-convert

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.2.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

slow_learner_convert-0.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file slow_learner_convert-0.2.0.tar.gz.

File metadata

  • Download URL: slow_learner_convert-0.2.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for slow_learner_convert-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fb2dd8e42c034fee1561755b62ca677a715fab1610fafc0c97cc23536b08d4e3
MD5 00bbba6cd49c3f6cfb253581b814d1d3
BLAKE2b-256 0147fad1cbe53f909de4778d66c4eaa98983230e1c1dd26bd5cc62289094982d

See more details on using hashes here.

File details

Details for the file slow_learner_convert-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for slow_learner_convert-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36457de246cf8bbc866bd22bcfc9f1aa36d7ff18048259edba12ab94209a606a
MD5 44687baf40e42d77480c829f2022083f
BLAKE2b-256 194bdd90e83ce8aaabd26d8d17b474aa8bc2952255a7f0c472b96ff1d1191ea8

See more details on using hashes here.

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