TypeFit
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.
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: "Selling In"
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 attached if you're interested.
Documentation
Licence
This library is provided under the terms of the WTFPL.
If you find it useful, you can have a look at the contributors page to know who helped.
Metadata
Release files for typefit 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| typefit-1.0.0.tar.gz | 23.1 kB | Without provenance | Details for typefit-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| typefit-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for typefit-1.0.0-py3-none-any.whl |
Total release size: 49.5 kB
Release files / typefit-1.0.0.tar.gz
| Download URL | typefit-1.0.0.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4300f773a83c48e8bf3911773555d50e5678d11ab7f2234e96f12263237a5a56
|
|
BLAKE2b-256 checksum How to use checksums |
b321ed76c10dc694b9e34ca44a24ba9012a59a652a1bccea8644f157c623ad3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.10 Linux/6.8.0-41-generic
|
Release files / typefit-1.0.0-py3-none-any.whl
| Download URL | typefit-1.0.0-py3-none-any.whl |
|---|---|
| Size | 26.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c21d92b83e18418ce1b786c4c88bd02b00ae890adc4e671cf6a7e524058b3df4
|
|
BLAKE2b-256 checksum How to use checksums |
b3b356f9de7577e29ce044ed936ec9fcd43829f98d5435298eba2dd15ec19f3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.10 Linux/6.8.0-41-generic
|
Security for typefit 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.