Live data from Hacker News

Show HN: Pump, a dead simple Pythonic abstraction of HTTP.

adeel.github.com

1–10 of 63 posts

Re: Show HN: Pump, a dead simple Pythonic abstraction of HTTP.

#4
post #2

This seems interesting but I'm not sure why. What are some use cases?

I believe the intent is to be Rack[1] for Python. The beauty of Rack is that I can build a new web framework, web server, or web app plugin and have it "just work" with the rest of the ecosystem. And because the Rack API is so simple, building to spec is easy.

In the Ruby world if I want to use the awesome library Sass all I have to do is:

    gem install sass
Because it functions as a Rack plugin it automatically works with any Ruby web framework & Ruby web server combo I choose. No special setup required.

-----

[1] http://rack.rubyforge.org/

Re: Show HN: Pump, a dead simple Pythonic abstraction of HTTP.

#5
post #2

This seems interesting but I'm not sure why. What are some use cases?

Building web apps! Basically, it's meant to be a replacement for WSGI. In my view, the problems with WSGI are that it has an unpythonic API (see: start_response and environ), and that it doesn't come with standard middleware that all frameworks use, so they all end up reinventing the wheel. Pump does a better job of abstracting out the details of HTTP, and also comes with a lot of useful middleware. This makes it really simple to write a web framework: just implement the routing and glue together a bunch of middlewares. For an example, see Picasso (https://github.com/adeel/picasso), a simple but functional framework I built on top of Pump.

Re: Show HN: Pump, a dead simple Pythonic abstraction of HTTP.

#8
post #4
post #2

This seems interesting but I'm not sure why. What are some use cases?

I believe the intent is to be Rack[1] for Python. The beauty of Rack is that I can build a new web framework, web server, or web app plugin and have it "just work" with the rest of the ecosystem. And because the Rack API is so simple, building to spec is easy. In the Ruby world if I want to use the awesome library Sass all I have to do is: gem install sass Because it functions as a Rack plugin it automatically works…

Yes, Pump was heavily inspired by Rack and especially Clojure's Ring (https://github.com/mmcgrana/ring).

Re: Show HN: Pump, a dead simple Pythonic abstraction of HTTP.

#9
post #4
post #2

This seems interesting but I'm not sure why. What are some use cases?

I believe the intent is to be Rack[1] for Python. The beauty of Rack is that I can build a new web framework, web server, or web app plugin and have it "just work" with the rest of the ecosystem. And because the Rack API is so simple, building to spec is easy. In the Ruby world if I want to use the awesome library Sass all I have to do is: gem install sass Because it functions as a Rack plugin it automatically works…

    # WSGI
    def app(environ, start_response):
        start_response('200 OK', [('Content-Type', 'text/plain')])
        yield 'Hello World\n'

    # Rack
    app = proc do |env|
    [ 200, {'Content-Type' => 'text/plain'}, "a" ]
    end
WSGI is the Rack for Python. In fact, WSGI predates Rack, and Rack is WSGI inspired.

Re: Show HN: Pump, a dead simple Pythonic abstraction of HTTP.

#10
post #8
post #4

Earlier quoted context omitted.

I believe the intent is to be Rack[1] for Python. The beauty of Rack is that I can build a new web framework, web server, or web app plugin and have it "just work" with the rest of the ecosystem. And because the Rack API is so simple, building to spec is easy. In the Ruby world if I want to use the awesome library Sass all I have to do is: gem install sass Because it functions as a Rack plugin it automatically works…

Yes, Pump was heavily inspired by Rack and especially Clojure's Ring ( https://github.com/mmcgrana/ring ).

I don't get the purpose. WSGI was meant to low level to cover the common minimum. If you want request, response semantics, use a higher level library - I use werkzeug which wraps wsgi, or flask which is small web framework built on werkzeug.

I don't think anyone other than wsgi library implementors code to WSGI. WSGI would be a problem if that's how python web programming was to be done - but that's not the case.

Post reply on HN