Skip to main content

A Python library for flexible resource mapping and API development. Hype provides a powerful way to define, traverse, and transform resources with support for multiple output formats including JSON, WAC-JSON, and URL-encoded forms.

Features

  • Resource mapping and traversal with cycle detection

  • Multiple output format support (JSON, WAC-JSON, API-JSON, URL-encoded)

  • Field-based resource definition with type validation

  • Automatic URL generation and linking between resources

  • Pagination support with cursor-based navigation

  • Flexible resource transformation pipeline

  • Thread-safe global context management

Installation

pip install hype

Requirements

  • Python 2.7

Usage

Here’s a quick example of defining and transforming a resource:

from hype import Resource, fields

class User(Resource):
    name = fields.String()
    email = fields.String()
    profile = fields.Link(endpoint='profile.show')

# Transform to JSON
from hype.mime import application_json

def url_for(ref):
    return f'/api/{ref.name}/{ref.params["id"]}'

user = User(name='John Doe', email='john@example.com')
json_output = application_json.serialize(user, url_for=url_for)

Documentation

Full documentation is available at https://github.com/balanced/hype/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the ISC License - see the LICENSE file for details.

Author

Balanced Developers (dev@balancedpayments.com) @bninja @mahmoudimus @mjallday

Metadata

Release files for hype 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hype 1.1
File Size Uploaded
hype-1.1.tar.gz 2.3 kB Details

Release files / hype-1.1.tar.gz

Download URL hype-1.1.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c01bb22fcb76eace83c15490b9d25b399809fa36dda1e1d7ed2ae897b45a37b0
BLAKE2b-256 checksum
How to use checksums
5d2ae61615ff9efc821e9139032ddc313ea9beda3ad22f742e5baed758493ef1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/41.2.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file

1.0

1 release file

0.1

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page