Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
PySide6 + Nuitka is very impressive (some numbers and feedback inside)

In preparation for releasing a new version of Flowkeeper I decided to try replacing PyInstaller with Nuitka. My main complaint about PyInstaller was that I could never make it work with MS Defender, but that's a topic for another time.

I've never complained about the size of the binaries that PyInstaller generated. Given that it had to bundle Python 3 and Qt 6, \~100MB looked reasonable. So you can imagine how surprised I was when instead of spitting out a usual 77MB for a standalone / portable Windows exe file it produced... a 39MB one! It is twice smaller, seemingly because Nuitka's genius C compiler / linker could shed unused Qt code so well.

Flowkeeper is a Qt Widgets app, and apart from typical QtCore, QtGui and QtWidgets it uses QtMultimedia, QtChart, QtNetwork, QtWebSockets and some other modules from PySide6_Addons. It also uses Fernet cryptography package, which in turn bundles hazmat. Finally, it includes a 10MB mp3 file, as well as \~2MB of images and fonts as resources. So all of that fits into a single self-contained 40MB exe file, which I find mighty impressive, especially if you start comparing it against Electron. Oh yes, and that's with the latest stable Python

/r/Python
https://redd.it/1je94cf
R Jagged Flash Attention Optimization

Meta researchers have introduced Jagged Flash Attention, a novel technique that significantly enhances the performance and scalability of large-scale recommendation systems. By combining jagged tensors with flash attention, this innovation achieves up to 9× speedup and 22× memory reduction compared to dense attention, outperforming even dense flash attention with 3× speedup and 53% better memory efficiency.


Read the full paper write up here: https://www.shaped.ai/blog/jagged-flash-attention-optimization

/r/MachineLearning
https://redd.it/1je93sv
Python Quirks I Secretly Like

Hi there,

I’ve always wanted to create YouTube content about programming languages, but I’ve been self-conscious about my voice (and mic, lol). Recently, I made a pilot video on the Zig programming language, and afterward, I met a friend here on Reddit, u/tokisuno, who has a great voice and offered to do the voiceovers.

So, we’ve put together a video on Python — I hope you’ll like it:

https://www.youtube.com/watch?v=DZtdkZV6hYM

/r/Python
https://redd.it/1je98cv
Hypercorn VS Uvicorn VS Daphne+Gunicorn? (Behind Nginx)

Hi folks,

I have a setup with Websockets (HTMX and older code) that I'm progressively dumping for Server Sent events with HTMX.

One thing I realized when starting to use SSE is that the http/1.1 protocol seems to limit the number of open connections, so after i open a couple tabs, nothing loads in the newer tabs until I close the first ones. Using runserver in developement made me chase that bug for 2 days.

By using an http/2 compatible server like hypercorn, I was able to get rid of the issue.

Now, for production... I'm behind Nginx and I have http/2 working properly on it. Couple questions for experienced devops here:
\- Is there a performance difference between Nginx with http2 + an http/1.1 server behind like uvicorn? Should I aim for http2 all the way?
\- What are your general insights for performance when it comes to an app with SSE? Should I keep Gunicorn in WSGI and send SSE traffic to an ASGI server? Or should I just use nginx+uvicorn everywhere.

Any insight appreciated





/r/django
https://redd.it/1jegny2
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

/r/Python
https://redd.it/1jejwwv
Why drf not implemented schema into their api rather than use serialization who have performance issue?

I read some article about drf vs django ninja and find weird, If schema pydantic is better in term performance and validation, why drf implement serialization? Is there the info that I miss?

/r/django
https://redd.it/1jekc2g
P Question about server GPU needs for for DeepLabCut for high throughput

Hi all,

Currently working on a project that uses DeepLabCut for pose estimation. Trying to figure out how much server GPU VRAM I need to process videos. I believe my footage would be 1080x1920p. I can downscale to 3fps for my application if that helps increase the analysis throughput.

If anyone has any advice, I would really appreciate it!

TIA

