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
Showcase: Python-Lotion – A Lightweight Wrapper for the notion-client (Beta)

Hi everyone,



I’d like to share my new project: Python-Lotion, a lightweight Python wrapper for the notion-client. 🚀



What My Project Does



Python-Lotion is designed to make working with the Notion API simpler and more intuitive. It wraps around the popular notion-client library, providing a cleaner interface for fetching, creating, and managing Notion pages and blocks. This is especially useful for developers looking to integrate Notion into their Python projects with minimal effort.



Target Audience



This project is aimed at:

• Developers working on production applications requiring Notion API integrations.

• Enthusiasts exploring Notion automation for personal use.

• Anyone looking for a lightweight and straightforward alternative to existing Notion API libraries.



Comparison



Here’s how Python-Lotion differs from existing alternatives like notion-client:

• Simpler syntax: Python-Lotion focuses on reducing boilerplate code for common tasks.

• Lightweight design: Aims to stay small and focused, avoiding unnecessary complexity.

• Work in progress: Currently in beta, with plans to expand features and improve usability over time.



What’s Next

• Expanding the documentation to make onboarding easier.

• Adding advanced block management functionality, such as creating, updating, and organizing blocks within pages.



The source code is open on GitHub: https://github.com/koboriakira/python-lotion.

Feedback, suggestions, and ideas for improvement are highly welcome!



Thanks for checking it out! 🙌

/r/Python
https://redd.it/1i35f2u
AnonChat - Anonymous chat application

**What My Project Does**

A simple and anonymous chat application written in Python3 using sockets.

**Target Audience**

Just my first project to test my skills.

target: everybody who just want to test.

**Comparison**

* Simple
* lightweight design using tkinter
* Secure

