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
Puppy: best friend for your 2025 python projects

TLDR: https://github.com/liquidcarbon/puppy helps you install and manage python projects, environments, and notebook kernels.

# What My Project Does

\- installs python and dependencies, in complete isolation from any existing python on your system
\- `pup add myenv pkg1 pkg2` uses uv to handle projects, packages and virtual environments; `pup list` shows what's already installed
\- `pup clone` and `pup sync` help build environments from external repos with `pyproject.toml` files
\- `import pup; pup.fetch("myenv")`  for reproducible, future-proof scripts and notebooks


Puppy works the same on Windows, Mac, Linux (tested with GitHub actions).

Get started (mix and match installer's query params to suit your needs):

curl -fsSL "https://pup-py-fetch.hf.space?python=3.12&pixi=jupyter&env1=duckdb,pandas" | bash

# Target Audience

Loosely defining 2 personas:

1. Getting Started with Python (or herding folks who are):
1. puppy is the easiest way to go from 0 to modern python - one-command installer that lets you specify python version, venvs to build, repos to clone - getting everyone from 0 to 1 in an easy and standardized way
2. if you're confused about virtual environments and notebook kernels, check out pup.fetch that lets you build and activate environments from jupyter or any other interactive shell
2. Competent - check out Multi-Puppy-Verse and Where

/r/Python
[https://redd.it/1hllr3j
Zero-knowledge encryption in Django

Hello,

I built a web app (rn local only) for professional (job/work related) purposes to help my friend as a marketer/ writer (he writes for different companies and manages that stuff on his laptop as a local machine). Now some of his friends want to try it out, and it will be too much work to help them run in their local server with a virtual environment. I also want to try and scale it out if it works.

I have another simple project in Django that helps manage funding, source of funding, etc., and other personal user data.


Now the issue is I want to make sure I as a super admin or admin, or the server owner (or as a developer) don't have access to any of the writings or work they have saved in that system or server.

How can I achieve that in Django?

I was thinking of using their username (only one username for each user) to generate a mnemonic for that user and encrypt and decrypt their data when they log in and access.

I do not know how blockchain works and I am a mid-level Django

/r/django
https://redd.it/1hlehkq
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/1hlpmma
Constructors: init, new, both, neither?

Hi all, I'm doing some research on what programmers believe is the class constructor in Python. I made a poll here: https://strawpoll.com/05ZdzVzdmn6 and would appreciate all responses, thanks!



/r/Python
https://redd.it/1hlrtm0
Python package ideas.

hii...
i wanna create a unique useful python package for my next project.

and i am outof ideas. can you please let me know you opinions and ideas about that.
i mean, is there anything that you thought like if this kinda package exists, that would be great, i wanna hear that....
(i like cryptography, iot, microcontroller stuffs aswell)
thank uuuuuuu....

/r/Python
https://redd.it/1hlu81l
Relative Date DSL similar to Grafanas Date Picker shortcuts

**What My Project Does:**

It allows for defining relative Date-Times using a human friendly syntax which is great for configuration files.

A basic example to get the first saturday of the current month:

/month -1 day /sat + 1 week

Here is another example that gets every 3rd calendar week;

%cw 3

It has more features:

* Validation via [pre commit hook](https://iilei.github.io/cronspell/details/pre_commit_hook/)
* Accessible via [command line interface](https://iilei.github.io/cronspell/details/cli/)
* Determine upcoming moments -- see [example test cases](https://github.com/iilei/cronspell/blob/master/tests/test_upcoming.py)

**Target Audience:**

With its focus on intuitive comprehensibility, I hope to offer value for a variety of roles such as

* Developers
* Data-Engineers
* Technical Writers
* Business Engineers

**Comparison:**

A different python package, `crontab` embodies the de-facto standard domain-specific-language to express repeating date-times in a reliable fashion. The Syntax is powerful and well-established. The properties of both exhibit some overlap but are not identical.

**License:**

MIT License

More Details at the [project documentation GitHub pages](https://iilei.github.io/cronspell/details/recipes/).
Would love to hear your thoughts and suggestions for improvements!






/r/Python
https://redd.it/1hlws4a
Tips for Learning Django.. coming from Java (Spring)?

Hello guys, I'm moving from a team using Java (Spring) to a Django backend team (likely using the Django REST framework) within my company after the New Year break. I've never worked with Django before, but I do know Python pretty well since it’s my go to language for LC. My current plan is to start with the official Django tutorial, move on to Django REST doc, and then build a small project to get some hands on experience.

For those who know both Spring and Django, is there anything I should keep in mind while learning Django? (I also have some experience with nodeJs Express, though that was from some personal projects I worked on a long time ago) Also, is the official Django doc the best way to learn, or are there other resources you’d recommend? Would love to hear any advice or tips from people who’ve been in a similar boat. Thanks!

/r/django
https://redd.it/1hls0s7
Advanced Tutorials

The Djangoverse is not lacking in any beginner tutorials. Although some cover more advanced topics, they are harder to find and some topics have none.

I've been following some more advanced tutorials on structuring Django projects and it really advanced my understanding of the framework. I thought it would be great if people could post tutorials they've found useful on some of the more advanced/obscure topics (not covered in the beginner tutorials). Some of my topics of interest (feel free to add yours!):

1. Email verification for custom user models (tokens anyone?):
2. Full email system setup in general:
3. Celery use beyond just setup:
4. How to manage changes and migrations while website is deployed already:

I'm sure there are a lot more. It would be great to have an ongoing list.

Best wishes for 2025!

/r/django
https://redd.it/1hm10xf
I have A question about my code in python

The code should make 100km

then subtract from it 100 meter

then 100cm then

then 100 mm

then Evaluate Exactly the value

THat is The file Which I wrote the correct Code

import Methods as M
def Convert_To_Decimal(Value):
    for i in range(len(Distance_List)-1):
        # Convert To Decimal
        V = Convert_Distance(Distance_List[i], Distance_List[i+1], Value)
       
        if V!=0:
            print(V, Distance_List[i+1], end=" ")  
        V=V-int(V)
    print()
        # Print Number
       
def Convert_Distance(From, To="1km", Value=0):
   
    return round(Value * M.Return_distance(From) / M.Return_distance(To),10)

def Minus():
    B = 100
    for Label in Distance_List[1:]:
        print("Subtracting 100", Label)
   

/r/Python
https://redd.it/1hm3k5p
How to effectively understand the Django repository (or any large codebase)?

The reason I am asking this question stems from my exploration of the Django codebase, which began after I finished studying Django for Beginners 4.2 by Will Vincent. Throughout the book, I often found myself asking questions like, how do CBVs and GCBVs work? Why do they inherit from the View class? Why is .as_view() used with CBVs and GCBVs, but not with FBVs?

These questions stayed in my mind, so I decided to explore the Django repository to understand them better. While most of the code (if not all) went over my head, I believe I now partially "understand" the "why" behind some of these concepts.

From my exploration, I realized that as_view() essentially “converts” CBVs and GCBVs into functions because the foundational way of building Django views are FBVs. CBVs and GCBVs are built on top of FBVs. CBVs aim to achieve better separation of logic by mapping HTTP methods to specific class methods, while GCBVs are built on top of CBVs to simplify common tasks like creating, updating, deleting, querying and displaying data e.c.t.

I am not entirely sure if my understanding is accurate, but this is how I have interpreted it so far.

My question is, How can I understand

/r/django
https://redd.it/1hm4o4f
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/1hmc71n
Where to start with headless allauth

Hey everyone!

I've been taking my first steps into front end development, I've chosen sveltekit and am loving it so far. Now for the tricky part, authentication. There is a boilerplate project for allauth in react but I find the documentation to be lacking any guidance on implementation, any pointers?

/r/django
https://redd.it/1hm86tk
🐍 Modern, Minimalistic and Scalable Python FastAPI Template🚀

Hey! 👋 Excited to share my production-ready API template that shows off modern Python practices and tooling!



Key highlights: 🌟

\- ⚡️ Async-first with FastAPI and SQLAlchemy

\- 🏗️ Clean, maintainable architecture (repository pattern)

\- 🛠️ Latest Python tooling (UV package manager)

\- 🧪 Automated testing and CI pipeline

\- 🚂 One-click deployment to Railway



The template implements a fun superhero API to showcase real-world patterns! 🦸‍♂️



Technical goodies: 🔧

\- Type hints throughout

\- 🔄 Pydantic v2 for validation

\- 📖 Automatic OpenAPI docs

\- ⚠️ Proper error handling

\- 🔄 Async database operations

\- ⚡️ Automated migrations



GitHub: https://github.com/luchog01/minimalistic-fastapi-template 🌟



The logging setup and database migration patterns were super tricky to figure out 😅 Not 100% sure if I handled them in the best way possible! Would really appreciate any feedback from the Python experts here! 🙏 Always excited to learn from the community!

/r/Python
https://redd.it/1hmbg24
After changing flask port, port 5000 is not working anymore

Hey, I was sending API request to my flask application at 192.168.X.X:5000 from my local network for last few days.
Today I asked my friend to try and send API request , because I was in a hurry, I didn't have time to open new ports and I remembered I had port 25565 already opened so I used that one (so it was pub-ip:25565).

Now that I have time, I opened port 5000 and now the script is not working when I go back to port 5000.
I tried again with 25565 and its working, I tried from port 12345 and its working. Just the 5000 is NOT working.
Any suggestions?

When I start the app:

Serving Flask app 'main'
Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
Running on http://192.168.X.X:5000
Press CTRL+C to quit
Restarting with stat
Debugger is active!
Debugger PIN: 233-951-201

/r/flask
https://redd.it/1hm9j4x
Affordable and Reliable Hosting for Django Project with PostgreSQL, Redis, and AWS S3?

I'm developing a Django project which includes several key modules:

AI Integration: Uses OpenAI to provide crop recommendations and chatbot features.
Weather Module: Incorporates weather data to assist with planning and insights.
Mapping Tools: Utilizes Mapbox for GIS-related functionalities, like visualizing field and crop data.
User Management: Manages user accounts, authentication and auth.

The app requires PostgreSQL for the database, Redis for caching, and AWS S3 for media and static files. I’m looking for a hosting platform that is both affordable and highly reliable for these requirements. Any recommendations?

/r/django
https://redd.it/1hmhox1
Would it be possible to host a django backend on an Android device?

Also, would it be possible for that backend to access sqlite on said Android device?

Thanks.

/r/django
https://redd.it/1hmki0e
D Everyone is so into LLMs but can the transformer architecture be used to improve more ‘traditional’ fields of machine learning


i’m thinking things like recommendation algorithms, ones that rely on unsupervised learning or many other unsupervised algos

i’ll look more into it but wanted to maybe get some thoughts on it

/r/MachineLearning
https://redd.it/1hmitcz
Authentication state management reactnative django

so i am a nub, and this is my first project i've created login page and signup and used drf to connect, everything works fine and when i create user and login then i've placed welcome,firstname. now i want to make my app acessible after login and i found out i've to learn autentication state but when searching i can't find any docs or proper tutorial related to the stuff. so plz help guys any docs or tutorial.

/r/django
https://redd.it/1hmjyke
A lightweight Python wrapper for the Strava API that makes authentication painless


**What My Project Does**

Light Strava Client is a minimalist Python wrapper around the Strava API that automates the entire OAuth flow and token management. It provides a clean, typed interface for accessing Strava data while handling all the authentication complexity behind the scenes.
Key features:

* Automated OAuth flow (just paste the callback URL and you're done)
* Automatic token refresh handling
* Type-safe responses using Pydantic
* Simple to extend with new endpoints
* No complex dependencies

**Target Audience**

This is primarily designed for developers who want to quickly prototype or build personal projects with Strava data. While it can be used in production, it's intentionally kept minimal to prioritize hackability and ease of understanding over comprehensive feature coverage.

**Comparison**

The main alternative is stravalib, which is a mature and feature-complete library. Light Strava Client takes a different approach by offering a minimal, modern (Pydantic, type hints) codebase that prioritizes quick setup and hackability over comprehensive features.

The code is available here: [https://github.com/GiovanniGiacometti/Light-Strava-Client](https://github.com/GiovanniGiacometti/Light-Strava-Client)

I'd love to hear your thoughts or feature suggestions!

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