Edit:
From my research I saw a 1080ti was doing ~60fps with 544x544p video. A 4090 is about 200% faster but due to the increase in the footage size it only does 20 fps if you scale it relatively to the 1080ti w/ 544p footage size.

Wondering if that checks out from anyone that has worked with it.

/r/MachineLearning
https://redd.it/1jejg5d
Searching for a Coding Partner

Hi, I’m a 6+ yrs Python (main) developer and I have been working for several companies projects but always freelanced, I have experience in website automation, data scraping, network requests analysis, e-commerce, website creation, trading and more. I am looking for a well determined and motivated guy that wants to work with me to start a business and make some money together. Looking for opportunities
Regards

/r/Python
https://redd.it/1jesga2
Just implemented my honeypots. Wish me luck!

I certainly hope Bingbot and Googlebot follow my robots.txt file 😬

/r/flask
https://redd.it/1jdsxhf
Flask Hosting: Cold starts and restarts

I built a small site with Flask and hosted it on Render’s free tier.

Initially, I had it on PythonAnywhere, but they didn’t seem to offer a way to add a custom domain on the free plan—or at least, it wasn’t straightforward.

Migrating to Render was easy, and setting up the domain was simple. But soon, I ran into two major problems.

Data Loss

I would save data to my database through the website, only to come back hours later and find it gone. I thought it was an issue with my commits and spent time troubleshooting, only to realize that Render frequently restarts services.

Why did this affect my database?

I was using SQLite. Since SQLite stores data in a file on the web service itself, every time the service restarted, it reverted to the last deployed state, wiping out any new data.

I eventually migrated to Postgres with Neon to fix this.

Cold Starts

Since my site only gets 3–4 visitors a day, it often sits idle. Naturally, I expected it to be put to sleep occasionally. But the real problem? It takes almost a full minute to wake up.

I don’t know about you, but if I visited a site called wisefool.xyz and it took that long

/r/flask
https://redd.it/1jd5t5o
Is there something better than exceptions?

Ok, let's say it's a follow-up on this 11-year-old post
https://www.reddit.com/r/Python/comments/257x8f/honest\_question\_why\_are\_exceptions\_encouraged\_in/

Disclaimer: I'm relatively more experienced with Rust than Python, so here's that. But I genuinely want to learn the best practices of Python.

My background is a mental model of errors I have in mind.
There are two types of errors: environment response and programmer's mistake.
For example, parsing an input from an external source and getting the wrong data is the environment's response. You *will* get the wrong data, you should handle it.
Getting an n-th element from a list which doesn't have that many elements is *probably* a programmer's mistake, and because you can't account for every mistake, you should just let it crash.

Now, if we take different programming languages, let's say C or Go, you have an error code situation for that.
In Go, if a function can return an error (environment response), it returns "err, val" and you're expected to handle the error with "if err != nil".
If it's a programmer's mistake, it just panics.
In C, it's complicated, but most stdlib functions return error code and you're expected to check if it's not zero.
And their handling

/r/Python
https://redd.it/1jf3p1y
Problema na View ou no HTML?

Fala galera, preciso de ajuda num projeto da faculdade. Criei uma view (nome da view - app) caso o usuário baba esteja logado apareça as infos do responsável e vice-versa;

Até então ok... as informações aparecem nos cards etc, mas ao clicar no botão de "Ver Perfil" o modal que abre é sempre do primeiro card; Alguem consegue me ajudar com isso?

HTML:

    <div class="container">
        {% if tipo_usuario == "baba" %}
            <h5 class="mb-4">{{ usuarios|length }} Responsáveis disponíveis</h5>
        {% else %}
            <h5 class="mb-4">{{ usuarios|length }} Babás disponíveis</h5>
        {% endif %}
   
        <div class="row row-cols-1 row-cols-md-2 g-4">
            {% for usuario in usuarios %}
            <div class="col">
                <div class="card h-100 d-flex flex-row shadow-lg">
       

/r/djangolearning
https://redd.it/1jeoepv
Any good Python resume projects that AREN'T machine learning?

