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
Decorators are great!

After a long, long time trying to wrap my head around decorators, I am using them more and more. I'm not suggesting I fully grasp metaprogramming in principle, but I'm really digging on decorators, and I'm finding them especially useful with UI callbacks.

I know a lot of folks don't like using decorators; for me, they've always been difficult to understand. Do you use decorators? If you understand how they work but don't, why not?

/r/Python
https://redd.it/1oubbk3
I need help with calculated fields.

I've done a lot of research, but I'm currently overwhelmed. The calculations I need to do are actually simple, such as: how many units of a product are in stock, how many orders exist for that product, or how many items were shipped in an order and how many are remaining. I'm developing an app that handles these calculations, but I'm unsure of the best way to implement these calculated fields. Should I use property, signals, or another method? I feel overwhelmed and lost. I would really appreciate it if you could explain the logic behind this and the correct approach, or provide some example code for similar operations.

/r/django
https://redd.it/1oub9fl
Handling Shared Django Libs? Requirements / Cloning / Submodule / Subtree - What do you do?

I've got a couple shared 'apps', that I share among most Django projects I write (but not all). They are both private repos, so they require ssh to clone down.

One handles some auth related stuff (and holds some templating stuff)

One handles things related to another database (models for the most part)

I've gone over this about a dozen times trying to figure out the "best" way to incorporate those apps into various projects.

I'm curious what the community has to say about it, or what ideas you guys might have for how you handle things like this. I figure there are 4 main options:

1. Include it in requirements (how I currently do things)
Make it an installable lib and just put it in your projects requirements.
It works but it's a pain in the rear anytime you want to update / change the external lib. There are additional hoops you have to jump through in order to do it that are kind of clunky/painful.
2. Clone the repo into the project (how I previously did things)
Just clone your project, then clone in the repo.
It's nice because you can just

/r/django
https://redd.it/1oton6p
A Python 2.7 to 3.14 conversion. Existential angst.

A bit of very large technical debt has just reached its balloon payment.

An absolutely 100% mission-critical, it's-where-the-money-comes-in Django backend is still on Python 2.7, and that's become unacceptable. It falls to me to convert it to running on Python 3.14 (along with the various package upgrades required).

At last count, it's about 32,000 lines of code.

