
Show HN: Ice – WSGI microframework to develop small web applications in Python - icepy
https://icepy.readthedocs.io/en/latest/tutorial.html
======
_ix
This looks like a whole lot of work for a 0.0.1 release so I must ask... why
might I choose Ice over Flask?

~~~
sametmax
Even more: why WSGI ?

We need a django of the async world. We need something in Python to compete
with nodejs, or even meteor, with async/await as primary tool. And maybe a
aWSGI support.

But WSGI ? We have everything we need. They are proven tools. They work. Have
great ecosystems and documentations. They do the job perfectly for non real
time oriented web site. We don't need another one.

~~~
mephitix
Seen Sanic[1] yet? I've become a fan... works well with asyncpg[2] too.

[1]:
[https://github.com/channelcat/sanic](https://github.com/channelcat/sanic)

[2]:
[https://github.com/MagicStack/asyncpg](https://github.com/MagicStack/asyncpg)

~~~
sametmax
It's very limited. We are far, far away from what django or meteor can
provide. The API, while using async, is kinda old school (no plugins,
namespaces, conf hooks...) and low level for some stuff (where is my task
queue ?), and yet too high level for others (you give up control of the even
loop policy completely).

It's a nice attempt, but it's barely a draft IMO.

~~~
eric_bullington
When did you last use sanic? It's far from limited, and advancing quickly.
However, it's a microframework, so it's true that you'll not get a full
Django-like experience (and Meteor isn't even in the same class of web
framework as Django or microframeworks like Sanic, so there's nothing to
compare there either).

But with respect to microframeworks, Sanic is getting pretty close to feature
parity with Flask, only asynchronously. I'm not sure what kind of plugin
architecture you're looking for, but you can do middleware with Sanic. Also
custom protocols. Also decorators (e.g., for auth). And for namespacing, there
are blueprints. I'm not sure what you mean by "conf hooks".

It does help with Sanic if you're already familiar with Flask. Sanic is very
close to an async version of Flask.

For a task queue, you can run async tasks with Sanic alone using
`app.add_task(some_async_function)`.

It's also simple to use apscheduler if you want a more full-feature async
scheduler. Example:

    
    
        from apscheduler.schedulers.asyncio import AsyncIOScheduler
        from sanic import Sanic
    
        app = Sanic()
    
        async def tick():
            print('Work!')
    
        @app.listener('before_server_start')
        async def initialize_scheduler(app, loop):
            scheduler = AsyncIOScheduler({'event_loop': loop})
            scheduler.add_job(tick, 'interval', seconds=1)
            scheduler.start()
    
        if __name__ == "__main__":
            app.run(host="0.0.0.0", port=8000, debug=True)
    

Finally, unless things have changed, you should be able to set event loop
policy with `asyncio.set_event_loop_policy`, have you tried it?

------
Animats
The minimal implementation for the application side in Python is "flipflop".
It calls your function, and you return a HTML string as a result. That's
enough to hook up a Python program as a web server.

Anything beyond that, such as input data parsing or generating HTML from a
template or tree, should be a library, not a "framework". You might want
multiple libraries from different sources.

~~~
sametmax
It seems the entire Python community disagree, and made the monolithic Django
the most popular framework. No the minimalist flask. Not the very composable
pyramid.

Django.

And the reasons for that are:

\- choosing tools takes time and resources. \- integrating them takes time and
resources.

\- keep up to update the stack so it works well together takes time and
resources.

\- multiple tools mean multiple docs.

\- you need to train your newcomers to your whole whole stack.

\- when you change project, you have to learn a new stack.

\- multiple tools won't be nearly as well integrated or full featured than the
big framework. Have you tried flask-admin ? It's very far away from django-
admin.

\- ecosystems build on common grounds. They assume they have tools,
configurations, conventions. If you just use anything and everything, no third
party tool car easily fit in your stack. E.G: django has a lot of nice libs
around authentication because 3rd parties can rely on having a central User
model. It's terribly unperfect, but it's really productive.

\- JS has this philosophy, and it's a terrible horrible no good messy pain.

~~~
seanp2k2
Express has way more devs than all of the Python frameworks combined. JS is
past, present, and future. This is what the job market looks like:
[https://www.dynatrace.com/blog/node-js-is-hitting-the-big-
ti...](https://www.dynatrace.com/blog/node-js-is-hitting-the-big-time-in-
enterprise-markets/)

On npm, expesss had _538,945 downloads in the last day_
[https://www.npmjs.com/package/express](https://www.npmjs.com/package/express)

[http://blog.builtinnode.com/post/most-installed-packages-
acc...](http://blog.builtinnode.com/post/most-installed-packages-according-to-
npm) "Express is a very popular package with 160,809,503 downloads so far. It
has a very steady growth, peaking in March with a little over 12 million
downloads."

Express was released November 16, 2010; Django was released July 21st 2005.

[https://trends.builtwith.com/framework](https://trends.builtwith.com/framework)
shows PHP with 53 million sites, Express with 217K, and Django right under
Visual Studio (wat) and ColdFusion with 59k.

It really depends on what you're trying to do. Because so many JS frameworks
for the browser integrate so nicely with Node, you can use stuff like Axios on
both ends and only learn one API. Meteor is even nicer in this (write models
once and use on both ends).

~~~
foo101
I think both integrated monolithic framework as well as microframework +
library based web development have their place in software development. Most
of my career, I have seen Flask to be popular wherever I worked, but I am well
aware that Django is the most popular Python web development framework out
there. It shows that there are all kinds of developers with their own
preferences. Therefore both kinds of web development would remain popular.

There is no one way framework or paradigm that can be the past, present and
future. There are always multiple of them.

~~~
sametmax
That's fair.

------
legostormtroopr
Why invent a new string matching format, instead of just using regular
expressions?

~~~
sametmax
They allow regular expression.

But having use Django's regex matching a lot, and the one provided with
werkzeug, I can tell you the second one is much more productive: 99% of the
case you don't need a complex pattern and you are very happy to be able to
just say "hey gime 'stuff' here" instead of crafting things like
"(?P<stuff>\d+)" . For the rare use case, you just fall back on regexes.

