# timothycrosley/hug

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/timothycrosley-hug).**

6,883 stars · 391 forks · Python · MIT

## Links

- GitHub: https://github.com/timothycrosley/hug
- awesome-repositories: https://awesome-repositories.com/repository/timothycrosley-hug.md

## Description

Hug is a type-driven Python web framework designed for building APIs. It uses Python type annotations to automatically validate and convert incoming request data and to format outgoing responses.

The framework functions as an automated documentation tool by extracting function signatures and markers from source code to generate accessible API specifications. It also supports non-blocking coroutines for asynchronous API processing to handle background tasks without interrupting the main request cycle.

The project provides capabilities for REST API development, including route mapping, endpoint versioning, and request interception through backend middleware. It is a WSGI-compatible server, ensuring portable deployment across hosting environments that follow the WSGI specification.

## Tags

### Software Engineering & Architecture

- [Data Type Validation](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-validation/data-type-validation.md) — Automatically validates and converts incoming request data using Python type annotations.
- [Automated API Documentation](https://awesome-repositories.com/f/software-engineering-architecture/automated-api-documentation.md) — Generates accessible API specifications by extracting function signatures and markers directly from source code.
- [Type-Annotation Validation](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-validation/data-type-validation/type-annotation-validation.md) — Uses Python type annotations to automatically validate and convert incoming request data.
- [API Documentation Generators](https://awesome-repositories.com/f/software-engineering-architecture/api-documentation-generators.md) — Generates interactive API documentation by parsing source code annotations at runtime. ([source](https://github.com/timothycrosley/hug#readme))
- [Background Task Decorators](https://awesome-repositories.com/f/software-engineering-architecture/background-task-decorators.md) — Implements decorators for executing non-blocking background coroutines during API operations. ([source](https://github.com/timothycrosley/hug#readme))
- [Request Interception Middleware](https://awesome-repositories.com/f/software-engineering-architecture/request-interception-middleware.md) — Provides architectural middleware to intercept every request and response for global server management. ([source](https://github.com/timothycrosley/hug#readme))
- [Request Middleware](https://awesome-repositories.com/f/software-engineering-architecture/request-middleware.md) — Provides middleware for intercepting and transforming every incoming request and outgoing response.
- [Asyncio Coroutine Execution](https://awesome-repositories.com/f/software-engineering-architecture/task-execution-engines/asyncio-coroutine-execution.md) — Utilizes non-blocking asyncio coroutines to handle background tasks without interrupting the main request cycle.

### Web Development

- [RESTful API Development](https://awesome-repositories.com/f/web-development/restful-api-development.md) — Provides a streamlined framework for developing RESTful APIs with integrated validation and documentation.
- [API Documentation Tools](https://awesome-repositories.com/f/web-development/api-documentation-tools.md) — Automatically generates standardized API specifications and documentation from source code definitions.
- [Function-to-URL Mappings](https://awesome-repositories.com/f/web-development/api-management-tools/api-development-management/web-apis/administrative-api-endpoints/endpoint-discovery/endpoint-translation-maps/function-to-url-mappings.md) — Exposes internal Python functions as API endpoints via specific route markers. ([source](https://github.com/timothycrosley/hug#readme))
- [Decorator-Based Route Mappings](https://awesome-repositories.com/f/web-development/routing-systems/routing/decorator-based-route-mappings.md) — Links internal logic to network endpoints using language-level decorators for route mapping.
- [Type-Safe API Frameworks](https://awesome-repositories.com/f/web-development/type-safe-api-frameworks.md) — Leverages Python type annotations to ensure data integrity and contract safety across endpoints.
- [Web API Frameworks](https://awesome-repositories.com/f/web-development/web-api-frameworks.md) — Enables the creation of structured HTTP-based interfaces for processing requests and returning data. ([source](https://github.com/timothycrosley/hug#readme))
- [Asynchronous Request Processing](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/asynchronous-request-processing.md) — Supports non-blocking request processing to handle heavy operations without interrupting the main request cycle.
- [Request and Response Transformers](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/request-and-response-transformers.md) — Implements request transformers to validate and modify input data before it reaches the logic handler. ([source](https://github.com/timothycrosley/hug#readme))
- [Asynchronous API Routing](https://awesome-repositories.com/f/web-development/backend-development/web-frameworks/routing-request-handling/asynchronous-api-routing.md) — Maps API endpoints to asynchronous execution processes using non-blocking coroutines.
- [Request Interception Middleware](https://awesome-repositories.com/f/web-development/request-interception-middleware.md) — Implements pipeline handlers to intercept and modify network traffic globally across all requests.
- [WSGI Servers](https://awesome-repositories.com/f/web-development/web-infrastructure-deployment/web-infrastructure-servers/application-servers/wsgi-servers.md) — Provides a WSGI-compliant interface for portable deployment across various Python web servers.

### Part of an Awesome List

- [Web and API Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/web-and-api-frameworks.md) — Provides a full framework for building RESTful APIs with built-in routing and request handling. ([source](https://github.com/timothycrosley/hug#readme))
- [API Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/api-frameworks.md) — Simplifies API development in Python using type hints.

### Networking & Communication

- [Input Validation](https://awesome-repositories.com/f/networking-communication/api-integration-frameworks/api-management-integration/api-integrations/server-side/input-validation.md) — Automatically validates and converts incoming request data based on predefined rules and type hints.

### Data & Databases

- [Automatic Specification Generators](https://awesome-repositories.com/f/data-databases/openapi-processors/automatic-specification-generators.md) — Provides automated generation of API specifications by deriving them from source code annotations.
- [Docstring Extraction](https://awesome-repositories.com/f/data-databases/type-inspection-tools/runtime-introspection/docstring-extraction.md) — Automatically extracts documentation from function signatures and source code definitions at runtime.
