This is what a +60k git diff gives Pythonistas this year
It was particularly challenging, the end result is worth it. A simple table replace a thousand words.
Comparison
----------
|Feature|niquests|requests|httpx|aiohttp|
|:-|:-|:-|:-|:-|
|`HTTP/1.1`|✅|✅|✅|✅|
|`HTTP/2`|✅|❌|✅|❌|
|`HTTP/3 over QUIC`|✅|❌|❌|❌|
|`Synchronous`|✅|✅|✅|❌|
|`Asynchronous`|✅|❌|✅|✅|
|`Thread Safe`|✅|✅|❌|*N/A*|
|`Task Safe`|✅|*N/A*|✅|✅|
|`OS Trust Store`|✅|❌|❌|❌|
|`Multiplexing`|✅|❌|*Limited*|❌|
|`DNSSEC`|✅|❌|❌|❌|
|`Customizable DNS Resolution`|✅|❌|❌|✅|
|`DNS over HTTPS`|✅|❌|❌|❌|
|`DNS over QUIC`|✅|❌|❌|❌|
|`DNS over TLS`|✅|❌|❌|❌|
|`Network Fine Tuning & Inspect`|✅|❌|*Limited*|*Limited*|
|`Certificate Revocation Protection`|✅|❌|❌|❌|
|`Session Persistence`|✅|✅|✅|✅|
|`In-memory Certificate CA & mTLS`|✅|❌|*Limited*|*Limited*|
|`SOCKS 4/5 Proxies`|✅|✅|✅|❌|
|`HTTP/HTTPS Proxies`|✅|✅|✅|✅|
|`TLS-in-TLS Support`|✅|✅|✅|✅|
|`Direct HTTP/3 Negocation`|✅|N/A|N/A|N/A|
|`Package / SLSA Signed`|✅|❌|❌|✅|
What My Project Does
--------------------
Gives an alternative in a limited HTTP clients world.
Target Audience
---------------
Made for the broader audience.
* Source: [https://github.com/jawah/niquests](https://github.com/jawah/niquests)
/r/Python
https://redd.it/1b2t6pd
It was particularly challenging, the end result is worth it. A simple table replace a thousand words.
Comparison
----------
|Feature|niquests|requests|httpx|aiohttp|
|:-|:-|:-|:-|:-|
|`HTTP/1.1`|✅|✅|✅|✅|
|`HTTP/2`|✅|❌|✅|❌|
|`HTTP/3 over QUIC`|✅|❌|❌|❌|
|`Synchronous`|✅|✅|✅|❌|
|`Asynchronous`|✅|❌|✅|✅|
|`Thread Safe`|✅|✅|❌|*N/A*|
|`Task Safe`|✅|*N/A*|✅|✅|
|`OS Trust Store`|✅|❌|❌|❌|
|`Multiplexing`|✅|❌|*Limited*|❌|
|`DNSSEC`|✅|❌|❌|❌|
|`Customizable DNS Resolution`|✅|❌|❌|✅|
|`DNS over HTTPS`|✅|❌|❌|❌|
|`DNS over QUIC`|✅|❌|❌|❌|
|`DNS over TLS`|✅|❌|❌|❌|
|`Network Fine Tuning & Inspect`|✅|❌|*Limited*|*Limited*|
|`Certificate Revocation Protection`|✅|❌|❌|❌|
|`Session Persistence`|✅|✅|✅|✅|
|`In-memory Certificate CA & mTLS`|✅|❌|*Limited*|*Limited*|
|`SOCKS 4/5 Proxies`|✅|✅|✅|❌|
|`HTTP/HTTPS Proxies`|✅|✅|✅|✅|
|`TLS-in-TLS Support`|✅|✅|✅|✅|
|`Direct HTTP/3 Negocation`|✅|N/A|N/A|N/A|
|`Package / SLSA Signed`|✅|❌|❌|✅|
What My Project Does
--------------------
Gives an alternative in a limited HTTP clients world.
Target Audience
---------------
Made for the broader audience.
* Source: [https://github.com/jawah/niquests](https://github.com/jawah/niquests)
/r/Python
https://redd.it/1b2t6pd
GitHub
GitHub - jawah/niquests: Drop-in replacement for Requests. Automatic HTTP/1.1, HTTP/2, and HTTP/3. WebSocket, and SSE included.
Drop-in replacement for Requests. Automatic HTTP/1.1, HTTP/2, and HTTP/3. WebSocket, and SSE included. - jawah/niquests
Handling databases in deployment
Dear community,
I have been learning python (from scratch) for the last three years by tinkering with Django and making different web-applications. Last week I actually did my first deployment on pythonanywhere and got everything to work fine.
When I update the app I do it locally, push to github and then to pythonanywhere. I also update the database locally and push it together with the code. But if I am to implement user accounts, I reason that the database has to be online and can't be altered locally anymore. What is a good practice for doing this? Do you use third party solutions - same as for static files?
​
/r/django
https://redd.it/1b2wnf4
Dear community,
I have been learning python (from scratch) for the last three years by tinkering with Django and making different web-applications. Last week I actually did my first deployment on pythonanywhere and got everything to work fine.
When I update the app I do it locally, push to github and then to pythonanywhere. I also update the database locally and push it together with the code. But if I am to implement user accounts, I reason that the database has to be online and can't be altered locally anymore. What is a good practice for doing this? Do you use third party solutions - same as for static files?
​
/r/django
https://redd.it/1b2wnf4
Reddit
From the django community on Reddit
Explore this post and more from the django community
Help Flask Socketio + uWSGI + Nginx
Hey.
I am trying to use flask-socketio on my uwsgi + nginx server.
I read ...ALOT... of documentation pages and tutorials. Maybe I just can't read or my braincells are not enough. But I just cant get it working. Okay first of all a bit about the structure.
I have multiple flask servers running behind the nginx.
Every Server gets a path. So mydomain.com/projectname
So my current "test" project is under mydomain.com/sockettoe (dont ask just not creative in naming)
The first problem was socketio (in js fronend) trys to connect on mydomain.com wich is not where the flask-socketio runs. I fixed that by adding this to my config
location /socket.io
{
include uwsgi_params
uwsgi_pass unix:/pathtoproject/sockettoe/sockettoe.sock;
}
Now the server get my requests buuut they dont seem to connect. Cant fire any event.
What I thought is that the uwsgi does not run socketio but app(Flask app) so I tryed to change that but uwsgi does not want to run a SocketIo object. Can someone help me with this you will save me alot of headache because I will not give up. It must be possible.
Oh also my backend gets a Exception:
/r/flask
https://redd.it/1b2wwls
Hey.
I am trying to use flask-socketio on my uwsgi + nginx server.
I read ...ALOT... of documentation pages and tutorials. Maybe I just can't read or my braincells are not enough. But I just cant get it working. Okay first of all a bit about the structure.
I have multiple flask servers running behind the nginx.
Every Server gets a path. So mydomain.com/projectname
So my current "test" project is under mydomain.com/sockettoe (dont ask just not creative in naming)
The first problem was socketio (in js fronend) trys to connect on mydomain.com wich is not where the flask-socketio runs. I fixed that by adding this to my config
location /socket.io
{
include uwsgi_params
uwsgi_pass unix:/pathtoproject/sockettoe/sockettoe.sock;
}
Now the server get my requests buuut they dont seem to connect. Cant fire any event.
What I thought is that the uwsgi does not run socketio but app(Flask app) so I tryed to change that but uwsgi does not want to run a SocketIo object. Can someone help me with this you will save me alot of headache because I will not give up. It must be possible.
Oh also my backend gets a Exception:
/r/flask
https://redd.it/1b2wwls
pyCage: A VSCode extension to search and install popular Python packages from the command palette.
What Does My Project Do?
pyCage is a VSCode extension powered by astral.sh's uv package manager and pip. It enables users to search for and download Python packages directly from the command palette, similar to Dart's package manager.
Target Audience
This extension is designed for individuals who frequently use venvs and struggle with remembering package names.
Comparison
The installation speed is notably fast due to the option to download using uv.It might be faster to download packages using pyCage than using the terminal in some cases.
GitHub
GitHub Link: https://github.com/qKitNp/pyCage
/r/Python
https://redd.it/1b32suc
What Does My Project Do?
pyCage is a VSCode extension powered by astral.sh's uv package manager and pip. It enables users to search for and download Python packages directly from the command palette, similar to Dart's package manager.
Target Audience
This extension is designed for individuals who frequently use venvs and struggle with remembering package names.
Comparison
The installation speed is notably fast due to the option to download using uv.It might be faster to download packages using pyCage than using the terminal in some cases.
GitHub
GitHub Link: https://github.com/qKitNp/pyCage
/r/Python
https://redd.it/1b32suc
Visualstudio
pyCage - Visual Studio Marketplace
Extension for Visual Studio Code - Fastest Python package manager for Visual Studio Code powered by uv by astral.sh
How to handle APIs calls and async code on Pythonanyehere?
How to handle async code on Pythonanyehere? There is an article on their site that suggests using Django-Q and always-on tasks to handle async code, but the post seems outdated because Django-Q hasn't received any updates/changes for 3 years. Also, celery and redis are not supported I guess.
Do you have any suggestions on how to handle async code like calling APIs?
Thank you in advance.
/r/django
https://redd.it/1b2zc3o
How to handle async code on Pythonanyehere? There is an article on their site that suggests using Django-Q and always-on tasks to handle async code, but the post seems outdated because Django-Q hasn't received any updates/changes for 3 years. Also, celery and redis are not supported I guess.
Do you have any suggestions on how to handle async code like calling APIs?
Thank you in advance.
/r/django
https://redd.it/1b2zc3o
Reddit
From the django community on Reddit
Explore this post and more from the django community
Ruff 0.3.0 - first stable version of ruff formatter
Blog - https://astral.sh/blog/ruff-v0.3.0
Changes:
\- The Ruff 2024.2 style guide
\- Range Formatting
\- f-string placeholder formatting
\- Lint for invalid formatter suppression comments
\- Multiple new rules - both stable and in preview
/r/Python
https://redd.it/1b36z60
Blog - https://astral.sh/blog/ruff-v0.3.0
Changes:
\- The Ruff 2024.2 style guide
\- Range Formatting
\- f-string placeholder formatting
\- Lint for invalid formatter suppression comments
\- Multiple new rules - both stable and in preview
/r/Python
https://redd.it/1b36z60
astral.sh
Ruff v0.3.0
The next stable version of Ruff is out now.
Real time platform
Hi guys I’m really looking for some advice! I’m working on a project nd I’m still developing it like 70% is done. I still have some questions :
Is the django authentication system decent to secure the data of my clients : password, emails, pictures, documents…
/r/django
https://redd.it/1b35skw
Hi guys I’m really looking for some advice! I’m working on a project nd I’m still developing it like 70% is done. I still have some questions :
Is the django authentication system decent to secure the data of my clients : password, emails, pictures, documents…
/r/django
https://redd.it/1b35skw
Reddit
From the django community on Reddit
Explore this post and more from the django community
New python library for ELT
PyAirbyte just released to public beta - just tried it out, super easy to use and very pythonic. Is there anything else out there like this?
/r/Python
https://redd.it/1b36wde
PyAirbyte just released to public beta - just tried it out, super easy to use and very pythonic. Is there anything else out there like this?
/r/Python
https://redd.it/1b36wde
Airbyte
Using PyAirbyte | Airbyte Documentation
PyAirbyte brings the power of Airbyte to every Python and AI developer.
Single commodity trading platform
I am looking at developing a trading platform that services a single commodity. Initially I want to keep as light weight as possible. It would only need to service the basic needs for transactions between two parties that want to trade. Is flask a good option?
I am fairly new to flask, but it appeals to me as it seems to be relatively lightweight compared to something like Django. I find some frameworks are far too feature rich, especially when you want something basic. I just want to be sure that flask isn’t too feature poor?
Any advice on this would be greatly appreciated.
/r/flask
https://redd.it/1b3hlx8
I am looking at developing a trading platform that services a single commodity. Initially I want to keep as light weight as possible. It would only need to service the basic needs for transactions between two parties that want to trade. Is flask a good option?
I am fairly new to flask, but it appeals to me as it seems to be relatively lightweight compared to something like Django. I find some frameworks are far too feature rich, especially when you want something basic. I just want to be sure that flask isn’t too feature poor?
Any advice on this would be greatly appreciated.
/r/flask
https://redd.it/1b3hlx8
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Django-admin-shellx - A terminal in your admin using xtermjs
Hey,
I built an Django app that adds a terminal using xterm.js to the admin.
It uses websockets with Django channels and xterm.js for the terminal.
Has multiple features as full screen mode, favorite commands, recording of actions and history of commands among others.
Here is the GitHub link:
https://github.com/adinhodovic/django-admin-shellx
Thanks for taking a look!
/r/django
https://redd.it/1b3edif
Hey,
I built an Django app that adds a terminal using xterm.js to the admin.
It uses websockets with Django channels and xterm.js for the terminal.
Has multiple features as full screen mode, favorite commands, recording of actions and history of commands among others.
Here is the GitHub link:
https://github.com/adinhodovic/django-admin-shellx
Thanks for taking a look!
/r/django
https://redd.it/1b3edif
GitHub
GitHub - adinhodovic/django-admin-shellx: A Django Admin Web Shell using Xterm.js and Django Channels.
A Django Admin Web Shell using Xterm.js and Django Channels. - adinhodovic/django-admin-shellx
Why won't IPython allow more than one line in a function def? Drops me back to the prompt after one line.
https://pastebin.com/EGZqu512
/r/IPython
https://redd.it/1b3bz60
https://pastebin.com/EGZqu512
/r/IPython
https://redd.it/1b3bz60
Pastebin
zzyzx@eyearesee:~/p/numpy$ uname -aLinux eyearesee 5.15.0-73-generic #80-Ubunt - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Gunicorn and Nginx
I understand that Gunicorn with sync workers likes to be deployed behind an Nginx proxy. The limit of my knowledge of this matter is because Gunicorn is susceptible to DDOS attacks and Nginx isn't (as much). (Also SSL, routing etc etc).
What I don't understand is why Gunicorn is susceptible and why Nginx is less. And, why Nginx proxy traffic to Gunicorn is better than the traffic just hitting Gunicorn.
I also understand buffering comes into play. I understand this as Gunicorn can respond quickly back to Nginx and Nginx and deal with the faff of getting the response back to the client. What other benefits are these in this configuration?
/r/django
https://redd.it/1b3gf1a
I understand that Gunicorn with sync workers likes to be deployed behind an Nginx proxy. The limit of my knowledge of this matter is because Gunicorn is susceptible to DDOS attacks and Nginx isn't (as much). (Also SSL, routing etc etc).
What I don't understand is why Gunicorn is susceptible and why Nginx is less. And, why Nginx proxy traffic to Gunicorn is better than the traffic just hitting Gunicorn.
I also understand buffering comes into play. I understand this as Gunicorn can respond quickly back to Nginx and Nginx and deal with the faff of getting the response back to the client. What other benefits are these in this configuration?
/r/django
https://redd.it/1b3gf1a
Reddit
From the django community on Reddit
Explore this post and more from the django community
Friday Daily Thread: r/Python Meta and Free-Talk Fridays
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1b3frba
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1b3frba
Redditinc
Reddit Rules
Reddit Rules - Reddit
Hiding Flash Message
Hi all, I didn't like the way the default flash message looked so just learned how to grab the message with html and style it, but now I have the default flash message and the custom ones. Is there a way to turn off the default?
https://preview.redd.it/avn2cbfrknlc1.png?width=1424&format=png&auto=webp&s=d969e7c0e4cc379888a381615b669add8e3fca2b
/r/flask
https://redd.it/1b3lrj5
Hi all, I didn't like the way the default flash message looked so just learned how to grab the message with html and style it, but now I have the default flash message and the custom ones. Is there a way to turn off the default?
https://preview.redd.it/avn2cbfrknlc1.png?width=1424&format=png&auto=webp&s=d969e7c0e4cc379888a381615b669add8e3fca2b
/r/flask
https://redd.it/1b3lrj5
Use Firebase with Tkinter (Free Database & Authentication)
Hey, heres a tutorial I made that shows how to use Firebase with Tkinter to create a simple application that has authentication and which uses the Firestore database: https://youtu.be/hxuiRPUJMwU?si=QF0zevMvOmq6BN1K
Using Firebase is much easier than setting up your own backend and you can start using it for free!
/r/Python
https://redd.it/1b3mkk3
Hey, heres a tutorial I made that shows how to use Firebase with Tkinter to create a simple application that has authentication and which uses the Firestore database: https://youtu.be/hxuiRPUJMwU?si=QF0zevMvOmq6BN1K
Using Firebase is much easier than setting up your own backend and you can start using it for free!
/r/Python
https://redd.it/1b3mkk3
YouTube
Use Firebase with Tkinter (Free Database & Authentication)
Have a Tkinter application but don't want to have to code and host your own backend? In this video we take a look at how to use Tkinter with Firebase, a service that provides free authentication and databases. We go through an example project where the UI…
CPU barely reaches 6%
I have been working on a django project, and noticed that even if I bombard my server with requests, the CPU usage never crosses 6%.
My requests take around 300ms, with total 16 gunicorn worker.
But when I spam requests, the response time increases exponentially. I figured that requests were getting queued by gunicorn, but cpu usage never crosses 6%.
Am I missing something?
/r/django
https://redd.it/1b3j4ys
I have been working on a django project, and noticed that even if I bombard my server with requests, the CPU usage never crosses 6%.
My requests take around 300ms, with total 16 gunicorn worker.
But when I spam requests, the response time increases exponentially. I figured that requests were getting queued by gunicorn, but cpu usage never crosses 6%.
Am I missing something?
/r/django
https://redd.it/1b3j4ys
Reddit
From the django community on Reddit
Explore this post and more from the django community
Python zrok SDK - Crazy sssimple, crazy sssecure peer-to-peer ingressss for your applicationsss.
Last year, we released zrok, an open-source sharing platform built on top of OpenZiti - think, an alternative to Ngrok, Tailscale Funnel, and others. It makes sharing resources like HTTP servers, TCP and UDP tunnels, and files simple, fast, and secure.
We have now released a Python SDK so that a simple, secure sharing model for sharing can be extended to work for your custom tools and applications as part of your binary. Read more on our blog - https://blog.openziti.io/the-python-zrok-sdk. We have included an example enabled using flask and waitress.
We also have a zrok SDK for Golang. Support for other languages is forthcoming. If you'd like to express interest in having the zrok SDK support other languages, contact us on our Discourse.
If you like zrok and want to support its continued development, please drop a star on our repository on GitHub; it means a lot to us.
/r/flask
https://redd.it/1b3qss1
Last year, we released zrok, an open-source sharing platform built on top of OpenZiti - think, an alternative to Ngrok, Tailscale Funnel, and others. It makes sharing resources like HTTP servers, TCP and UDP tunnels, and files simple, fast, and secure.
We have now released a Python SDK so that a simple, secure sharing model for sharing can be extended to work for your custom tools and applications as part of your binary. Read more on our blog - https://blog.openziti.io/the-python-zrok-sdk. We have included an example enabled using flask and waitress.
We also have a zrok SDK for Golang. Support for other languages is forthcoming. If you'd like to express interest in having the zrok SDK support other languages, contact us on our Discourse.
If you like zrok and want to support its continued development, please drop a star on our repository on GitHub; it means a lot to us.
/r/flask
https://redd.it/1b3qss1
OpenZiti Tech Blog
The Python zrok SDK
Crazy sssimple, crazy sssecure peer-to-peer ingressss for your applicationsss.
How to connect flask_sqlalchemy to existing postgres tables
I've written a Flask project and used psycopg to work with the database. Can I connect to an existing database via Flask-SQLAlchemy somehow?
/r/flask
https://redd.it/1b3rd6d
I've written a Flask project and used psycopg to work with the database. Can I connect to an existing database via Flask-SQLAlchemy somehow?
/r/flask
https://redd.it/1b3rd6d
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Can I plot postcodes onto a map?
Hi all,
I have a list of postcodes in a format like so:
PostCode
AL1
DE56
G2
BS7
E2
IP12
IP12
LL77
RM4
RM4
NP12
W41
CF11
PH14
So they are only the first half, is there anyway for me to plot my list of postcodes onto a map of the uk?
/r/Python
https://redd.it/1b3rpmx
Hi all,
I have a list of postcodes in a format like so:
PostCode
AL1
DE56
G2
BS7
E2
IP12
IP12
LL77
RM4
RM4
NP12
W41
CF11
PH14
So they are only the first half, is there anyway for me to plot my list of postcodes onto a map of the uk?
/r/Python
https://redd.it/1b3rpmx
Reddit
From the Python community on Reddit
Explore this post and more from the Python community