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
Tach - Visualize + Untangle your Codebase

Hey everyone! We're building Gauge, and today we wanted to share our open source tool, [Tach](https://github.com/gauge-sh/tach), with you all.

**What My Project Does**

[Tach](https://github.com/gauge-sh/tach) gives you visibility into your Python codebase, as well as the tools to fix it. You can instantly visualize your dependency graph, and see how modules are being used. Tach also supports enforcing first and third party dependencies and interfaces.

Here’s a quick demo: [https://www.youtube.com/watch?v=ww\_Fqwv0MAk](https://www.youtube.com/watch?v=ww_Fqwv0MAk)

[Tach](https://github.com/gauge-sh/tach) is:

* Open source (MIT) and completely free
* Blazingly fast (written in Rust 🦀)
* In use by teams at NVIDIA, PostHog, and more

As your team and codebase grows, code get tangled up. This hurts developer velocity, and increases cognitive load for engineers. Over time, this silent killer can become a show stopper. Tooling breaks down, and teams grind to a halt. My co-founder and I experienced this first-hand. We're building the tools that we wish we had.

With [Tach](https://github.com/gauge-sh/tach), you can visualize your dependencies to understand how badly tangled everything is. You can also set up enforcement on the existing state, and deprecate dependencies over time.

**Comparison** One way [Tach](https://github.com/gauge-sh/tach) differs from existing systems that handle this problem (build systems, import linters, etc) is in how quick and easy it is to adopt incrementally. We provide a

/r/Python
https://redd.it/1ixz0tk
How to Learn Django for Backend Development & Valuable Project Ideas?

Hey everyone,

I'm a CS student interested in backend development and want to learn Django as quickly as possible. My goal is to build job-ready skills and work on projects that add real value to my CV.

I’d love to hear from experienced developers about:

1. The best way to learn Django efficiently (roadmaps, courses, or structured learning paths).
2. Project ideas that are impressive to recruiters and showcase real-world skills.
3. Skills beyond Django that I should focus on for backend development jobs.

I want to make sure I’m learning things that actually help in landing a job instead of just following random tutorials. Any insights would be super helpful!

Thanks in advance!

/r/django
https://redd.it/1ixys92
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/1iy9wct
Codegen - Manipulate Codebases with Python

Hey folks, excited to introduce Codegen, a library for programmatically manipulating codbases.

What my Project Does

Think "better LibCST".

Codegen parses the entire codebase "graph", including references/imports/etc., and exposes high-level APIs for common refactoring operations.

Consider the following code:

from codegen import Codebase

# Codegen builds a complete graph connecting
# functions, classes, imports and their relationships
codebase = Codebase("./")

# Work with code without dealing with syntax trees or parsing
for function in codebase.functions:
# Comprehensive static analysis for references, dependencies, etc.
if not function.usages:
# Auto-handles references and imports to maintain correctness
function.remove()

# Fast, in-memory code index
codebase.commit()

Get started:

uv tool install codegen
codegen notebook --demo

Learn more at docs.codegen.com!

Target Audience

Codegen scales to multimillion-line codebases (Python/JS/TS/React codebases supported) and is used by teams at

/r/Python
https://redd.it/1iy0i35
New side project is up. JOAT.tools (Jack Of All Trades) built on Django Ninja

Hey, I'm embarrassed to release this often, which is kind of the mantra around here, right?

Long story short is that I've decided to build an API service that wraps many of the most useful libraries and other services, even those "one-feature" SaaS offerings.

Be gentle, I'm sharing it to poke and critique.

I have some colleagues in F50 companies who asked to have a service like this deployed internally because of a number of bureaucratic reasons.

It is easier to get an internal API approved than it is to add it to the existing compiled/deployed software stacks. (weird, but it is what it is -- mostly about software supply chains)

Anyway, go look at the openapi spec and see that it is mostly just about scraping and format conversions (for now).

EDIT: LOL, forgot the link:

https://joat.tools

/r/django
https://redd.it/1ixz2nu
Built an ORM: A Minimal Asynchronous ORM for Python and PostgreSQL

- What My Project Does: ORM (Object-Relation Mapping)
- Target Audience: Production usage
- Comparison: It demonstrate a minimal* implementation based on asyncio and type hinting achieving rich feature ORM implementation. Compared to Django, SQLAlchemy and other ORMs, it provides better developer experience in the projects applied with type-checking (e.g. Pyright) and asyncio.

\*AST statements count (SQLAlchemy: 76,228 , Peewee: 5,451, orm1: 677)

[orm1](https://github.com/hanpama/orm1) is an asynchronous Object-Relational Mapping (ORM) library for Python and PostgreSQL.

**Features**

* Asyncio
* Auto-mapping with Type Hints
* DDD Aggregate Support
* Query Builder
* Raw SQL Queries
* Nested Transaction Management
* Composite Key Support

**Example**

Install orm1 using pip:

```sh
pip install orm1
```

Define your database models with type hints:

```python
from orm1 import auto

@auto.mapped()
class Post:
id: int
title: str
content: str
attachments: list["PostAttachment"]

@auto.mapped(parental_key="post_id")
class PostAttachment:
id: int
post_id: int
file_name: str
url: str
```

Perform CRUD operations using a session:

```python
# Create a new post with an attachment.
post = Post()
post.title = "Introducing orm1"
post.content = "orm1 is a lightweight asynchronous ORM for Python."

attachment = PostAttachment()
attachment.file_name = "diagram.png"
attachment.url = "http://example.com/diagram.png"

post.attachments = [attachment]

# Save the post (and cascade save the attachment as part of the aggregate).
await session.save(post)
```

Update:

```python
# Update the post's title.
post.title = "Introducing

/r/Python
https://redd.it/1iy9q5f
Kreuzberg: Next Steps

Hi Peeps,

I'm the author of kreuzberg - a text extraction library named after the beautiful neighborhood of Berlin I call home.

I want your suggestions on the next major version of the library - what you'd like to see there and why. I'm asking here because I'd like input from many potential or actual users.

To ground the discussion - the main question is, what are your text extraction needs? What do you use now, and where would you consider using Kreuzberg?

The differences between Kreuzberg and other OSS Python libraries with similar capabilities (unstructured.io, docking, markitdown) are these:

- much smaller size, making Kreuzberg ideal for serverless and dockerized applications
- CPU emphasis
- no API round trips (actual of the others as well in some circumstances)

I will keep Kreuzberg small - this is integral for my use cases, dockerized rag micro services deployed on cloud run (scaling to 0).

But I'm considering adding extra dependency groups to support model-based (think open-source vision models) text extraction with or without GPU acceleration.

There is also the question about layout extraction and PDF metadata. I'd really be interested in hearing whether you guys have use for these and how you actually use them.

/r/Python
https://redd.it/1iyhjax
Looking for Inspiration & Recommendations for My Upcoming POS Project

Hey everyone! 👋

I'm planning to build a Point of Sale (POS) system using Django, and I’m looking for recommendations and inspiration. I want to make it efficient, user-friendly, and scalable.

Are there any open-source POS projects in Django that you'd recommend for reference?

/r/django
https://redd.it/1iyks73
Advice on model designs

Hello good people of Django-land!

I need some help with designing my models.

I'm building a web app where people can submit structured poetry called "pantun" where the number of lines must be even. So you can submit poems having from 2 up to 16 lines.

My question is which design is better?

My interests are keeping the database size as small as possible for as long as possible, ease of adding features and also ease of code maintainability.

1. Have a BasePantun model and then create descendants inheriting from it?
2. Have a monolith Pantun model where you keep fields named "Line10", "Line11" etc. empty? (This is my current implementation)

My current observation from users using the app is that most of them tend to submit mostly 4-line pantuns.

Another question I have is that I'm planning to implement an award system. For certain achievements, users can get certain awards.

Again same interests as above, which design is better?

1. My current implementation

​

class Award(models.Model):
name = models.CharField(max_length=50)
winners = models.ManyToManyField(User, related_name="pemenang_anugerah", blank=True)
...

2. Another implementation idea

class Award(models.Model):


/r/django
https://redd.it/1iyl64y
After moving Database URI to an environment variable I get "Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."

My app was working fine before. I host it on Heroku.


I realized that hardcoding the database uri with password isn't the most secure thing. Heroku has a thing called Config Vars where you can put the URI there as an environment variable that is separate from your code.


I did it. and it worked. This is how my code looks like:




app = Flask(__name__)
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY')
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('SQLALCHEMY_DATABASE_URI')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['pool_size']= 10
app.config['poolclass'] = QueuePool
app.config['pool_pre_ping'] = True
app.config['SQLALCHEMY_POOL_RECYCLE'] = 35
app.config['SQLALCHEMY_POOL_TIMEOUT'] = 7
mail = Mail(app)


db = SQLAlchemy(app)
ma = Marshmallow(app)
bcrypt=Bcrypt(app)
login_manager = LoginManager(app)
CORS(app)


As you can see I access the Config vars using os.environ.get.


This all worked fine. App works great. Later on I decided to add another table and then update it using alembic.

/r/flask
https://redd.it/1iymufo
Django.Social - Community Hosting Platform

Asking for some help.

I'm getting sick of having to use Meetup.com for hosting the Django.Social community.

I started this group almost 3 years ago for the Django community to try and bring people together regularly. However the last 6 monthly bill we received was over $1,600 and Meetup is proving pretty limited in terms of its functionality and VFM.

Some of our best events have been around Django Conferences getting people to socialise the night before the conference starts.

In all, we have almost 2,000 members across 7 groups in 7 countries and want this to grow further but without having to charge members or the groups having to find sponsors.

We have a discord channel with a handful of users and not much activity which would be an obvious place to host the community and then publicise events using free tools like eventbrite.

Are there any other options out there that people use for their groups/communities?

Please share any suggestions and help us out so we can keep this all going.

#DjangoSocial #DjangoMeetup #DjangoEvent #DjangoCon #DjangoConEurope #Django #DjangoPeople #DjangoCommunity

/r/django
https://redd.it/1iypnzp
Integrating django api with whatsapp chatbot

Hi,
Any experience in integrating our own api with whatsapp chatbot. Like for frontend part whatsapp chatbot will be used instead of application. Any reference document or tutorial for the same. Kindly help

/r/django
https://redd.it/1iygdce
Python gave me the chance to finally execute a personal project for something I actually needed

Not sure if this kind of post is allowed here but just wanted to celebrate this because it feels like a major milestone for me.

I've been a software dev for about 10 years but in that time I have never come up with ideas of problems at home that I could solve with code. If I had an idea, there was already a solution out there or it felt like it would take way too much effort to build and implement in Typescript/.NET, which is what I use for my job.

I recently picked up Python at work for a non-GUI data manipulation project and I was really surprised at how simple it is to set up and get going on. Feels like with the other languages I've tried out, you have to do so much configuration and build to even get off the ground, to the point where I've struggled in the past with tutorial courses because something doesn't work in configuring the IDE or installing packages, etc.

Well the other day I was poking around with my home network software, trying to figure out if there was a way to get a notification when a certain device connects to the

/r/Python
https://redd.it/1iyorr7
New feature for Explain Like I am five.

Hey everyone new feature!

You can now choose between different types of explanation modes so it can either be concise or Like You are five.

Also it should no longer return no response.


Feel free to check it out here: https://teachmelikefive.com/ and give me any feedback you have


Thanks in advance

/r/flask
https://redd.it/1iyydp3
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/1iz29bk
Building a new Django Framework

I'm not much a poster so please don't be rough on me. I enjoy this subreddit and the community built/building within here. I think most the comments here are extremely helpful and nice to most of the posts, even when they ask the same questions over and over (ie what front end should I use with Django?). But because of this community I’ve been building a lot of my APIs with Django Ninja now. I'm making this post to crowdsource opinions and since this is a new thing for me to work on I would appreciate feedback/opinions on what I should think about/consider and features that could be cool.

With that being said, I’ve decided to create my own Django dev tool. For now it will be a personal project for internal use. My overall idea was to create something challenging for fun and things I would add in my own personal API development workflow. Before LLMs I wouldn’t have considered this because the planning alone seems like a big undertaking that I don’t think I would’ve had the capacity to do but I’ve been exponentially more productive since utilizing AI within my workflow. I don’t think of myself as some

/r/django
https://redd.it/1iyzx8d
Anyone interested in creating a sports complex management system with me backend(Django + Django Rest Framework (Python) → Handles all data, users, payments, reservations)learning together

/r/django
https://redd.it/1iyz0hg
Why not just plot everything in numpy?! P.2.

Thank you all for overwhelmingly positive feedback to my last post!

 

I've finally implemented what I set out to do there: https://github.com/bedbad/justpyplot (docs)

 

A single plot() function API:

plot(values:np.ndarray, grid_options:dict, figure_options:dict, ...) -> (figures, grid, axis, labels)

You can now overlay, mask, transform, render full plots everywhere you want with single rgba plot() API

It

Still runs faster then matplotlib, 20x-100x times:timer "full justpyplot + rendering": avg 382 µs ± 135 µs, max 962 µs
Flexible, values are your stacked points and grid_options, figure_options are json-style dicts that lets you control all the details of the graph parts design without bloating the 1st level interface
Composable - works well with OpenCV, Jupyter Notebooks, pyqtgraph - you name it
Smol - less then 20k memory and 1000 lines of core vectorized code for plotting, because it's
No dependencies. Yes, really, none except numpy. If you need plots in Jupyter you have Pillow or alike to display ports, if you need graphs in OpenCV you just install cv2 and it has adaptors to them but no dependencies standalone, so you don't loose much at all installing it
Fully vectorized - yes it has no single loop in core code, it even has it's own text literals rendering, not to mention grid, figures,

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