hug v2.0.0 Release Notes

Release Date: 2016-03-17 // about 8 years ago
    • ➕ Adds the concept of chain-able routing decorators
    • ➕ Adds built-in static file handling support via a @hug.static decorator (thanks @BrandonHoffman!)
    • ➕ Adds a directive to enable directly accessing the user object from any API call (thanks @ianthetechie)
    • ➕ Adds the concept of seamless micro-services via the hug.use module, enable switching between HTTP and local without code change
    • ➕ Adds built-in support for 'X-Api-Key' header based authentication via authentication.api_key
    • ➕ Adds support for running arbitrary python functions at runtime via a @hug.startup decorator
    • ➕ Adds support for smarter handling of html output types
    • ➕ Adds a UUID type
    • Adds support for explicit API creation / referencing using hug.api(__name__)
    • ➕ Adds a logging middleware to simplify the process of logging all requests with hug
    • ➕ Adds a middleware_class class decorator, to enable quickly registering middleware classes
    • ➕ Adds smart_redirection allowing API functions to return other endpoints
    • ➕ Adds support for class based handlers
    • ➕ Adds support for automatically handling exceptions
    • ➕ Adds support for automatically outputting images with save method that don't take a format.
    • ➕ Added extended support for delimited fields, enabling use of custom delimiters
    • ➕ Added support for running different transformers based on content_type
    • ➕ Added support for outputting a different response output type based on the response content_type
    • ➕ Added support for running different transformations and outputting different content_types based on path suffix
    • ➕ Added support for automatically supporting a set of suffixes at the end of a URL
    • ➕ Added support for automatically adding headers based on route match
    • ➕ Added support for quickly adding cache header based on route match
    • ➕ Added support for quickly adding allow origin header based on route match
    • ➕ Added support for quickly re-routing to defined 404 handler
    • Added support for length based types (length, shorter_than, and longer_than)
    • ➕ Added support for easily extending hugs JSON outputter with support for custom types
    • ➕ Added support for a custom final pass validation function
    • ➕ Added support for defining routes separate from handlers
    • ➕ Added support for raising on validation errors - to enable overall exception handlers to catch them
    • ➕ Added support for multiple transformers on an endpoint via transform.all
    • ➕ Added support for applying type annotations and directives locally with @hug.local()
    • Added support for a base_url by doing hug.API(__name__).http.base_url = '/base_url'
    • ➕ Added support for automatically running CLI commands from hug command line runner
    • ➕ Added requirements to documentation
    • ⚡️ Updated all default output formats to gracefully handle error dictionaries
    • 📚 Documentation generation was moved to API instances to enable easier customization
    • Now correctly identifies and handles custom encodings
    • 👌 Improved integration with Falcon so that primary elements (like status codes) can be imported directly from hug
    • ➕ Added the ability to specify a transformer for validation errors per request handler, via on_invalid decorator argument
    • ➕ Added the ability to specify an output format specific to validation errors per request handler, via output_invalid decorator argument
    • 🔄 Changed transform functions to get ran on output of validation errors by default
    • Automatically works around a bug in uwsgi when returning byte streams
    • 🔨 Refactored how interfaces are built to be more reasuable, and more easily introspected
    • 🔨 Refactored how the built in annotation types are built to be more easily built upon
    • ⚡️ Updated type.string to fail if a list is passed in
    • ✂ Removed 'cli_behaviour' from types, instead moving the responsibility of per-type behavior to the CLI interface
    • 🛠 Fixed a bug that leaked annotation provided directives to the produced documentation
    • Fully re-factored hug's type system for easier extensibility
    • 💥 Breaking Changes
      • directives are no longer automatically applied to local function calls, '@hug.local' must be used to apply them
      • cli_behaviour has been removed as a type feature - however common sense inheritance of base types should easily replace it's usage
      • documentation module has been removed, in favor of documentation being generated by the api object and individual interfaces
      • API singleton now has sub-apis for each interface in use (IE hug.API(name).http and hug.API(name).cli)
      • run module has been removed, with the functionality moved to hug.API(name).http.server() and the terminal functionality being moved to hug.development_runner.hug