typefit


Nametypefit JSON
Version 0.5.5 PyPI version JSON
download
home_pagehttps://github.com/Xowap/typefit/
SummaryFits JSON values into Python type-anotated objects
upload_time2023-07-10 18:23:41
maintainer
docs_urlNone
authorRémy Sanchez
requires_python>=3.10,<4.0
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": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "typing,json,api",
    "author": "R\u00e9my Sanchez",
    "author_email": "remy.sanchez@hyperthese.net",
    "download_url": "https://files.pythonhosted.org/packages/22/dc/f93c5fd88d28a4f92af169335a56ea26936daa4fc9910878a9c99d85abb1/typefit-0.5.5.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": "0.5.5",
    "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": "e5db6f07bedeba9616cfa9846bee753b2aedff0704f88da0f3f063a9f88e1f4e",
                "md5": "1eddf8f48c6813eb9e0ded91589ed740",
                "sha256": "cb6db3c9604e778ff9dfe45b26b5b280c5cb25ee8990ea43f3ba0a8973754202"
            },
            "downloads": -1,
            "filename": "typefit-0.5.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1eddf8f48c6813eb9e0ded91589ed740",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 26387,
            "upload_time": "2023-07-10T18:23:39",
            "upload_time_iso_8601": "2023-07-10T18:23:39.721992Z",
            "url": "https://files.pythonhosted.org/packages/e5/db/6f07bedeba9616cfa9846bee753b2aedff0704f88da0f3f063a9f88e1f4e/typefit-0.5.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22dcf93c5fd88d28a4f92af169335a56ea26936daa4fc9910878a9c99d85abb1",
                "md5": "3ba627d02945108543799ad009550f02",
                "sha256": "66d6f39ba9a3c8b12c91520d0204acf64f7ad55288c51e512d410d74df3ad045"
            },
            "downloads": -1,
            "filename": "typefit-0.5.5.tar.gz",
            "has_sig": false,
            "md5_digest": "3ba627d02945108543799ad009550f02",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 22951,
            "upload_time": "2023-07-10T18:23:41",
            "upload_time_iso_8601": "2023-07-10T18:23:41.081742Z",
            "url": "https://files.pythonhosted.org/packages/22/dc/f93c5fd88d28a4f92af169335a56ea26936daa4fc9910878a9c99d85abb1/typefit-0.5.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 18:23:41",
    "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.12903s