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
TIL: You can actually debug the Django shell in VS Code and it's changed everything

After years of sprinkling print() statements and logs throughout my Django codebase when debugging, I've discovered a much better way that's been here all along.
Using VS Code launch config for the debugger. I always used it for running the application, but I was testing it out and I discovered you can do the same with the shell command

{
"version": "0.2.0",
"configurations":
{
"name": "Django Shell",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": ["shell",
"django": true
}
]
}


Just drop this in your .vscode/launch.json file and select "Django Shell" from the debug dropdown, and use it as you would when running server.

/r/django
https://redd.it/1jb3s85
Rate my program

It's just a simple math program. Nothing special! (except that it's my first actual project that i feel like publishing)


Link: https://github.com/ger3tto/first\_math\_program

/r/Python
https://redd.it/1jb4255
CocoIndex: Open source ETL to index fresh data for AI, like LEGO

📌 Repo: GitHub - cocoindex-io/cocoindex (Apache License 2.0)

# 📌 What My Project Does

It is an ETL framework to index data for AI, such as semantic search, retrieval-augmented generation (RAG); with realtime incremental updates. It is featured on console[.\]dev this week with 5k downloads last week.

It is the first engine that supports both custom transformation logic (like building lego) and incremental updates (out of box, to handle source data updates) to indexing data.

CocoIndex offers a data-driven programming model that simplifies the creation and maintenance of data indexing pipelines, ensuring data freshness and consistency.

# 🎯 Target Audience

\- Developers building data pipelines for RAG or semantic search.

# 🔥 Key Features

Data Flow Programming: Build indexing pipelines by composing transformations like Lego blocks, with built-in state management and observability.
Support Custom Logic: Plug in your choice of chunking, embedding, and vector stores. Extend with custom transformations like deduplication and reconciliation.
Incremental Updates: Smart state management minimizes re-computation by tracking changes at the file level, with future support for chunk-level granularity.
Python SDK: Built with a RUST core 🦀 , exposed through an intuitive Python binding 🐍 for ease of use. All of our examples are currently in Python 🐍.

# 🐳 How it works

You can think of

/r/Python
https://redd.it/1jb7oya
R How Pickle Files Backdoor AI Models—And What You Can Do About It

This articles deep dives on Python serialisation and how it is being used to exploit ML models.
Do let me know if there are any feedbacks. Thanks.

Blog - https://jchandra.com/posts/python-pickle/

/r/MachineLearning
https://redd.it/1jb4vbn
Server-side rendering: FastAPI, HTMX, no Jinja



Hi,

I recently created a simple FastAPI project to showcase how Python server-side rendered apps with an htmx frontend could look like, using a React-like, async, type-checked rendering engine.

The app does not use Jinja/Chameleon, or any similar templating engine, ugly custom syntax in HTML- or markdown-like files, etc.; but it can (and does) use valid HTML and even customized, TailwindCSS-styled markdown for some pages.

Admittedly, this is a demo for the htmy and FastHX libraries.

Interestingly, even AI coding assistants pick up the patterns and offer decent completions.

If interested, you can check out the project here (link to deployed version in the repo): https://github.com/volfpeter/lipsum-chat

For comparison, you can find a somewhat older, but fairly similar project of mine that uses Jinja: https://github.com/volfpeter/fastapi-htmx-tailwind-example

/r/Python
https://redd.it/1jbagf6
Project architecure for streamlit/Data Apps

Hi there, I'm a data scientist working mostly with Streamlit to build data apps.

Recently the requests for solutions that requires a more user friendly interface for data/ai visualization has grown significantly at my job.
Enough to make my manager realize that the deployment of such applications requires a robust standard (process).

As someone with a degree on computer science some of the most common project architecture doesn't seems to fit our use cases. Making me curious about the most used projects architecture for those kind of solutions?

/r/Python
https://redd.it/1jb880y
.csv file truncates data no matter what

I am working on using pandas to automate combining, sorting, and counting music playlists at the college station at which I am the faculty advisor.

