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
Implementing Partial String Matching Leveraging SQL's LIKE Operator Wildcard

Hey guys.

I recently worked on adding a search feature to a Flask app and discovered a neat way to handle partial string matching using SQL's LIKE operator with wildcards. If you’re building a search function where users can find results by typing just part of a term, this might be useful, so I wanted to share!

The trick is to use a pattern like '%' + search_term + '%' in your query. The % symbols are SQL wildcards: one at the start matches any characters before the search term, and one at the end matches any characters after.

For example, if a user searches for "book", it’ll match "notebook", "bookstore", or "mybook".Here’s how to implemente using SQLAlchemy in a Flask view:

results = Table.query.filter(Table.column.like('%' + searchterm + '%')).all()

This query fetches all records from Table where column contains the search\
term anywhere in its value. It’s a simple, effective way to make your search feature more flexible and user-friendly.

/r/flask
https://redd.it/1k7l3ji
My own programming language

I made my own interpreted programming language in Python.

Its called Pear, and i somehow got it to support library's that are easy to create.

You can check it out here: Pear.

I desperately need feedback, so please go check it out.

/r/Python
https://redd.it/1k7ogiz
Django tip Avoid Infinite Loops with Signals

/r/django
https://redd.it/1k7nuem
Signal-based State Management in Python: How I Brought Angular's Best Feature to Backend Code

Hey Pythonistas,

I wanted to share a library I've been working on called reaktiv that brings reactive programming to Python with first-class async support. I've noticed there's a misconception that reactive programming is only useful for UI development, but it's actually incredibly powerful for backend systems too.

# What is reaktiv?

Reaktiv is a lightweight, zero-dependency library that brings a reactive programming model to Python, inspired by Angular's signals. It provides three core primitives:

Signals: Store values that notify dependents when changed
Computed Signals: Derive values that automatically update when dependencies change
Effects: Execute side effects when signals or computed values change

# This isn't just another pub/sub library

A common misconception is that reactive libraries are just fancy pub/sub systems. Here's why reaktiv is fundamentally different:

|Pub/Sub Systems|Reaktiv|
|:-|:-|
|Message delivery between components|Automatic state dependency tracking|
|Point-to-point or broadcast messaging|Fine-grained computation graphs|
|Manual subscription management|Automatic dependency detection|
|Focus on message transport|Focus on state derivation|
|Stateless by design|Intentional state management|

# "But my backend is stateless!"

Even in "stateless" services, ephemeral state exists during request handling:

Configuration management
Request context propagation
In-memory caching
Rate limiting and circuit breaking
Feature flag evaluation
Connection pooling
Metrics collection

# Real backend use cases I've implemented with reaktiv

# 1. Intelligent Cache Management

Derived caches that automatically invalidate when source data

/r/Python
https://redd.it/1k7kt89
i made a new toy for tkinter called Qpy (or TkChain)! It's so beautiful

What my project does: It's a module for tkinter with a fluent OOP, it supports method chaining for whoever likes that
Target Audiences: mental asylum patients, it's an esoteric toy project
Comparison: Not sure how to compare toy projects.. I guess unlike guizero it has a very unique and fluent oop with method chaining? Yeah I'm just repeating stuff, sorry

If this isn't a good fit for the subreddit please tell me


https://github.com/biscgames/Qpy/blob/main/q.py

Here's an example project:
https://github.com/biscgames/Qpy/blob/main/examples/eventlisteners.py

/r/Python
https://redd.it/1k7yikx
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/1k7zo60
How to

Im 18 M (college student)and have an solid saas idea and i have some experience in python and genric programming and i dont have a lot of money to build my idea and i dont have any experience in django and web dev how can i make an mvp for my saas without hiring or spending money.

/r/djangolearning
https://redd.it/1k6qfqn
Seeking a package/library that handles rectangles containing rectangles recursively

Hi, I am trying to find some pointers to existing packages/libraries that can handle the rectangles containing rectangles.

1. Each rectangle can contain multiple child rectangles. Each child rectangles can also contain grand children rectangles.

2. The location coordinates of the child rectangles are basing on the lower left corner of the parent rectangle relatively. E.g., Rect A contains Rect B (at [1, 1\]). Draw A at [2, 2\] of the canvas, then Rect B should be drawn at [3, 3\] of the canvas.

3. Each rectangle, child rectangle, ..., has an attribute denoting its rotation (0, 90, 180, 270 degs). E.g., If the above Rect B is set to rotate 90 degs, it will be rotate 90 degs, then place at [1, 1\] of the Rect A.

4. All the placement and rotation, ..., are happening recursively. I.e., when Rect B is rotated, its children also rotate respectively.

This seems to have quite common behaviors in diagramming/geometry programming practices. Could some kind souls suggest good packages/libraries doing these?

I have checked shapely. However, it does not handle child rectangles very well. The child rectangles are using the absolute coordinate, same as the parent rectangles.



/r/Python
https://redd.it/1k7xqal
Science 3d plots animation

**What My Project Does**

I made a repository using python to create 3d plots and export them in video.

**Target Audience**

Science enthusiasts, professors, anyone who knows math and/or loves beautiful science.

**Comparison**

