Skip to main content

A Python framework that makes developing APIs as simple as possible, but no simpler.

Project description

HUG

Everyone needs a hug every once in a while. Even API developers. Hug aims to make developing Python driven APIs as simple as possible, but no simpler.

PyPI version PyPi downloads Build Status License

Hug drastically simplifies Python API development.

Hug’s Design Objectives:

  • Make developing a Python driven API as succint as a written definition.

  • The framework should encourage code that self-documents.

  • It should be fast. Never should a developer feel the need to look somewhere else for performance reasons.

  • Writing tests for APIs written on-top of Hug should be easy and intuitive.

  • Magic done once, in an API, is better then pushing the problem set to the user of the API.

Basic Example API

happy_birthday.py

"""A basic (single function) API written using Hug"""
import hug


@hug.get('/happy_birthday')
def happy_birthday(name, age:int, **kwargs):
    """Says happy birthday to a user"""
    return "Happy {age} Birthday {name}!".format(**locals())

To run the example:

hug happy_birthday.py

Then you can access the example from localhost:8080/happy_birthday?name=Hug&age=1 Or access the documentation for your API from localhost:8080/documentation

Why Hug?

HUG simply stands for Hopefully Useful Guide. This represents the projects goal to help guide developers into creating well written and intuitive APIs.


Thanks and I hope you find this hug helpful as you develop your next Python API!

~Timothy Crosley

Project details


Download files

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

Source Distribution

hug-0.0.1.tar.gz (4.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page