castfit


Namecastfit JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryBasic type casting.
upload_time2023-12-15 12:15:43
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords type casting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # castfit

_Basic type casting._

[![Build Status](https://img.shields.io/github/actions/workflow/status/metaist/castfit/.github/workflows/ci.yaml?branch=main&style=for-the-badge)](https://github.com/metaist/castfit/actions)
[![castfit on PyPI](https://img.shields.io/pypi/v/castfit.svg?color=blue&style=for-the-badge)](https://pypi.org/project/castfit)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/castfit?style=for-the-badge)](https://pypi.org/project/castfit)

[Changelog] - [Issues] - [Documentation]

[changelog]: https://github.com/metaist/castfit/blob/main/CHANGELOG.md
[issues]: https://github.com/metaist/castfit/issues
[documentation]: https://metaist.github.io/castfit/

## 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`](https://github.com/docopt/docopt)).

- [`pydantic`](https://github.com/pydantic/pydantic) feels heavy.
- [`type-docopt`](https://github.com/dreamgonfly/type-docopt) uses a new syntax.
- [`bottle`](https://github.com/bottlepy/bottle) seems like good inspiration for small, useful libraries.

## Install

```bash
python -m pip install castfit
```

## Example

```python
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](https://github.com/metaist/castfit/blob/main/LICENSE.md)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "castfit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "type,casting",
    "author": "",
    "author_email": "Metaist LLC <metaist@metaist.com>",
    "download_url": "https://files.pythonhosted.org/packages/3b/3e/21718a4c72a4978ea371c41b64989d8bf1460e812f4fcf32150ffd096393/castfit-0.1.0.tar.gz",
    "platform": null,
    "description": "# castfit\n\n_Basic type casting._\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/metaist/castfit/.github/workflows/ci.yaml?branch=main&style=for-the-badge)](https://github.com/metaist/castfit/actions)\n[![castfit on PyPI](https://img.shields.io/pypi/v/castfit.svg?color=blue&style=for-the-badge)](https://pypi.org/project/castfit)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/castfit?style=for-the-badge)](https://pypi.org/project/castfit)\n\n[Changelog] - [Issues] - [Documentation]\n\n[changelog]: https://github.com/metaist/castfit/blob/main/CHANGELOG.md\n[issues]: https://github.com/metaist/castfit/issues\n[documentation]: https://metaist.github.io/castfit/\n\n## Why?\n\nI'm writing more and more type-checked code, but I often get a bunch of strings I need to convert (e.g., from [`docopt`](https://github.com/docopt/docopt)).\n\n- [`pydantic`](https://github.com/pydantic/pydantic) feels heavy.\n- [`type-docopt`](https://github.com/dreamgonfly/type-docopt) uses a new syntax.\n- [`bottle`](https://github.com/bottlepy/bottle) seems like good inspiration for small, useful libraries.\n\n## Install\n\n```bash\npython -m pip install castfit\n```\n\n## Example\n\n```python\nfrom pathlib import Path\nfrom castfit import castfit\n\nclass Cat:\n  name: str\n  age: int\n  weight: float\n  logo: Path\n\nbob = castfit(Cat, dict(name=\"Bob\", age=\"4\", weight=\"3.2\", logo=\"./bob.png\"))\nassert bob.name == \"Bob\"\nassert bob.age == 4\nassert bob.weight == 3.2\nassert bob.logo == Path(\"./bob.png\")\n```\n\n## License\n\n[MIT License](https://github.com/metaist/castfit/blob/main/LICENSE.md)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Basic type casting.",
    "version": "0.1.0",
    "project_urls": {
        "Changelog": "https://github.com/metaist/castfit/blob/main/CHANGELOG.md",
        "Documentation": "https://metaist.github.io/castfit/",
        "Homepage": "https://github.com/metaist/castfit",
        "Repository": "https://github.com/metaist/castfit.git"
    },
    "split_keywords": [
        "type",
        "casting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb1693ce76d88ab3b0a126460c01cb1359ceac3cd21612fbdc87d35fab20a4ba",
                "md5": "9c3139d43c1003bd92b0e100eb90a9dc",
                "sha256": "fc3ecdc1acaf71538f3e686c0e811acd671bd985cf72f46701e52f7c205c4858"
            },
            "downloads": -1,
            "filename": "castfit-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c3139d43c1003bd92b0e100eb90a9dc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6055,
            "upload_time": "2023-12-15T12:15:41",
            "upload_time_iso_8601": "2023-12-15T12:15:41.517648Z",
            "url": "https://files.pythonhosted.org/packages/cb/16/93ce76d88ab3b0a126460c01cb1359ceac3cd21612fbdc87d35fab20a4ba/castfit-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b3e21718a4c72a4978ea371c41b64989d8bf1460e812f4fcf32150ffd096393",
                "md5": "a3c808d49c50cabb0467ef52fca68160",
                "sha256": "896d1398f25b0c5a85a847d60a3bd9ec949a69bfe008a713f66834930eb90f7f"
            },
            "downloads": -1,
            "filename": "castfit-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a3c808d49c50cabb0467ef52fca68160",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8377,
            "upload_time": "2023-12-15T12:15:43",
            "upload_time_iso_8601": "2023-12-15T12:15:43.159694Z",
            "url": "https://files.pythonhosted.org/packages/3b/3e/21718a4c72a4978ea371c41b64989d8bf1460e812f4fcf32150ffd096393/castfit-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-15 12:15:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "metaist",
    "github_project": "castfit",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "castfit"
}
        
Elapsed time: 0.66474s