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
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
A pytest plugin to run async tests 'concurrently'

**What My Project Does**

System/Integration tests sometimes can take really long time, due to spending huge amount of time waiting for external services responding. Pytest-asyncio make async tests testable, but run them sequentially. Pytest-xdist spinup multiple processes, blew up our fragile server during tests collection :(

* This plugin is to solve this by running asynchronous tests in true parallel, enabling faster execution for high I/O or network-bound test suites.
* Also give you high flexibility to specify tests that can run in parallel.
* Compatibility with Pytest-asyncio if you are already deep in rabbit hole.

**Target Audience**

The plugin is mainly targeted system/Integration tests, which is heavily bounded by I/O, network or other external dependency.

This plugin would more or less Break Test Isolation Principle. So make sure your tests is ok to run concurrently before you use this plugin.

**Comparison**

As mentioned above, unlike `pytest-asyncio`, which runs async tests sequentially, `pytest-asyncio-concurrent` takes advantage of Python's asyncio capabilities to execute tests concurrently by specifying async group.

**Try this out!**

Welcome to try this out, and let me know your feedback!

Github link: [https://github.com/czl9707/pytest-asyncio-concurrent](https://github.com/czl9707/pytest-asyncio-concurrent)
PyPI: `pip install pytest-asyncio-concurrent`

/r/Python
https://redd.it/1hmots3
I am using react for front end should I skip going deep about views and templates?

I am learning django, using the docs and django books written by william. My question is should skip learning too deep about templates and such that are used for creating ui and focus on only backend and jump straight to django for apis book?

/r/django
https://redd.it/1hmqlx7
YTMASC, take your YouTube music library to anywhere!

GitHub

I've been developing this tool for quite a while now, but was hesitant to share it because I had many things in mind to implement. However I'd like to share the project as about half of the stuff is in there and functional.

# What My Project Does

YTMASC gets your library by:

Scraping your YouTube library page (yes I know this is a horrible way of doing it but it's the easiest, I've something else in mind don't worry but it'll be the least of my priorities :D)
Imports RiMusic databases (also ViMusic since the fork didn't change the database schema)
A CSV file of your own that has 3 columns (\watch_id, artist, title)

And puts data from these sources into a simple json file. The information here is later used at the tasks you want to run.

Also, there are some tools to help you fix any issues you may run into (YouTube making the video unavailable, migration of old libraries etc.)

It's mainly available as CLI with a config file you can tinker with, I had written a tkinter GUI before but I don't want to maintain it anymore due to it being well, unmaintainable because I didn't think I'd be developing

/r/Python
https://redd.it/1hmnzg9
🌀 Interstice: The Zero-Player Game Simulator

PyPI | Website | GitHub

Hey r/Python!

I’m excited to introduce Interstice, a zero-player game simulator that explores emergent behavior on a 2D grid. This Python package brings to life complex systems where entities evolve according to simple rules perfect for those curious about simulation, artificial intelligence, and game theory.

# What My Project Does

Interstice is a zero-player game, meaning there’s no user input once the game begins. The simulation evolves autonomously based on pre-defined rules:

Entities: Different "agents" (like Demons and Soldiers) interact on a grid.
Interactions: These agents follow unique behaviors that create emergent patterns.
Visualization: See the grid evolve in real-time through a webpage.

This game lets you experiment with different rules, initial states, and grids to discover the fascinating results of these interactions.

# Target Audience

A fan of games like Conway's Game of Life or Langton's Ant,
Curious about emergent behavior in autonomous systems,
Interested in creating interactive simulations for fun or research

# Comparison

Interactive: Modify rules and observe changes on the fly.
Python-first: Built with Python developers in mind, making it easy to extend.
Creative: Design unique simulations that explore autonomous systems.

# Check it Out

PyPI Package: Install with pip install interstice
Website: [bananajump.com/interstice](https://bananajump.com/interstice)
GitHub Repository: https://github.com/interstice-stack/interstice

# 🏆 Win

/r/Python
https://redd.it/1hmiata
Friday Daily Thread: r/Python Meta and Free-Talk Fridays

# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

## How it Works:

1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

## Guidelines:

All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.

## Example Topics:

1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟

/r/Python
https://redd.it/1hn1s3d
Spotify Scheduler - Easily schedule your Spotify playlists to play at a specific time!

What My Project Does
Spotify Scheduler is an app that lets you schedule Spotify playlists to play at specific time (hours, minutes and seconds) (e.g. 8:00-8:15:30). You can use it to automate your listening experience and customize playback times according to your preferences. You can select different playlist for each time slot.

Target Audience
It's ideal for PA systems, school, or just automating music playback at home.

Comparison
I couldn't find any alternatives, so i did this app. The reasonable alternatives are radio automation softwares, but my app is much easier to use.

Github repository: https://github.com/sandrzejewskipl/spotify-scheduler

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