8 ms·
Flask 2.0
- endisneigh 5y agoI'm surprised that it doesn't support Python 3.5. I've been a bit out of touch with Python - is there something that changed significantly in subsequent versions to justify this?
- 1f60c 5y ago3.5 has been EOL for 8 months now. (Source: https://endoflife.date/python https://endoflife.date/python) I’m guessing they want to tell people it’s time to upgrade. And 3.6 brings a lot of niceties that they might want to use, like f-strings.
- kstrauser 5y agoThat’s what I’ve done on personal projects. The benefits of dropping support for the old version are large enough to outweigh the tiny drawbacks of not supporting it.
- skvark 5y agoMany projects are dropping support for old Python versions very fast. It's not surprising given the history of the Python 2 -> 3 transition. No one wants to end up in that situation anymore. For example, NumPy has already dropped 3.6 support (3.6 will be EOL later this year).
- remram 5y agoI don't know about "very fast", Python 3.6 was released in 2016 giving people plenty of time to update from 3.5. Those are backward-compatible too. If you haven't updated in that time, you probably have a systemic problem which shouldn't be blamed on Python moving too fast (in fact I suspect those people don't keep up with bugfixes either, so nudging them to upgrade when they try to update flask/numpy is a good idea).
- deleted 5y ago[deleted]
- matusf 5y agoPython 3.6 added f-strings which are rather popular and they cause syntax error in previous versions of Python.
- nicolaslem 5y agoPython 3.5 is end of life, as it doesn't receive security fixes anymore no one should really use it for production. I imagine that removing it from the supported versions in Flask allows for example to use f-strings.
- yuy910616 5y ago3.6 had a couple of big improvement - f strings, annotation, and if I'm not mistaking, the devs did something to improve the dictionaries; from 3.6 on dicts are ordered. I don't know too much about it but raymond hettinger gave a talk about it. https://www.youtube.com/watch?v=p33CVV29OG8 https://www.youtube.com/watch?v=p33CVV29OG8
- TkTech 5y ago-
- orf 5y agoOrdering was stable within a process (and within a given PYTHONHASHSEED value), but not stable across processes. They are now insertion ordered.
- TkTech 5y agoThank you for the clarification :)
- deleted 5y ago[deleted]
- morvita 5y agoOrder-preserving dicts were added as a side effect of an optimization in CPython 3.6 [0]. They were considered an implementation detail of CPython in 3.6, it wasn't until Python 3.7 that is was declared an official part of the language [1]. [0] https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-compactdict https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-compa... [1] https://mail.python.org/pipermail/python-dev/2017-December/151283.html https://mail.python.org/pipermail/python-dev/2017-December/1...
- ehsankia 5y agoConsidering the last item in the changelog is: - Add type hinting. https://github.com/pallets/flask/pull/3973 https://github.com/pallets/flask/pull/3973 I think it's fair to assume annotations is the big reason.
- morvita 5y agoPython 3.5 was declared end of life in September 2020, so it makes sense for library developers to drop support for it as well. Something like Flask 2.0 may work in Python 3.5 (I haven't tested it myself), but it isn't worth the developers' time to guarantee that support for a language version getting no support upstream. https://www.python.org/downloads/release/python-3510/ https://www.python.org/downloads/release/python-3510/
- formerly_proven 5y agohttps://www.python.org/dev/peps/pep-0478/ https://www.python.org/dev/peps/pep-0478/
- bredren 5y agoFlask's creator, Armin Ronacher, was asked on the Real Python podcast in July 2020 what specifically he would have done differently. He said he under appreciated how big the community would get but also the number of people who would use it. He faulted himself for not spending time thinking about the transition from him primarily working on it to others. And that he should have been thinking about how things would work when he was not involved. The specific item he was concerned about was that he did not work to build a "community of like minded people" which he says Django did a much better job at doing. At the very end of the comment, he openly considers if there are things he should have done differently: "I probably would feel less detached from it if I would have communicated some of my ideas more. I feel like it is no longer my fight to make it more backwards compatible for instance. The community sees this differently than I do, so that's fine." https://realpython.com/podcasts/rpp/58/#t=1202 https://realpython.com/podcasts/rpp/58/#t=1202
- nijave 5y agoAfaik the Python foundation supports the current and 3 previous Python releases and many developers track CPython interpreter support. Can't find a link to n+3, though (Current is 3.9 so 8,7,6 are also supported)
- tusharsadhwani 5y agoThe biggest reason of all would be that 3.5 is already end of life :)
- colpabar 5y agoprevious discussion https://news.ycombinator.com/item?id=27125200 https://news.ycombinator.com/item?id=27125200
- krat0sprakhar 5y agoSincere question - for starting greenfield projects, what would make you choose Flask over FastAPI[0]? [0] - https://fastapi.tiangolo.com/ https://fastapi.tiangolo.com/
- easton 5y agoFlask has built in templating via Jinja2, FastAPI makes you hook up the templating library you want yourself. Not a big deal (I think it is literally like five lines or something) but if you are building a normal web app without a bunch of AJAX or a SPA on the frontend that might be relevant.
- ddorian43 5y agoFlask supports gevent.
- minimaxir 5y agoNote that Flask is more analogous to Starlette, which FastAPI extends. https://www.starlette.io/ https://www.starlette.io/
- qbasic_forever 5y agoI'd start with the higher level question, do I want a production Python deployment and all the headaches of deploying, managing, scaling, etc. that come with it? There are some fantastic things in the Python ecosystem that might make it worth going down that route. But if you're just chucking some templates at the results of basic CRUD API operations or simple business logic, etc. you might not need those headaches. IMHO go with whatever one you know and don't depend too much on any special features or framework-specific things that aren't critical. You're likely going to throw away and rewrite whatever you produce many times throughout its lifetime if it gets some legs and grows.
- glutamate 5y ago> production Python deployment and all the headaches of deploying, managing, scaling You seem to be suggesting that there is a much simpler / better alternative. What is it?
- dan_quixote 5y agoCan anyone surmise if the flask type hinting is vulnerable to annotations issue that pydantic/fastapi recently faced? https://github.com/samuelcolvin/pydantic/issues/2678 https://github.com/samuelcolvin/pydantic/issues/2678
- detaro 5y agoPydantic evaluates annotations from other code. Flask just got annotations added to its API. very different things.
- icegreentea2 5y agoI don't think so. From what I can see, Flask isn't using type annotations to drive any runtime behaviors.
- milliams 5y agoI don't think so. Pydantic and co. were using the annotation system in a quite in-depth way to generate their special classes. Flask just seems to be using type annotations like any other Python library would.
- memco 5y agoCan someone comment on the benefits these changes have? Is it faster, more memory efficient, etc.? The change log has a lot of the technical minutiae of how I would need to change the way I use some things, but not the why.