I can import the files over the station network, create a data frame that pulls the specific data I want, but I cannot seem to get the full data set. No matter how many different ways to set to display the full set, it truncates the dada frame, only showing the first/last three list entries.

here is my block:

import pandas as pd

df = pd.read_csv(r”net path\file.csv”, encoding = “ANSI”, header = None)

data = df.iloc[:, [2, 3, 4]].values

pd.set_option(“display.max_rows”, None)

any suggestions?


/r/Python
https://redd.it/1jbemnx
Made a full body workout app

So i had this idea for a while now and this isnt the first version (first 2 were kivy apps), but i built a workout app.

excercises are selected randomly based on what level you set(1->4), videos are embeded youtube videos, equipments can be toggled or off.once you are satiffied with the preview you can accept it at the bottom of the page. the app is kind of ugly which is one thing i want to ask about, i am no front dev so any ideas about color and such or resources how to pick better colors, gaps, styling is welcome, i got no experience,i read the book: the design of everyday things and in usability it did give some great pointers but the page is just ugly.

the app is in beta so there are some bugs. you can log in with a guest account or you can also make a profile.(note that for now there is no extensive regex but the email has to contain gmail in it)

working on a major update that will add lower- upper split routine , and a routine builder for more flexible workouts.

front end uses some js and self cooked css, as well as bootstrap.

/r/flask
https://redd.it/1j9q0k2
Created a web application to allow users to evaluate their options for cars to purchase on a deeper level

As the title suggests, I created a web application using flask and some very basic bootstrap to add a whole new level to comparing different vehicles. Yeah MPG is important, but does that really matter when you have to lay down an extra $5,000 down and have to pay an extra $300 per month? Maybe not so much anymore, and how about maintenance and driving habits?

The page is broken down into two sections:

Global: shows variables like the interest rate on a loan you can get, estimated time you plan on owning the car, how many miles you drive per month, fuel price, and driving habbits (ie, I drive 80% on the highway and 20% in the city
Variables for up to 3 cars: Car name, down payment, monthly payment on the loan, average monthly maintenance, and city/highway mpg

Once you enter this information in, you will be taken to a page that shows what the total cost of ownership (TCO) is for each vehicle over the period of time you want to own it. The car with the lowest TCO will be the least expensive car.

This application will help you make these decisions by looking at the total cost of

/r/flask
https://redd.it/1j9gchf
R Transformers without Normalization (FAIR Meta, New York University, MIT, Princeton University)

Transformers without Normalization
Jiachen Zhu, Xinlei Chen, Kaiming He, Yann LeCun, Zhuang Liu
arXiv:2503.10622 [cs.LG\]: https://arxiv.org/abs/2503.10622
Abstract: Normalization layers are ubiquitous in modern neural networks and have long been considered essential. This work demonstrates that Transformers without normalization can achieve the same or better performance using a remarkably simple technique. We introduce Dynamic Tanh (DyT), an element-wise operation DyT(x)=tanh(αx), as a drop-in replacement for normalization layers in Transformers. DyT is inspired by the observation that layer normalization in Transformers often produces tanh-like, S-shaped input-output mappings. By incorporating DyT, Transformers without normalization can match or exceed the performance of their normalized counterparts, mostly without hyperparameter tuning. We validate the effectiveness of Transformers with DyT across diverse settings, ranging from recognition to generation, supervised to self-supervised learning, and computer vision to language models. These findings challenge the conventional understanding that normalization layers are indispensable in modern neural networks, and offer new insights into their role in deep networks.
code and website: https://jiachenzhu.github.io/DyT/
Detailed thread on X by Zhuang Liu: https://x.com/liuzhuang1234/status/1900370738588135805

https://preview.redd.it/c017auy7ztoe1.jpg?width=1116&format=pjpg&auto=webp&s=e87b7d0ddd44df8f5a7f789365bf128113307539



/r/MachineLearning
https://redd.it/1jbs7xg
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

/r/Python
https://redd.it/1jbi7gc
Struggling to Land US/Western Europe Remote Roles as an Indian Django Developer – Need Advice

Hi everyone,

I’m a Django developer with 4 years of experience, currently based in India. Despite my remote work experience with international companies (including projects for teams in the Netherlands and The Bahamas), I keep hitting a wall. Most remote job applications seem to be met with responses like “we don’t hire from India” or “we’re looking for someone with more experience or cultural fit.”

I understand that factors such as purchase power parity play a part in salary negotiations and market rates. However, I feel that my location is unfairly limiting my opportunities and undervaluing my skills. I’m eager to work with US or Western European companies that appreciate quality and expertise, regardless of where I’m based.

I’m reaching out to this community for advice:

How can I better position my skills and remote work experience to overcome the location bias?
Has anyone successfully navigated similar challenges? If so, what strategies or platforms did you find most effective?
Any tips for tweaking my resume or application approach to appeal to international employers?
how much should i expect in salary since i have 4 years of experience & i dont have a CS degree.

p.s. i post my learnings on twitter and on my blog.

my portfolio - https://sorv.dev

/r/flask
https://redd.it/1jbvje6
Unvibe: Generate code that passes Unit-Tests

# What My Project Does
Unvibe is a Python library to generate Python code that passes Unit-tests.
It works like a classic unittest Test Runner, but it searches (via Monte Carlo Tree Search)
a valid implementation that passes user-defined Unit-Tests.

# Target Audience (e.g., Is it meant for production, just a toy project, etc.)
Software developers working on large projects

# Comparison (A brief comparison explaining how it differs from existing alternatives.)
It's a way to go beyond vibe coding for professional programmers dealing with large code bases.
It's an alternative to using Cursor or Devon, which are more suited for generating quick prototypes.



## A different way to generate code with LLMs

In my daily work as consultant, I'm often dealing with large pre-exising code bases.

I use GitHub Copilot a

/r/Python
https://redd.it/1jbv74v
Sunday Daily Thread: What's everyone working on this week?

# Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

## How it Works:

1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.

## Guidelines:

Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

## Example Shares:

1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟

/r/Python
https://redd.it/1jc8qu4
Made a Youtube Downlaoder and Thumbnail Tester

Made a Youtube Video downloader and a Thumbnail Tester. Also looking to add a braille AI translator I made.

I made it cause I am an editor and download a lot of youtube vids, but most of the sites are really bad and scammy. Check it out if you want :)

