Live data from Hacker News

Flask 2.0.0 has been merged into master

github.com

31–40 of 55 posts

Re: Flask 2.0.0 has been merged into master

#31

> Drop support for Python 2 Python 3 released on '08. Flask debuted a couple of years later in 2010, on Python 2. 11.5 years later Python 2 is nearly in the rearview. The history of the Python 3 release is surely an impressive one. On a more related note, props to devs/contributors for this release. My experience with Flask was pop-up projects and never mission critical, but i always found it a joy to use and quite i…

You would be surprised by the amount of mission-critical code which runs on Flask.

Flask is a great library which gets out of your way - I find it a joy to use compared to Django.

Although there are some dark sides, particularly with how Flask interacts with Werkzeug during exceptions when you need CORS (for example, we can't overwrite exception page's Access-Control-Allow-Origin headers with @app.after_request since these headers are set by Werkzeug and can't be overwritten in Flask).

This prevents us from levering Flask's default except handler in certain environments which require custom headers for exception handling page.

Re: Flask 2.0.0 has been merged into master

#32
post #21
post #6

Earlier quoted context omitted.

I've moved most of my Flask projects to Express and NodeJS. Flask was just a PITA to deploy properly in a way that it could handle lots of concurrent connections without a massive memory footprint, and async in Python is a mess. The JS ecosystem has on the other hand moved to async and Promises as the standand/default way to implement things, which makes things much easier. Express middleware is also just easier to w…

> and async in Python is a mess I’ve heard this a lot of late, but it’s not clear to me why. Would you be willing to expand on your assertion? Personally, I’ve written a fair chunk of typescript and asyncio based Python over the year for a project and in general I think Python has done an excellent job of their implementation. Some things are annoying; for example I’ve a consistent case, which I haven’t pared down to…

The main problem is that many Python libraries come in only sync flavor and using them together with asyncio is a pain.

NodeJS libraries are almost all standardized to async now. Hell, even Tensorflow.js can give you Promises of computation results.

Re: Flask 2.0.0 has been merged into master

#33

Earlier quoted context omitted.

At the very bottom: "Add type hinting." I love that this happens to larger libraries now. It doesn't need to be 100% complete, but it will still improve many devs' lives. I hope it will become the default for new projects and major updates.

How Steve Wozniak wrote anything by paper, much less BASIC for the Apple I, is beyond me... He and his kind are in a different reality

Writing code by hand isn't too bad, especially with a good language like LISP. I don't think it requires too much extra effort, just more attention and care as to not make syntax mistakes. With near-instant compile times and auto-linting, we sort of lose the ability to auto-vet code before inputting it.

Re: Flask 2.0.0 has been merged into master

#34

Earlier quoted context omitted.

At the very bottom: "Add type hinting." I love that this happens to larger libraries now. It doesn't need to be 100% complete, but it will still improve many devs' lives. I hope it will become the default for new projects and major updates.

How Steve Wozniak wrote anything by paper, much less BASIC for the Apple I, is beyond me... He and his kind are in a different reality

The scope is much more limited in his case. When the problem space is super narrow and the base language is your whole environment, writing correct code in a big batch is not that hard. On the other hand, dealing with flask and basically the whole stack of everything web at the same time is a different kind of challenge.

Re: Flask 2.0.0 has been merged into master

#35

I have moved most of my stuff to FastAPI. It’s so much more enjoyable than flask. https://fastapi.tiangolo.com/

No one ever lists the features I really want. Like, will I understand it 6 months after I wrote it. And do the stack traces point to exactly what went wrong. I generally find any framework that's easy to get started is harder to maintain.

Re: Flask 2.0.0 has been merged into master

#36

> Drop support for Python 2 Python 3 released on '08. Flask debuted a couple of years later in 2010, on Python 2. 11.5 years later Python 2 is nearly in the rearview. The history of the Python 3 release is surely an impressive one. On a more related note, props to devs/contributors for this release. My experience with Flask was pop-up projects and never mission critical, but i always found it a joy to use and quite i…

You would be surprised by the amount of mission-critical code which runs on Flask. Flask is a great library which gets out of your way - I find it a joy to use compared to Django. Although there are some dark sides, particularly with how Flask interacts with Werkzeug during exceptions when you need CORS (for example, we can't overwrite exception page's Access-Control-Allow-Origin headers with @app.after_request since…

> Flask is a great library which gets out of your way - I find it a joy to use compared to Django.

Agreed. I found Flask after being really annoyed with learning Django. Flask + Heroku is an awesome combo for the hobbyist like myself.

Re: Flask 2.0.0 has been merged into master

#37
post #6

I have moved most of my stuff to FastAPI. It’s so much more enjoyable than flask. https://fastapi.tiangolo.com/

I've moved most of my Flask projects to Express and NodeJS. Flask was just a PITA to deploy properly in a way that it could handle lots of concurrent connections without a massive memory footprint, and async in Python is a mess. The JS ecosystem has on the other hand moved to async and Promises as the standand/default way to implement things, which makes things much easier. Express middleware is also just easier to w…

If you only need 10.000 concurrent users it's pretty easy to do that with threads and gunicorn or uwsgi.

The memory footprint shouldn't be bad, just one page per user.

Re: Flask 2.0.0 has been merged into master

#38

I have moved most of my stuff to FastAPI. It’s so much more enjoyable than flask. https://fastapi.tiangolo.com/

Both frameworks can coexist in the same codebase if you use the WSGIMiddleware module [0]. It's a bit easier to get it running with Flask than with Django. The issue with Django is getting the static assets to work. The easiest way I've found is to run collectstatic in Django and serve the output folder through FastAPI.

[0] https://fastapi.tiangolo.com/advanced/wsgi/

Re: Flask 2.0.0 has been merged into master

#39
post #32
post #21

Earlier quoted context omitted.

> and async in Python is a mess I’ve heard this a lot of late, but it’s not clear to me why. Would you be willing to expand on your assertion? Personally, I’ve written a fair chunk of typescript and asyncio based Python over the year for a project and in general I think Python has done an excellent job of their implementation. Some things are annoying; for example I’ve a consistent case, which I haven’t pared down to…

The main problem is that many Python libraries come in only sync flavor and using them together with asyncio is a pain. NodeJS libraries are almost all standardized to async now. Hell, even Tensorflow.js can give you Promises of computation results.

Seems pretty painless to me:

    $ python3 -m asyncio
    >>> from requests import get
    >>> url = 'https://example.com'
    >>> response = await asyncio.to_thread(get, url)
A lot of Python libraries now offer async APIs, have async support on their short term roadmaps, or other async projects have replaced them.

Re: Flask 2.0.0 has been merged into master

#40
> Add route decorators for common HTTP methods. For example, @app.post("/login") is a shortcut for @app.route("/login", methods=["POST"]). #3907

Why? By default, it’s GET if you don’t specify a method. But now with this change, for special routes such as “/login” it’s POST. IMO these kinds of things make for “gotcha” moments. Just keep defaults simple without special exceptions.

Post reply on HN