This release is a pre-release and may not be stable for production use.
|pillow\_talk\_icon| # **Pillowtalk**
Creates intuitive python wrappers for APIs. **Pillowtalk** talks to APIs
and handles all of the model relationships behind the scenes, providing
a clean and easy-to-use wrapper for your models.
Why another package?
====================
While there are plenty of excellent libraries for creating APIs, but
creating intuitive wrappers for these APIs isn't entirely
straightforward. **Pillowtalk** cleanly captures the underlying database
relationships APIs may be providing making it easy to write python
models. It provides a wrapper for making intuitive live API calls using
your python models and the underlying relationships you specified.
In future versions, **pillowtalk** will be able to create and update
your code based on a list of JSON files and *guess* at the underlying
relationships between models. From there, **pillowtalk** will
automatically generate or update python models. This means changes to
some API can trigger an automatic update to your python wrapper to that
API!
Features and Examples
=====================
Minimalistic models with relationships
--------------------------------------
e.g. Person with ONE Address; Address has MANY people
.. code:: python
class MyBase(PillowtalkBase):
@classmethod
def find(cls, id):
...
def where(cls, data):
...
@add_schema
class Person(MyBase):
FIELDS = ["id", "name"]
RELATIONSHIPS = [
One("address", "find Person.address_id <> Address.id")
]
@add_schema
class Address(MyBase):
FIELDS = ["id", "str"]
RELATIONSHIPS = [
Many("people", "where Address.id <> Person.address_id")
]
Intuitive calls uses live API connection to deserialize data to your
models
.. code:: python
# address.people doesn't exist yet
address = Address.find(3)
# calling .people causes a api call using "where" and deserialization of data
people = address.people # returns a list of People objects found through "where"
# returned is a list of Person objects!
assert type(people[0]) is Person
Handling impartial data
.. code:: python
person = {
"id": 5,
"name": "Joe",
"address": {"id": 4}
}
p = Person.load(person_data)
# a.address will magically return Address object even though data is enveloped in a json.
# we do not specifically have to handle deserialization of impartial data since the
# relationship between Person.address_id <> Address.id was already defined.
a = p.address
assert type(a) is Address
assert person.address_id == 4 # this wasn't defined explicitly but it is inferred from "address": {"id": 4}
More examples and magic to come!
--------------------------------
::
Other things include:
* Magic chaining in relationships
* Session managing suggestions
* automatically creating model skeletons from list of JSON
* model relationships through associations
* examples of connecting to MySQL or SQLlite
* examples of using CLI through hug
.. |travis build| image:: https://img.shields.io/travis/jvrana/**Pillowtalk**.svg
:target: https://travis-ci.org/jvrana/**Pillowtalk**
.. |Coverage Status| image:: https://coveralls.io/repos/github/jvrana/**Pillowtalk**/badge.svg?branch=master
:target: https://coveralls.io/github/jvrana/**Pillowtalk**?branch=master
.. |pillow\_talk\_icon| image:: images/pillowtalk_icon_medium.png?raw=true
Metadata
Release files for pillowtalk 1.1.0a
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 |
|---|---|---|---|---|
| pillowtalk-1.1.0a.tar.gz | 10.5 kB | Without provenance | Details for pillowtalk-1.1.0a.tar.gz |
Release files / pillowtalk-1.1.0a.tar.gz
| Download URL | pillowtalk-1.1.0a.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b8085e8f414f45dc3274fb4152c0386c5e856a5de901d7d29f66598eb22b3a3
|
|
BLAKE2b-256 checksum How to use checksums |
481341196efd09c0e22163a23adae83cf018c05cca7d5619bc835a2aff3f2b0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pillowtalk 1.1.0a
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.