kalasjocke / hyp Goto Github PK
View Code? Open in Web Editor NEWPartial JSON API implementation in Python
License: MIT License
Partial JSON API implementation in Python
License: MIT License
Hey there! I just wanted to let you know that JSON API has hit RC3, and we'd like client libraries to start implementing it like it was 1.0, as a final check that we're good for 1.0. I wanted to make this issue to let you know!
I just installed hyp and I'm trying to use it in conjunction with Marshmallow to serialize my models but the 'hyp.marshmallow' package doesn't exist. How should I proceed? For the record I'm using python 3, Marshmallow (2.4.2), hyp (1.0.0), and Flask (0.10.1).
Thanks,
Bill
I was having trouble defining my own linked section, so I copied the example out of the README and received the same error:
json = PostResponder().respond(post, linked={'comments': comments})
NameError: global name 'comments' is not defined
comments
should be post['comments']
to avoid the error and properly access the object.
Submitting a pull request to update the README
I am trying to learn Python, I want to make a simple JSON API backend for private project "PassMan" (yeah, a password manager)
In my virtualenv I have:
(env) C:\workspace\pyczarm>pip list
click (6.6)
Flask (0.11.1)
hyp (1.0.0)
inflection (0.3.1)
itsdangerous (0.24)
Jinja2 (2.8)
MarkupSafe (0.23)
marshmallow (2.10.1)
pip (7.1.0)
pymongo (3.3.0)
schematics (1.1.1)
setuptools (18.1)
six (1.10.0)
Werkzeug (0.11.11)
Running this code:
from marshmallow import Schema, fields
from hyp.responder import Responder
class PasswordSchema(Schema):
_id = fields.String()
portal = fields.String()
login = fields.String()
password = fields.String()
note = fields.String()
class PasswordResponder(Responder):
TYPE = 'passwords'
SERIALIZER = PasswordSchema
Gives me error:
Traceback (most recent call last):
File "C:/workspace/pyczarm/passman.py", line 2, in <module>
import models.Password
File "C:\workspace\pyczarm\models\Password.py", line 3, in <module>
from hyp.responder import Responder
File "C:\workspace\pyczarm\env\lib\site-packages\hyp\responder.py", line 5, in <module>
from hyp.adapters.base import adapter_for
File "C:\workspace\pyczarm\env\lib\site-packages\hyp\adapters\base.py", line 4, in <module>
from marshmallow import Serializer as MarshmallowSerializer
ImportError: cannot import name 'Serializer'
Could You please make appropriate updates?
Currently, hyp is not useable on Python 3 due to its hard dependency on schematics, which is Py2-only.
Example test failure on Py34:
tests/test_schematics_adapter.py:2: in <module>
from schematics.models import Model
../../../miniconda/envs/hyp/lib/python3.4/site-packages/schematics/models.py:6: in <module>
from .types import BaseType
../../../miniconda/envs/hyp/lib/python3.4/site-packages/schematics/types/__init__.py:1: in <module>
from .base import *
../../../miniconda/envs/hyp/lib/python3.4/site-packages/schematics/types/base.py:56: in <module>
class BaseType(TypeMeta('BaseTypeBase', (object, ), {})):
../../../miniconda/envs/hyp/lib/python3.4/site-packages/schematics/types/base.py:47: in __new__
for attr_name, attr in attrs.iteritems():
E AttributeError: 'dict' object has no attribute 'iteritems'
Would it be possible to remove hyp's hard dependencies on schematics and marshmallow and instead have users opt in to their preferred serialization library?
Hi I like your implementation on serializing jsonapi, i was just wondering on which previous version does this comply to ?? thanks !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.