| The last serious Python I wrote was 2.7 (I narrowly avoided the python3 migration fun) about 5 or 6 years ago. I’m picking it back up, but I’m having trouble sifting through the current state of the art. - Which typing library do folks use? - Is Django still the best? - What do you use for servers? Gunicorn? - Any improvements with the interpreter to make it more reloadable? - Is Celery still a thing or do you just use Lambda? - What’s ideal for deploying Python? Ec2 and some Ansible? App engine? Something else? - How about writing APIs? GraphQL? - How about parallelism? Multi processing and futures for concurrency? - What’s the async story? What should I be looking at for async web frameworks? - Numpy still great? Sci py? Thank you in advance! |
- MyPy is a great (fine, decent) library for typing, but even without it, the type hints in newer python versions and typing standard library are super powerful. Not “rust” levels of powerful but at least on par with typescript
- Django is still excellent and now supports async views via asgi. Outside of async, django+DRF+djoser are an excellent choice for a backend. If you really like typing and cool, smaller frameworks, Starlette and the derivative FastAPI frameworks are a lot of fun. Any of those options are great for a web app backend these days
- Gunicorn is still easier to configure. UWSGI is also still around. Both are well supported - Django run server has gotten better about reloads, but it’s still not as good as node’s offerings
- asyncio has taken a bite out of celery (heh) but celery is still common and useful for deferred tasks
- I think dockerizing the app is the way to go these days. There’s just too many odd system dependencies and python compilation differences to deploy directly to an EC2 instance. Digital Ocean’s app platform or AWS Amplify (or EBS) make deploying a container image decently easy. And if youre willing to take the plunge into Kubernetes, I find it has many python-specific advantages (eg horizontal scaling to avoid pYtHOn DOesNt sCaLE” nonsense) at the cost of a tremendous learning curve. If you do end up going for a non-containerized deployment, infrastructure as code is big now, so both terraform and ansible might be your friends
- graphQL support is bad. I think Graphene (Django) is the best you’ll find. DRF being decent is one of the reasons I generally stick to REST if I can help it
- Asyncio has come a long way but still has issues with non-async codes (eg it’s hard to make a sync request or access a DB in an async block)
- Tornado was the initial async bad boy and is still around, but again FastAPI is doing some really cool stuff in async
- For data science, pandas is pretty universal but it plays very nicely with numpy. If you haven’t kept up with Tensorflow or PyTorch, you’ll be astounded by how far ML has come