Metadata-Version: 1.1
Name: midware
Version: 0.5.0
Summary: A simple general-purpose middleware library for Python
Home-page: https://github.com/idmit/midware
Author: Ivan Dmitrievsky
Author-email: ivan.dmitrievsky+python@gmail.com
License: MIT License

Copyright (c) 2017 Ivan Dmitrievsky

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Description: Midware
        =======
        
        A simple general-purpose middleware library for Python 3.5 or greater.
        
        Often the main task of a program can
        be represented as one function with rather
        straightforward input and output. But a lot of
        unrelated code needs to be added to make this one function
        doing one main task into an actual usable utility that,
        for example, handles user input correctly.
        
        One way to decomplect unrelated concerns in a program is a middleware pattern.
        
        Middleware puts functions and composability first. To make it
        easier for functions with different signatures to be composable all
        arguments are usually packed into one dictionary called `ctx` for "context".
        All functions take `ctx` as an argument, modify it and return it.
        
        Functions that modify the `ctx` are called handlers. Handlers are already
        very composable by design and one can easily pipe `ctx` values through
        a series of handlers, but that's often not enough. One of the most frequently
        used patterns (a lot of languages even have built-in keywords for it, Python has several actually)
        is the "setup-teardown" pattern. That is where middleware comes in.
        
        Middleware is a higher-order function that takes a handle and return a new handle,
        which typically wraps the old one. It does some work, maybe modifies the `ctx`,
        passes it to the old handle, gets a new `ctx` back and optionally does
        something else before returning.
        
        Once again, middleware is composable, because it takes handles and returns handles.
        When using middleware as building blocks, composing those returns an outermost handle,
        which needs to be called with a `ctx` value as an argument to kick off the computation.
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