The source code in open on Github [https://github.com/m3t4wdd/AnonChat](https://github.com/m3t4wdd/AnonChat)

Feedback, suggestions, and ideas for improvement are highly welcome!

Thanks for checking it out! 🙌

/r/Python
https://redd.it/1i3ob10
It Shouldn't Be This Much Work to Sync Data Between Django and Vue SPA

I love Django, I love Vue SPAs - but I don't like spending time writing boilerplate code to link the frontend to backend models. Serializers, Views, Services, State Management, Caching, yeah... it's a lot. So I built a system that gives Vue SPAs reactive, real-time sync with Django models. No boilerplate - just write Django models and get a reactive frontend data layer where every component's view is automatically, instantly synced with the actual database state, whether changes come from other clients, background tasks, admin panels, or anywhere else. It's snappy enough to power real-time applications like chat apps and leverages Django Rest Framework under the hood.

Demo - two clients both connected to the remote backend, staying in sync

https://i.redd.it/p89ph27enkde1.gif

Out of the box, you get smart caching that invalidates correctly when CRUD operations occur (on another client, or a Django backend initiated save), optimistic UI updates, and sophisticated backend performance optimizations. Request serializer caching, automatic model schemas, and real-time synchronization come for free - without writing any additional plumbing code. The system intelligently manages data consistency, providing a seamless, responsive experience across client and server. This approach should also work for React apps - but I've not looked into this yet.

Minimal

/r/django
https://redd.it/1i3jv5d
Best practices mocking in Django Rest Framework

From my studying I learned that to have tests that are not brittle you should use as little mocking as possible.

In my API endpoints, I have secured it with the Django OAuthlib that requires the requests to have Authorization header with a token in it. If I want to test the endpoint functionality only and thus mock the call to the library to always allow the request whatever the token value is, is that a brittle test? Since if I change my authentication method, all my mocks will have to be updated? What is the general best practice for mocking with Django DRF?

/r/djangolearning
https://redd.it/1i3i9yz
I made a weekly fantasy golf app in Flask

Golf Pool is a simple app for users to pick a "fantasy team" of players in the weekly PGA events, and get live scoring compared to other users' teams. Golfers in each event (the 'field') are grouped into 5 tiers according to their initial rank and win odds. Users pick 1 player from the top tier, 2 from the 2nd tier, 3 from 3td etc, for a total of 15, with their 5 best player scores counted as their team score.

https://app.weeklygolfpool.com/

The American Express Championship is underway, so have a look but you won't be able save a team now. Come back next Wednesday to pick a team for the Farmers Insurance Open in San Diego, or the week following for the AT&T Pebble Beach Pro-Am, sometimes referred to as the unofficial start of golf season.

In the near future you will be able to create your own league to compete with friends, instead of all in one big league as it is now. Please let me know if you have other suggestions or questions. Fore!

EDIT: Not sure why my screen images aren't included in post

/r/flask
https://redd.it/1i3pkly
Building app with Flask, a blueprint for APIs and celery for tasks queuing

Hello,

I'm building a web app that should automate some tasks to run towards network devices.

For my backend, I'm using Flask and I managed to integrate celery in the code.

Now, I needed to update the project structure so I decided to create an entry point and an "api" folder that will contain all the different APIs different each network device.

I can run celery with no issues with the new structure but I'm having problems with accessing the routes on flask. The code is here https://github.com/californinson/AutoTestingPub/tree/main

I'm using run.py as the entry point. tasks.py creates the flask and celery apps using the two functions created on config.py. api/f5/f5_api.py should contain all the flask routes I will need. I also configured the blueprint inside.

I can compile and run run.py but when any API is called I see this error on the logs:

"POST /api/f5/list_files HTTP/1.1" 404 -

"POST /api/f5/user_login HTTP/1.1" 404 -

I went through documentations and articles but I can't understand why flask somehow can't reach the routes in f5_api.py.

The routes are being called with URL "http://local_ip:5000/api/f5/list_files" and "http://local_ip:5000/api/f5/user_login"

I would definitely need a look from someone "external".

What am I doing wrong?

/r/flask
https://redd.it/1i3k23v
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/1i3ukpa
how can i make a form created in admin accessible to all user

i created several mock data inside the admin page of django. these data are book forms (book title, summary, isbn).

im trying to fetch these data and put it on my ui (frontend: reactjs) as well as make sure these mock data are saved in my database (mysql) but everytime i try to access it django tells me i dont have the authorisation. i double checked and configured my jwt token and made sure to [isAuthenticated\] my views but i still keep getting 401

error: 401 Unauthorized

anyone know how to get around this?

/r/djangolearning
https://redd.it/1i3z34k
I Built a Tool Automatically Detect and Censor Human Faces in Images and Videos with YOLO

Hi everyone! I wanted to share a project I've been working on - an automated system for detecting and censoring faces in images and videos using YOLOv8 and Python.

~~I currently only have Gaussian Blur as a masking method, but I plan on adding a few more methods.~~

Edit: I have now implemented: Gaussian Blur, Emoji, and Text masking (demonstration images in GitHub repository).

GitHub Repository: [https://github.com/Spring-0/face-censor](https://github.com/Spring-0/face-censor)

# What My Project Does

Main Features:

* Automatically detects faces in images and videos using YOLOv8.
* Applies blur censoring to the detected faces and saves a new image/video.
* Built with extensibility / modularity in mind.
* I have also included a already trained model in the repository in-case someone wants to use it out the box without having to worry about training it themselves. (I have also included the code to train it)

# Target Audience

This project is aimed at:

* Video editors that previously had to manually censor out faces.
* Developers who want to integrate this in their projects.
* Anyone that would be interested in censoring human faces in images/videos.

# Comparison

I have looked into a few projects that had the same idea, except I could not find any that were easy to implement. And this was built using YOLO, making

/r/Python
https://redd.it/1i3yh1g
🎬 Django Webflix - Subscription-Based Movie Streaming Platform

Hey everyone! I wanted to share my Django project that might help other beginners. It's a subscription based streaming(though streaming isn't available yet) platform that I built to learn Django and Stripe(dj-stripe) integration.

https://preview.redd.it/enj12z69ksde1.png?width=1212&format=png&auto=webp&s=578bd921e3f7a926ac3a80387e3a28f55b2c34c0

Key Features:

User authentication
Movie/TV series browsing
Watch-lists & Favorites
Review system
Stripe subscription system
Responsive design



What You'll Learn:

Django models & relationships
Class-based views
Template inheritance
Stripe integration
User authentication



Tech Stack:

Django 5+
Python 3.11+
Bootstrap 4
SQLite/PostgreSQL
Stripe



Perfect for beginners who want to:

1. Practice Django fundamentals
2. Learn Stripe integration
3. Understand user authentication
4. Work with AJAX requests
5. Handle file uploads
6. Implement search functionality



The code is well-commented and follows Django best practices. I've included sample data generators to help you get started quickly.

Github Repo

/r/django
https://redd.it/1i4d913
Ticked 0.2.1 Major Release- A terminal based productivity hub built over Textual

My favorite part of this update revolves around the integration of Canvas LMS. Allowing students to interact with their University courses through the terminal has been a huge goal of mine with this project and I'm happy to say this is only the beginning of my plans for it.

I have also allowed for any Spotify Premium user to interact with the API by inputting their own Client ID and Secret into the app and updated my built-in code editor NEST+ to support some simple quality of life editing features like tab buffers, auto-indentation and auto-pairs.

You can read the full release here, or read the documentation for the app here for more details on the usage of these features. Thank you to everyone who's helped on the project thus far!

/r/Python
https://redd.it/1i4dq4w
Django Recipe Managment Application

Hey 👋 folks I just relase a new version of my recipes managment app on github.
The new things are:
- Scrape recipe from any url with help of openai chat model
- Generate and scrape recipe by ingredients again with openai token
more is comming

Give a star 🌟 to follow for updates.
https://github.com/mikebgrep/fork.recipes

There is an API only if you want to use in your application 😉

https://github.com/mikebgrep/forkapi

/r/django
https://redd.it/1i4g6vw
Question about Django with postgres

i’m following a tutorial to learn django , I’m understanding everything but when it comes to the sqlite I’m a little bit confused.
. At uni i’ve worked with SQLServer and recently with Postgres so I’m confident in sql it self, I’ve designed databases , build scripts with the basic CRUD operations, triggers, procedures functions etc etc , in both Postgres and sqlserver.

But I’m failing to understand how we would integrate Postgres with Django, as the tutorial uses only SQLite.
How would that work with a previously database created in Postgres ? Would we create the models in resonance with the tables created on Postgres? And let’s say I need to get all the products in the table products to display it on a web page , would I still use the “Products.objects.all()” or somehow Django can import for example a View created on Postgres that displays all products?

Sorry if the question doesn’t make sense , but would really appreciate the help.

/r/django
https://redd.it/1i4kztn
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/1i4l38y
Feedback on book recommendation site

I'm working on a book recommendation site called www.smartbookfinder.com using Flask.

I come from a data science/engineering background, so this is my first foray into web development.

It started off because I wasn't happy with Goodreads' recommendations, and I thought I could build a chatgpt wrapper that would give better recommendations. But then, I got hooked on adding additional features.

The whole thing is on my GitHub. I have no idea about best practices for stuff like this so it's kind of a mess. Let me know what you think.

https://github.com/ferraijv/book_recommendation

/r/flask
https://redd.it/1i4c5hu
Helping new website developers to build their portfolio

We are looking for someone who is new and needs help in building a portfolio to get a job in the future. We are an E-commerce company present from 2 years so it will add immensely to make a strong portfolio, if you want to make your portfolio feel free to DM me.

/r/djangolearning
https://redd.it/1i1f2pf
D Self-Promotion Thread

Please post your personal projects, startups, product placements, collaboration needs, blogs etc.

Please mention the payment and pricing requirements for products and services.

Please do not post link shorteners, link aggregator websites , or auto-subscribe links.

--

Any abuse of trust will lead to bans.

Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

--

Meta: This is an experiment. If the community doesnt like this, we will cancel it. This is to encourage those in the community to promote their work by not spamming the main threads.

/r/MachineLearning
https://redd.it/1i4oujz
I Made a VR Shooter in Python

I'm working on a VR shooter entirely written in Python. I'm essentially writing the engine from scratch too, but it's not that much code at the moment.

Video: [https://youtu.be/Pms4Ia6DREk](https://youtu.be/Pms4Ia6DREk)

Tech stack:

* PyOpenXR (OpenXR bindings for Python)
* GLFW (window management)
* ModernGL (modernized OpenGL bindings for Python)
* Pygame (dynamic 2D UI rendering; only used for the watch face for now)
* PyOpenAL (spatial audio)

Source Code:

[https://github.com/DaFluffyPotato/pyvr-example](https://github.com/DaFluffyPotato/pyvr-example)

I've just forked my code from the public repository to a private one where I'll start working on adding netcode for online multiplayer support (also purely written in Python). I've played 1,600 hours of Pavlov VR. lol

# What My Project Does

It's a demo VR shooter written entirely in Python. It's a game to be played (although it primarily exists as a functional baseline for my own projects and as a reference for others).

# Target Audience

Useful as a reference for anyone looking into VR gamedev with Python.

# Comparison

I'm not aware of any comparable open source VR example with Python. I had to fix a memory leak in PyOpenXR to get started in the first place (my PR was merged, so it's not an issue anymore), so there probably haven't been too many projects that have taken this route yet.




/r/Python
https://redd.it/1i4o1g2
Most common Python linter, formatter?

I've been asked to assist a group which is rewriting some of its ETL code from PHP to Python. When I was doing python, we used Black and pypy for formatting and linting.

Are these still good choices? What other tools might I suggest for this group? Are there any good Github CI/CD which might be useful?

And any good learning/training resources to recommend?

/r/Python
https://redd.it/1i4t28v
Flask and XML _ How and why to save data in xml format for coffee shop

I have completed Flask code for an online coffee shop. I would like to save some data in xml format. The project requires that makes use of xml. How can I do that for a coffee shop. My orders are currenly being saved in a sqlite database. What would be the reasons of saving data in xml format for an online shop.

Those who have done online shopping before, please help.

/r/flask
https://redd.it/1i4bj8t
uv ill like uv - My first blog post

https://zaloog.github.io/2025/01/19/uv.html

This year starting a blog and writing about more tech related topics besides just developing hobby projects is on my bucket list.

Since I still see a lot of people not knowing about uv, and I adopted it pretty much asap, I decided to write a bit about it and hope other feel it helpful and might also join the journey.

Have fun :)

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