The idea differs from others repos because my structure is/will be scalable to add any 3d plot using only the model. I already added the Lorenz attractor and Rössler attractor, but many more will be added.

I will cover all strange/chaotic attractors and related plots that I find beautiful, and improve the framework along the way. If you have any tip, I'm all ears, I plan to do more things using python to show the potential of the language in fields not so explored in the dev community (hard science).

If you want to simulate and generate a new 3d plot, create your PR.

I will use this repo and this Instagram profile to show the progress:

Instagram: https://www.instagram.com/science_plots_3d?igsh=eXhhOHF5NzV2aXV6

GitHub: https://github.com/matheusvra/scientific_plots

/r/Python
https://redd.it/1k7uw2f
PyData Paris 2025

The 2025 edition of the PyData Paris conference will take place on 30th September and 1st October at the Cité des Sciences et de l’Industrie. 🎉
We would love to hear from open-source and data enthusiasts! Please submit a proposal, the CfP is open until Sunday 27th April (yes, in 2 days !).
If you want to support and sponsor the event, please contact us !

You can find the information on our website: https://pydata.org/paris2025

/r/Python
https://redd.it/1k7kke7
The Complete Flask Rest Api Python Guide


Hey, I have made a guide about building rest apis in python with flask, it starts from the basics and covers the crud operations.

In the guide we use Sql with Postgres, and threading is also involved.

I would love to share it in case any one is interested.

The link is: https://www.youtube.com/watch?v=vW-DKBuIQsE

/r/Python
https://redd.it/1k7sarf
A minimalist web agent for sentiment analysis

Hi folks,

I've spent the last few weeks working on a Software Development Kit for sentiment analysis. I'm using Gemini-flash 2.0 as a planner.

Rabbit SDK is different because the primary focus is research by providing sentiment analysis. Its also minimalist, I've mads it super easy to set up.

What my project does: Gathers web data and provides sentiment analysis. The output is a JSON file.

Target Audience: Version 0.1.0 is a toy project with plans to expand to production.

Comparison: Its similar to browseruse except Rabbit is focused on sentiment analysis.

Github : https://github.com/wchisasa/rabbit


/r/Python
https://redd.it/1k8c2lx
Can AI play a role in creating automated software tests?

In the latest episode of Test & Code, Anthony Shaw and Brian Okken discuss using copilot and other AI tools to generate automated software tests.

Here's the episode: The role of AI in software testing - Anthony Shaw

AI is helping people write code.  
Tests are one of those things that some people don't like to write.   

Can AI play a role in creating automated software tests?  
Well, yes. But it's a nuanced yes.  

Anthony Shaw comes on the show to discuss the topic and try to get AI to write some test for my very own cards project.

We discuss:

The promise of AI writing your tests for you
Downsides to not writing tests yourself
Bad ways to generate tests
Good ways to ask AI for help in writing tests
Tricks to get better results while using copilot and other AI tools

A video version of this discussion was posted by Anthony: [Should AI write tests?](
https://www.youtube.com/watch?v=a_V-BH_luJ4)

I'd love to hear from others:

Are you using AI to help generate (or completely generate) tests?
Do you have any good tricks?
Are there other reasons to NOT try this at home?



/r/Python
https://redd.it/1k8glge
Global private functions? Is this "good practice" in any setting?

I was looking at the `xarray` repo and found this file: [https://github.com/pydata/xarray/blob/2f1751df7fb1d7c2baab9f559b220eb37ecc14e0/xarray/backends/api.py#L4](https://github.com/pydata/xarray/blob/2f1751df7fb1d7c2baab9f559b220eb37ecc14e0/xarray/backends/api.py#L4)

<importing section>


def _get_default_engine_remote_uri() -> Literal["netcdf4", "pydap"]:

# Code.....


I'm not particularly new to the language but I don't recall private functions being outside of a class ever being a good thing, quality-wise.

What am I missing here? Do "API" libraries follow different paradigms?

/r/Python
https://redd.it/1k8kkaq
Pip 25.1 is here - install dependency groups and output lock files!

This weekend pip 25.1 has been released, the big new features are that you can now install a dependency group, e.g. pip install --group test, and there is experimental support for outputting a PEP 751 lock file, e.g. pip lock requests -o -.

There is a larger changelog than normal but but one of our maintainers has wrote up an excellent highlights blog post: https://ichard26.github.io/blog/2025/04/whats-new-in-pip-25.1/

Otherwise here is the full changelog: https://github.com/pypa/pip/blob/main/NEWS.rst#251-2025-04-26

/r/Python
https://redd.it/1k8lav8
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/1k8qtm2
Django Mentor or Learning Partner in Taiwan

Learning Django in Taiwan was kind of hard to find a mentor or people to work with. I can barely find people that using Django or talking about it.
Currently, I'm learning it on my own, but I really happy to have a person that can talk to, even help me to check or discuss even just sharing the progress , so just wondering is there any people that were also into Django are in Taiwan.

/r/django
https://redd.it/1k8t7aj
Posted Hyperion on Product Hunt today

Just a quick update — I posted Hyperion on Product Hunt today, mainly because… why not?
If you want to check it out or leave some love, here’s the link:

https://www.producthunt.com/posts/hyperion-2?utmsource=twitter&utmmedium=social

Thanks again for all the early support!


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