/r/flask
https://redd.it/1j9q1ha
R Recent advances in recurrent neural networks---any sleepers?


title; all i hear is mamba when it comes to recurrent neural networks these days. which recurrent neural network framework are you optimistic for?

/r/MachineLearning
https://redd.it/1jbzcoc
Driver Fatigue Monitoring

made a cool Drowsiness Detector
check it out, leave a comment if u have any suggestions or want to collaborate

https://github.com/SomnoCam/Drowsiness-Detector.git

/r/Python
https://redd.it/1jca2ny
FastOpenAPI library Flask, Falcon, Quart, Sanic, Starlette

While working on a project that required OpenAPI documentation across multiple frameworks, I got tired of maintaining different solutions. I really like FastAPI’s routing—it’s clean and intuitive. So I built FastOpenAPI, which brings a similar approach to other frameworks.

# What FastOpenAPI Does

FastAPI-style routing, but without being tied to FastAPI.
Automatic OpenAPI documentation generation.
Built-in request validation with Pydantic.
Supports Flask, Falcon, Sanic, Starlette, and Quart.

# Target Audience

FastOpenAPI is designed for web developers who like FastAPI-style routing but need to use a different framework for various reasons. It’s a compromise solution for those who want a clean and intuitive API but cannot use FastAPI.

# Comparison

Compared to existing solutions:

Not tied to FastAPI, unlike FastAPI itself, which is built on Starlette.
Unified routing style and OpenAPI generation across multiple frameworks.
Built-in request validation with Pydantic, whereas many frameworks require manual data parsing and validation.
Simpler and more concise syntax than Flask-Smorest or Spectree, which use different approaches.

The project is still evolving, and I’d love any feedback or testing from the community!

📌 GitHub: https://github.com/mr-fatalyst/fastopenapi
📦 PyPI: https://pypi.org/project/fastopenapi/

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