Live data from Hacker News

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

adeel.github.com

11–20 of 63 posts

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

#11
post #9
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…

# 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.

    # Pump
    def app(request):
        return {
          "status": 200,
          "headers": {"content_type": "text/plain"},
          "body": "Hello World"}

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

#13
post #3

Here's another NoWSGI HTTP server library (Brubeck): http://news.ycombinator.com/item?id=2770866

welcometo: http://www.fullmalls.com The website wholesale for many kinds of fashion shoes, like the nike,jordan,prada,, also including the jeans,shirts,bags,hat and the decorations. All the products are free shipping, and the the price is competitive, and also can accept the paypal payment.,after the payment, can ship within short time. free shippingcompetitive priceany size availableaccept the paypal ===== http://www.fullmalls.com =====

jordan shoes $32nike shox $32Christan Audigier bikini $23 Ed Hardy Bikini $23Smful short_t-shirt_woman $15ed hardy short_tank_woman $16Sandal $32christian loubo utin $80 Sunglass $15 COACH_Necklace $27handbag $33AF tank woman $17puma slipper woman $30

===== http://www.fullmalls.com =====

===== http://www.fullmalls.com =====

===== http://www.fullmalls.com =====

===== http://www.fullmalls.com =====

===== http://www.fullmalls.com =====

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

#14
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 like how the circle if inspiration loops back to Python: Python WSGI inspired Ruby Rack. Ruby Rack inspired Clojure Ring. Clojure Ring inspired Python Pump.

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

#15
post #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 rea…

> In my view, the problems with WSGI are that it has an unpythonic API (see: start_response and environ),

Why do you find `start_response` unpythonic?

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

#16
post #11
post #9

Earlier quoted context omitted.

# 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.

# Pump def app(request): return { "status": 200, "headers": {"content_type": "text/plain"}, "body": "Hello World"}

You sure have put effort and the project looks good, but I am missing the purpose. If the problem it tries to solve is parsing environ to form response objects, or providing vanilla middlewares, that problem is very well solved by a wsgi library. Have you looked at werkzeug?

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

#17
post #9
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…

# 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.

They are both predated by:

    public class App extends HttpServlet {
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/plain");
        response.getWriter().println("Hello world");
      }
    }

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

#18
post #15
post #5

Earlier quoted context omitted.

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 rea…

> In my view, the problems with WSGI are that it has an unpythonic API (see: start_response and environ), Why do you find `start_response` unpythonic?

The problems with start_response have been discussed at length in Web-SIG. As far as I know, they're planning to remove it from the spec in WSGI 2.0 (whenever that's published).

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

#19
post #17
post #9

Earlier quoted context omitted.

# 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.

They are both predated by: public class App extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/plain"); response.getWriter().println("Hello world"); } }

And that is predated by

    # hello.cgi
    print "Hello World\n";
I wasn't trying to claim WSGI is the first web server to application server interface. I was just showing Rack and WSGI are similar, and Rack was WSGI inspired.

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

#20
post #9
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…

# 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.

Rack was based on WSGI, however the point is valid since Pump is using an API closer to Rack than WSGI. Indeed, the Pump website states: "No fancy start_response or environ here."
Post reply on HN