I know much of what I must do, but I am looking for any suggestions to help make the process somewhat less painful. Anyone been through this kind of conversion have any interesting tips? (I know it's going to be painful, but the less the better.)

/r/Python
https://redd.it/1ouihlq
Simple Resume: Generate PDF, HTML, and LaTeX resumes from a simple YAML config file

Github: https://github.com/athola/simple-resume

This is a solved problem but I figured I'd implement a resume generation tool with a bit more flexibility and customization available vs the makefile/shell options I found and the out-of-date python projects available in the same realm. It would be awesome to get some other users to check it out and provide critical feedback to improve the tool for the open source community to make simple and elegant resumes without having to pay for it through a resume generation site.

What My Project Does:

This is a CLI tool which allows for defining resume content in a single YAML file and then generating PDF, HTML, or LaTeX rendered resumes from it. The idea is to write the configuration once, then be able to render it in a variety of different iterations.

Target Audience:

Jobseekers, students, academia

Comparison:

pyresume generates latex, has not been updated in 8 years

resume-parser appears to be out of date as well, 5 years since most recent update

resume-markdown has been recently updated and closely matches the goals of this project; there are some differentiators between resume-markdown and this project from a ease of use perspective where the default CSS/HTML doesn't require much modification to output a nice looking resume out of

/r/Python
https://redd.it/1ouxq8q
Webcam Rubik's Cube Solver GUI App PySide6 / OpenGL / OpenCV

# Background

This toy-project started as a self-challenge to see if I could build an application that uses the webcam and some foundational computer vision techniques to detect the state of a scrambled Rubik's cube and then show the solution steps to the user.

# Target Audience

As it is a toy-project it is mainly meant for casual use by those who are curious or it serves as an example project for students trying to learn computer vision and/or graphics programming.

# Comparison

I have seen a few projects on GitHub that implement a Rubik's cube facelet detection pipeline but they seem to fall short of actually solving the cube and show the solution to the user. I have also seen a few android solver apps but those don't seem to have a way to auto detect the state of the cube using your phone camera and you need to manually set the state.

# Installation and Usage

git clone https://github.com/pdadhikary/rubiksolver.git

cd rubiksolver

uv sync

uv run rubiksolver

When scanning their Rubik's cube the user should hold up each face of the cube

/r/Python
https://redd.it/1ouwa42
Can I create PDF infographics/reports using Python?

I have a python script that does data scrapping and whatnot to output data into a CSV file. I'd love to know which packages I can use to printout professional graphics and charts and output the data into nice layouts to export it as a PDF on my computer. Any suggestions? I used ChatGPT and it used the basic Matplotlib, but I am wondering what is the best way I can go about creating something like this:

https://cdn.venngage.com/template/thumbnail/small/f7c94e39-a01c-4bba-934c-52bd9330525a.webp






https://cdn.venngage.com/template/thumbnail/small/f7c94e39-a01c-4bba-934c-52bd9330525a.webp

/r/Python
https://redd.it/1our6fw
Question I'm new

I am doing a project that uses Django rest and vite for the front, I was making a request and it had to send the credentials, cookies or section-id, issue despite doing the configuration of the cords
Front at localhost:8000
Back at 172.0.10... the typical
It didn't work for me, error 400 I think it was
I fixed it by making Back Django serve on the same local host but with a different port.
Is it normal in development to do this? Or I ruined something because I read that the AI ​​didn't help me and neither did it.
I must have explained myself poorly, I'm sure sorry.

/r/djangolearning
https://redd.it/1ouud8w
autopyperf — A tiny Python profiler that gives instant optimization tips

Hey everyone,

I made **autopyperf**, a lightweight Python module that automatically profiles your code and suggests quick optimizations — no setup, no dependencies, just pure Python.

# 🧩 What It Does

autopyperf helps you understand where your code slows down and gives small static suggestions to make it faster.

* ⏱️ Profile functions with a decorator
* 🧮 Analyze whole scripts easily
* 💡 Get simple optimization hints

Example:

from autopyperf import profile_function, profile_script, suggest_optimizations

u/profile_function
def slow_func():
return [i**2 for i in range(100000)]

slow_func()
profile_script("test.py")
suggest_optimizations("test.py")

# 🎯 Target Audience

Made for developers, students, and hobbyists who want quick feedback on code performance without using heavy profilers like `cProfile` or `pyinstrument`.
It’s simple, educational, and perfect for small projects or quick checks.

# ⚖️ How It’s Different

* No dependencies
* Dead-simple setup
* 💡 Adds optimization suggestions (something most profilers don’t)
* No complex graphs or visualizations — intentionally minimal

# ⚙️ Install

pip install autopyperf

or directly:

pip install git+https://github.com/Ithihasmadhu/autopyperf

🔗 **GitHub:** [https://github.com/Ithihasmadhu/autopyperf](https://github.com/Ithihasmadhu/autopyperf)

/r/Python
https://redd.it/1ovghpg
Can't use socketIO with a reverse proxy

Hi, has anyone worked with socketio using a reverse proxy? I can't find the correct configuration to do it, this is how I'm using it

main.py:

socketio = SocketIO(app, cors_allowed_origins="*")


web.config:

<rule name="ChatBot Port 5001">

<match url="\^example/(.*)" />

<action type="Rewrite" url="http://localhost:5001/{R:1}" />

</rule>

<rule name="ChatBot WebSocket" stopProcessing="true">

<match url="\^example/socket.io/(.*)" />

<action type="Rewrite" url="http://localhost:5001/example/socket.io/{R:1}" />

</rule>


JS:

<script>var socket = io();</script>

/r/flask
https://redd.it/1ovc82j
R LeJEPA: New Yann Lecun paper

Abstract: Learning manipulable representations of the world and its dynamics is central to AI. Joint-Embedding Predictive Architectures (JEPAs) offer a promising blueprint, but lack of practical guidance and theory has led to ad - hoc R&D. We present a comprehensive theory of JEPAs and instantiate it in LeJEPA, a lean, scalable, and theoretically grounded training objective. First, we identify the isotropic Gaussian as the optimal distribution that JEPAs’ embeddings should follow to minimize downstream prediction risk. Second, we introduce a novel objective–Sketched Isotropic Gaussian Regularization (SIGReg)–to constrain embeddings to reach that ideal distribution. Combining the JEPA predictive loss with SIGReg yields LeJEPA with numerous theoretical and practical benefits: (i) single trade - off hyperparameter, (ii) linear time and memory complexity, (iii) stability across hyper-parameters, architectures (ResNets, ViTs, ConvNets) and domains, (iv) heuristics-free, e.g., no stop -gradient, no teacher–student, no hyper-parameter schedulers, and (v) distributed training-friendly implementation requiring only ≈50 lines of code. Our empirical validation covers 10+ datasets, 60+ architectures, all with varying scales and domains. As an example, using imagenet-1k for pretraining and linear evaluation with frozen backbone, LeJEPA reaches 79% with a ViT-H/14. We hope that the simplicity and theory-friendly ecosystem offered by LeJEPA will reestablish self-supervised pre-training

/r/MachineLearning
https://redd.it/1ovm4fd
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/1ovlxtw
MyPy vs Pyright

What's the preferred tool in industry?

For the whole workflow: IDE, precommit, CI/CD.

I searched and cannot find what's standard. I'm also working with unannotated libraries.

/r/Python
https://redd.it/1ovivvs
How do I stop and start ./manage.py runserver automatically?

I have a docker container running this command. I need to automatically make it stop and start so that it can pick up new changes in the environment. How can I do it. I would optimally need something the checks a condition after each minute and then restart this command.

/r/djangolearning
https://redd.it/1ou632x
D CVPR submission number almost at 30k

Made my CVPR submission and got assigned almost a 30k submission number. Does this mean there are \~30k submissions to CVPR this year? That is more than double of last years...

/r/MachineLearning
https://redd.it/1ovqvdr
D How to sound more like a Researcher

I have been working in Applied ML for the last 10 years but in the last 2 have had a much stronger research focus and have published a few papers. Through that I have a few people reach out for some frontier labs for some research positions (my 10 years have been in FAANG). This would be a career jump that I would love but I find in my interviews I sound too applied and not researchey enough. This makes me feel very unconfident in discussing what I have done. Applied interviews are more like exams and these are more like defending a thesis.

Any suggestions for improvement? (I do stay up to date with current papers but honestly there are so many that I may not be in full depth about everything)

/r/MachineLearning
https://redd.it/1ovtrn4
Keecas: Dict-based symbolic math for Jupyter with units support and automatic LaTeX rendering

As a structural engineer I always aimed to reduce the friction between doing the calculation and writing the report. I've been taught symbolic math with units, but the field is dominated by Word and Excel, neither of which is a good fit. Thanks to Quarto I've been able to break the shackle of Office and write reproducible documents (BONUS: plain text is a bliss).

# What My Project Does

Keecas is a Python package for symbolic and units-aware calculations in Jupyter notebooks, specifically designed for Quarto-rendered documents (PDF/HTML). It minimizes boilerplate by using Python dicts and dict comprehension as main equations containers: keys represent left-hand side symbols, values represent right-hand side expressions.

The package combines SymPy (symbolic math), Pint (units), and functional programming patterns to provide automatic LaTeX rendering with equation numbering, unit conversion, and cross-referencing.

# Target Audience

Engineers writing calculation reports and technical documentation
Scientists creating reproducible notebooks with units
Academics preparing papers with mathematical content (likely not mathematicians though, those pesky folk have no use for units; or numbers)
Anyone using Jupyter + Quarto for technical documents requiring LaTeX output

>NOTE: while keecas includes features aimed at Quarto, it can be used just as easily with Jupyter notebooks alone.

keecas is available on

/r/Python
https://redd.it/1ow4shz
is there any way to detect and filter out bot traffic?

hi, I am a django lover, nowadays I feel there are a lot of bot traffics in my website.. any ways to detect and block bots? is there any python package or other? not capcha or cloudflare

/r/django
https://redd.it/1ow7s2k