typefit


Nametypefit JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/Xowap/typefit/
SummaryFits JSON values into Python type-anotated objects
upload_time2024-09-13 12:21:25
maintainerNone
docs_urlNone
authorRémy Sanchez
requires_python<4.0,>=3.10
licenseWTFPL
keywords typing json api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TypeFit

[![Read the Docs](https://img.shields.io/readthedocs/typefit)](http://typefit.rtfd.io/)
[![Build Status](https://github.com/Xowap/typefit/actions/workflows/run-tests.yaml/badge.svg)](https://github.com/Xowap/typefit/actions/workflows/run-tests.yaml)

Typing annotations make Python awesome, however it's complicated to keep your
data annotated when it comes from external sources like APIs. The goal of
Typefit is to help you map that external data into type-annotated native Python
objects.

```python
from typefit import api
from typing import NamedTuple, Text


class Item(NamedTuple):
    id: int
    title: Text


class HackerNews(api.SyncClient):
    BASE_URL = "https://hacker-news.firebaseio.com/v0/"

    @api.get("item/{item_id}.json")
    def get_item(self, item_id: int) -> Item:
        pass

story = HackerNews().get_item(42)
print(story.title)
# An alternative to VC: &#34;Selling In&#34;
```

This is the full example of a Hacker News API client. Its functionality is
limited but in 14 lines counting white space you can build a type-safe client
for Hacker News. You'll find a [full example](example/typefit_hn) attached if
you're interested.

## Documentation

[✨ **Documentation is there** ✨](http://typefit.rtfd.io/)

## Licence

This library is provided under the terms of the [WTFPL](./LICENSE).

If you find it useful, you can have a look at the
[contributors](https://github.com/Xowap/typefit/graphs/contributors) page to
know who helped.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Xowap/typefit/",
    "name": "typefit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "typing, json, api",
    "author": "R\u00e9my Sanchez",
    "author_email": "remy.sanchez@hyperthese.net",
    "download_url": "https://files.pythonhosted.org/packages/b3/21/ed76c10dc694b9e34ca44a24ba9012a59a652a1bccea8644f157c623ad3a/typefit-1.0.0.tar.gz",
    "platform": null,
    "description": "# TypeFit\n\n[![Read the Docs](https://img.shields.io/readthedocs/typefit)](http://typefit.rtfd.io/)\n[![Build Status](https://github.com/Xowap/typefit/actions/workflows/run-tests.yaml/badge.svg)](https://github.com/Xowap/typefit/actions/workflows/run-tests.yaml)\n\nTyping annotations make Python awesome, however it's complicated to keep your\ndata annotated when it comes from external sources like APIs. The goal of\nTypefit is to help you map that external data into type-annotated native Python\nobjects.\n\n```python\nfrom typefit import api\nfrom typing import NamedTuple, Text\n\n\nclass Item(NamedTuple):\n    id: int\n    title: Text\n\n\nclass HackerNews(api.SyncClient):\n    BASE_URL = \"https://hacker-news.firebaseio.com/v0/\"\n\n    @api.get(\"item/{item_id}.json\")\n    def get_item(self, item_id: int) -> Item:\n        pass\n\nstory = HackerNews().get_item(42)\nprint(story.title)\n# An alternative to VC: &#34;Selling In&#34;\n```\n\nThis is the full example of a Hacker News API client. Its functionality is\nlimited but in 14 lines counting white space you can build a type-safe client\nfor Hacker News. You'll find a [full example](example/typefit_hn) attached if\nyou're interested.\n\n## Documentation\n\n[\u2728 **Documentation is there** \u2728](http://typefit.rtfd.io/)\n\n## Licence\n\nThis library is provided under the terms of the [WTFPL](./LICENSE).\n\nIf you find it useful, you can have a look at the\n[contributors](https://github.com/Xowap/typefit/graphs/contributors) page to\nknow who helped.\n",
    "bugtrack_url": null,
    "license": "WTFPL",
    "summary": "Fits JSON values into Python type-anotated objects",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/Xowap/typefit/",
        "Repository": "https://github.com/Xowap/typefit/"
    },
    "split_keywords": [
        "typing",
        " json",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b3b356f9de7577e29ce044ed936ec9fcd43829f98d5435298eba2dd15ec19f3b",
                "md5": "b1280c987b4bf92edbd89bc2225a3855",
                "sha256": "c21d92b83e18418ce1b786c4c88bd02b00ae890adc4e671cf6a7e524058b3df4"
            },
            "downloads": -1,
            "filename": "typefit-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b1280c987b4bf92edbd89bc2225a3855",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 26392,
            "upload_time": "2024-09-13T12:21:23",
            "upload_time_iso_8601": "2024-09-13T12:21:23.370433Z",
            "url": "https://files.pythonhosted.org/packages/b3/b3/56f9de7577e29ce044ed936ec9fcd43829f98d5435298eba2dd15ec19f3b/typefit-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b321ed76c10dc694b9e34ca44a24ba9012a59a652a1bccea8644f157c623ad3a",
                "md5": "ad19ea6a94bd048be0fc35265304306e",
                "sha256": "4300f773a83c48e8bf3911773555d50e5678d11ab7f2234e96f12263237a5a56"
            },
            "downloads": -1,
            "filename": "typefit-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ad19ea6a94bd048be0fc35265304306e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 23116,
            "upload_time": "2024-09-13T12:21:25",
            "upload_time_iso_8601": "2024-09-13T12:21:25.044248Z",
            "url": "https://files.pythonhosted.org/packages/b3/21/ed76c10dc694b9e34ca44a24ba9012a59a652a1bccea8644f157c623ad3a/typefit-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-13 12:21:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Xowap",
    "github_project": "typefit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "typefit"
}
        
Elapsed time: 0.34535s