I'm seeking my first internship and i wanna make a project that showcases my python skills. I tried to get into machine learning using Andrew Ng's course but i wasn't really enjoying it at all i don't think it's for me, but I might pick it up again in the future.

So what are some good projects that recruiters/employers like to see? I won't be aiming for ML/data roles, at least for now


Edit: i have a couple fullstack apps with javascript, so im just tryna diversify my portfolio

/r/Python
https://redd.it/1jf4ce2
A Feature-rich Flask Web Application Template 🐍

Hi,

I made a Flask starter template to save time setting up new projects. It includes:

A blueprint-based structure for better organization

GitHub Actions for testing & linting

Makefile and Poetry for managing the development workflow (testing, linting, database migrations, containerization, etc.)

Comes with lots of useful Flask extensions already installed and ready to use (SQLAlchemy, Login, WTF, Admin, Caching, etc.)

🔗 GitHub: https://github.com/habedi/template-web-app-flask

Let me know what you think! 🚀

/r/flask
https://redd.it/1jf98hk
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1jfbrhk
A Feature-rich Flask Web Application Template

What My Project Does

I made a Flask starter template to save time setting up new projects. It includes:

\- A blueprint-based structure for better organization

\- GitHub Actions for testing & lining

\- Makefile and Poetry for managing the development workflow (testing, linting, database migrations, containerization, etc.)

\- Comes with lots of useful Flask extensions already installed and ready to use (SQLAlchemy, Login, WTF, Admin, Caching, etc.)

GitHub: https://github.com/habedi/template-web-app-flask

Let me know what you think!

/r/Python
https://redd.it/1jf9ovo
Playa PDF: A strong pdfminer successor

Hi there fellas,

I wanna intro you to a great library - not one of mine, but one which I feel deserves some love and stars.

The library in questions is PLAYA which stands for "Parallel and/or LAzY Analyzer for PDF".

What is this?

This library is similar in scope to pdfminer and its fork pdfminer.six - long-established libraries for manipulating and extracting data from PDF files.

It is partially based on pdfminer.six and includes code from it - but it substantially improves on it in multiple ways.

1. It handles a broader range of PDFs and PDF issues, being very close to the (horrible) specification. For example, the author of the library (dhaines) has recently added an enormous test suite from PDF.js (one of the more ancient libraries in this space), which includes a whole gamut of weird PDFs it can handle.
2. It's much faster - well, as far as Python goes, but it is faster than the other Python libs by a factor of at least two, if not three, and not only when parallelizing.
3. complete metadata extraction - this part is what got me into this since I am integrating this with Kreuzberg now (a library of mine, which you

/r/Python
https://redd.it/1jfk466
Interactive Python Learning Series: From Numbers to Exceptions

Hey Python folks,

I wanted to share a project I've been working on, creating interactive Python tutorials — series of Python fundamentals notebooks in our marimo-learn repository.

What This Project Does: We've built tutorials covering the Python journey from basics to more complex topics. The notebooks are reactive — change code in one place and see updates ripple through in real-time, which makes learning way more intuitive. The content covers Python fundamentals (data types, strings, collections) and builds up to functions, modules, and exception handling. What makes these different is that they're fully interactive and run natively in your browser (thanks to WASM & Pyodide).

Target Audience: Python learners and teachers who prefer hands-on experimentation over passive reading; devs who want to explore Python concepts through an interactive medium rather than static documentation.

Comparison to Alternatives: Unlike static tutorials or videos, these notebooks combine explanation, code, and output in a reactive environment. When you modify code in one cell, all dependent cells automatically update, showing how concepts interconnect.

Source Code: All notebooks are available at /python folder, organized in an appropriate progression (in terms of topics).

We're also looking for Python enthusiasts to contribute additional specialized tutorials. If you're interested, check out our GitHub repository for

/r/Python
https://redd.it/1jfjmf3
AutoML , what are your thoughts about it wanted to learn more about the same

Recently I found interesting libraries called autoML libraries now that I know that they have for a long time and require heavy gpus.

Are they actually used behind the scenes in companies or is autoML such as autosklearn is dead ?

/r/Python
https://redd.it/1jf1r1a