Skip to main content

A Python module which simplifies the creation of RESTful CRUD endpoints in hug, for peewee models.

Project description


HugPee simplifies the creation of RESTful CRUD endpoints in hug, for peewee models.

Installing HugPee

Installing Hugpee is very simple, just run:

pip3 install hugpee --upgrade


Consider a scenario where Person is our peewee model. Creating the CRUD endpoints for hug is very simple with HugPee:


And then load them to hug.

def get_all_hugs():
    return [modelendpoint]

Here is the full working example:

import hug
from peewee import SqliteDatabase, Model
from peewee import PrimaryKeyField, CharField, DateField, BooleanField
import hugpee

db = SqliteDatabase(":memory:")

class Person(Model):
    ID = PrimaryKeyField()
    name = CharField()
    birthday = DateField()
    is_relative = BooleanField()
    class Meta:
        database = db



def get_all_hugs():
    return [hugpee]

This will create the following endpoints:

HTTP ACTION URI(s) Accepted Parameters
POST /person name, birthday, is_relative
GET /person , /person/{id} id
PUT /person , /person/{id} id, name, birthday, is_relative
DELETE /person , /person/{id} id

Note that the primary key, in this case the id, can be provided either as part of the URI or as a parameter.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hugpee, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size hugpee-0.1.1-py3-none-any.whl (4.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hugpee-0.1.1.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page