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
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
From 59 lines of tutorial code to 260,000 lines powering a production SaaS

Ever wondered what Flask looks like in production? Here are some insights into a Flask app with over 150 thousand users. Enjoy!

## How it started

In 2016, I started a Flask tutorial because I had an idea for a simple app. I knew a little bit about HTML and CSS but
almost nothing about database driven apps. I continued building on this codebase for nine years. Now,
that same app has hundreds of thousands of registered users, earns thousands
of revenue per month, and has changed my life forever.

Despite its unglamorous beginnings I never rewrote the app from scratch, I just kept on adding to it (and sometimes
taking away). Whenever I faced a
problem or a challenging requirement, I churned, ground and didn't give up until it was fixed. Then I moved on to the
next task.

## Some stats

Some usage stats:

* 400k visitors per month
* 1.5 million page views per month
* 8k signups per month with 180k signed-up users overall
* 80 requests per second

Some code stats:
- Python: **51,537 lines**
- Vue/JavaScript: **193,355 lines**
- HTML: **16,414 lines**
- **Total: ~261,000 lines of code**

## The architecture and customizations

OK, onto the code! Here is a top-level overview:

* The main database is Postgres and I use Peewee as

/r/flask
https://redd.it/1owbrvx
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/1owhaba
R is Top-K edge selection preserving task-relevant info, or am I reasoning in circles?

I have m modalities with embeddings Hi. I learn edge weights Φij(c, et) for all pairs (just a learned feedforward function based on two embeddings + context), then select Top-K edges by weight and discard the rest.

My thought , Since Φ
ij is learned via gradient descent to maximize task performance, high-weight edges should indicate that modalities i and j are relevant together. So by selecting Top-K, I'm keeping the most useful pairs and discarding irrelevant ones.

Problem: This feels circular.. “Φ is good because we trained it to be good."

Is there a formal way to argue that Top-K selection preserves task-relevant information that doesn't just assume this?

/r/MachineLearning
https://redd.it/1ow7g2u
D Question about self-referential novelty gating

I’ve been wondering about continual learning and noticed that most setups treat “novelty” as a single scalar, usually tied to prediction error or surprise. But in humans, a surprise that feels self-relevant (“this is about me / my situation”) clearly lands differently from a random trivia fact. So I’m wondering if it makes sense to give agents a simple “self-score” for each event and let that bias what gets written into long-term memory.

For example like this a promotion gate I imagined for an episodic memory buffer

effective\\_score = score + alpha \\* self\\_score

if effective\\_score >= SCORE\\_THRESH and dist\\_to\\_neighbors <= RADIUS\\_THRESH:

promote\\_to\\_long\\_term(memory)

Intuitively, this would mean self-relevant surprises are slightly more likely to be preserved and influence future behavior, without just globally increasing the learning rate. Has anyone tried something like this in practice (RL agents, LLM agents with memory, etc.) or seen papers where self-relevance is treated as an explicit signal in the learning rule, rather than just a psychological observation?

/r/MachineLearning
https://redd.it/1ow8587
I want to build and use custom MCP in my Django project. Have any suggestion on this?

I'm working on a project where users can explore the entire database and create dashboards using simple natural language queries. I've already implemented the system of connecting different types of databases like PostgreSQL, MongoDB, SQLite, CSV, Excel, etc., and created a chat model and views for that. It's currently having simple OpenAI calls for the query responses.


Now, I want to connect the databases to chat so that when the user writes the query, it talks to connected chat databases and provide responses based on that.


For this, I want to use the MCP in my project, as the MCP perfectly works with AI.

Does anyone have any experience with a similar situation and can guide me in this?

Thanks in advance to everyone!

/r/django
https://redd.it/1ow0kfw
Google Oauth

I have built an refer based web application and created a JWT and role based session login.....That works brilliantly but when I am trying to integrate google Oauth book my server can't return tokens to Google based users why is that ?

How can I resolve?

Any suggestions?


P.s: Also pls dm if ur a flutter based dev looking forward to connect!!

/r/django
https://redd.it/1owrihr
Accounting + Python

Any accounts here use Python to successfully help/automate their jobs? If so how?

My next question is: do you have to install and IDE on your work computer to have it work? If so, what are the use cases I can sell to my boss to let me install?

/r/Python
https://redd.it/1owedv4
Where do you guys actually find Django work?

I've been working in tech for 6 years, mostly writing, but the technical side, like spinning up VMs and load testing hosting providers, benchmarking performance, that sort of thing.

I just finished a backend program and have some decent projects (e-commerce API, Telegram bot with Celery/Redis, the usual portfolio stuff). I know my way around Django/Python/Docker reasonably well at this point.

But I feel like I'm looking in the wrong places. Where do people actually find this work? Is it all networking? Discord servers? Freelance sites? Should I just be cold emailing companies?

What worked for you?

/r/django
https://redd.it/1owsf7c
Flask vs FastAPI for High CPU and High I/O Bounded Usage

Hello,


I have a scenario where I have heavy CPU load due to ML calls, etc and also I have heavy networking and I/O bound. I tried flask but it's very obvious that with lots of requests, the overhead of threads created by gunicord nonetheless the overhead of thread pool executor will add up latency to request.


FastAPI on the other hand is more complex in terms of how it handles requests as I see it I don't have much control over what happens and is difficult to debug.


I am unware of any extension to both...but my system already build using flask and I am worried that I might selected wrong framework.


Your thoughts?

/r/flask
https://redd.it/1owosst