Skip to main content

Basic type casting.

Project description

castfit

Basic type casting.

Build Status castfit on PyPI Supported Python versions

Changelog - Issues - Documentation

Why?

I'm writing more and more type-checked code, but I often get a bunch of strings I need to convert (e.g., from docopt).

Install

python -m pip install castfit

Example

from pathlib import Path
from castfit import castfit

class Cat:
  name: str
  age: int
  weight: float
  logo: Path

bob = castfit(Cat, dict(name="Bob", age="4", weight="3.2", logo="./bob.png"))
assert bob.name == "Bob"
assert bob.age == 4
assert bob.weight == 3.2
assert bob.logo == Path("./bob.png")

License

MIT License

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

castfit-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

castfit-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file castfit-0.1.0.tar.gz.

File metadata

  • Download URL: castfit-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for castfit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 896d1398f25b0c5a85a847d60a3bd9ec949a69bfe008a713f66834930eb90f7f
MD5 a3c808d49c50cabb0467ef52fca68160
BLAKE2b-256 3b3e21718a4c72a4978ea371c41b64989d8bf1460e812f4fcf32150ffd096393

See more details on using hashes here.

File details

Details for the file castfit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: castfit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for castfit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc3ecdc1acaf71538f3e686c0e811acd671bd985cf72f46701e52f7c205c4858
MD5 9c3139d43c1003bd92b0e100eb90a9dc
BLAKE2b-256 cb1693ce76d88ab3b0a126460c01cb1359ceac3cd21612fbdc87d35fab20a4ba

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