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
NVIDIA Graphics Card Update Check

# What my Project does?

Since NVIDIA only notifies you about new Graphics Driver updates if you use the GeForce Experience app (which causes stuttering in some games), I’ve come across the idea to create a simple GUI application on Windows, that can do those checks and notifications without the GeForce experience App. This App ist written 100% in Python and uses the wxPython GUI library.

# Target Audience

It is a very simple app and also perfect for some Python beginners if you are interested in doing some collab work.
Also it is for every Windows user, that does not want to use GeForce Experience, but still want to be notified about the newest driver updates.
The app is ready to use, but there is still room for improvements. More information on Github - pyvidia-update

# Comparison

GeForce Experience
- not open source
- needs huge resources
- collects user data

TinyNvidiaUpdateChecker
- Written in C#


/r/Python
https://redd.it/1dxwahg
Corey Schafer's Django course in 2024?

i have started learning Django from corey schafer's tutorial and no doubt that man is the king but the course is 4 years old

i wanna ask if its okay if i learn django from it or will i miss out alot of stuff

basically is it a good resourse to learn django in 2024?

/r/djangolearning
https://redd.it/1dxjsh9
My School project is done !

Hello Hello !

It's been 2 weeks that my teammates and me ended up our school project. We tried to build a consistent dating web app using django framework in one month.

As young student without any basics in web dev except in Html and Css at the beginning of the project, we worked hard to build the best we can do in each month. The recommandation system we built is not scalable but you can also check it and give us some recommandations.

The Instructor give us 16/20 for our presentation and we think we can do better now.

We need your appreciations, yours corrections, advice for future project and also stars on our reposit haha.

So please can you take some minutes to check this link : https://github.com/rosasbehoundja/PIL1\_2324\_2/tree/main

For any comment or correction , you can DM me or send me a mail at behoundjatode@gmail.com Thank you for your support.

/r/djangolearning
https://redd.it/1dxey8b
Concept showcase: Auto-generated python bindings for a command line tool

## What my project does

kicadcliwrapper is less intented to be a standalone project and more of a concept showcase. The idea is to auto-generate python bindings for a command line tool by traversing the help tree recursively of all subcommands. The result is a python wrapper that can be used to interact with the command line tool in a more pythonic way. By generating dataclasses for the commands and argumets, users can leverage the power of type hints and IDE autocompletion.

## Target Audience

This project/concept is intended for developers who want to create a python wrapper for a command line tool. It is especially useful for tools that have a lot of subcommands and arguments.
The project itself is useful for people interacting with the open-source electronics design automation software KiCad.

## Comparison

- clinto; Other way around. Generates generic JSON description of python CLIs
- clize: Also other way around. Generates CLI from python functions.


## Resources:

Check this explanation/examples of the multi-level parsers: PARSER.md

/r/Python
https://redd.it/1dy2fvy
Whenever: a modern datetime library for Python, written in Rust

Following my earlier blogpost on [the pitfalls of Python's datetime](https://www.reddit.com/r/Python/comments/1ag6uxc/ten_python_datetime_pitfalls_and_what_libraries/), I started exploring what a better datetime library could look like. After processing the initial feedback and finishing a Rust version, I'm now happy to share the result with the wider community.

GitHub repo: [https://github.com/ariebovenberg/whenever](https://github.com/ariebovenberg/whenever)

docs: [https://whenever.readthedocs.io](https://whenever.readthedocs.io)

# What My Project Does

*Whenever* provides an improved datetime API that helps you write correct and type-checked datetime code. It's also a lot faster than other third-party libraries (and usually the standard library as well).

**What's wrong with the standard library**

Over 20+ years, the standard library `datetime` has grown out of step with what you'd expect from a modern datetime library. Two points stand out:

**(1) It doesn't always account for Daylight Saving Time (DST)**. Here is a simple example:

bedtime = datetime(2023, 3, 25, 22, tzinfo=ZoneInfo("Europe/Paris"))
full_rest = bedtime + timedelta(hours=8)
# It returns 6am, but should be 7am—because we skipped an hour due to DST

Note this isn't a bug, but a design decision that DST is only considered when calculations involve *two* timezones. If you think this is surprising, you are not alone ( [1](https://github.com/python/cpython/issues/91618) [2](https://github.com/python/cpython/issues/116035) [3](https://github.com/python/cpython/issues/112638)).

**(2) Typing can't distinguish between naive and aware datetimes**. Your code

/r/Python
https://redd.it/1dyb8gn
django is second in most github stars for backendframeworks

/r/django
https://redd.it/1dy0env
What’s your go to flask extensions, frontend, db, and overall setup for dev?

I just started learning flask with HTMX and I want to boost my productivity so I can work on personal projects as soon as I grasp the basics within the framework.

/r/flask
https://redd.it/1dxxqhj
help a beginner out here guys, need it

so, I am new here in Flask, I studied the concepts 10 days ago, and now I am working on a small project that is namely "Management System"


I have to create 3 user options User, Admin, and Manager


the front page says "Create an Account, Login, Contact Us"


quick question, should I change contact us form for users who have created an account or should I keep it universal?

https://preview.redd.it/y00265og49bd1.png?width=919&format=png&auto=webp&s=f81a663f3a562b5ab4029f78551220e63d0e99be

i probably have 3-4 questions too, so if ok by your side, help me out...!

/r/flask
https://redd.it/1dy3cr0
STOP USING DJANGO (meme)

/r/django
https://redd.it/1dylc29
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1dyo8uq
On Walrus Operators, List Comprehensions and Fibonacci sequences

Edit: Fixed fibonacci2 to be a more valid comparison, and it won.

I was playing around with Walrus operators, to figure out where I could/not use them. I thought that generation of Fibonacci sequences might be an interesting case study because it involved keeping 2 prior values from a calculation around, so I gave that a go.

Take a look at the following code.

fibonacci1() is a surprise, in that it worked at all, but you can apparently do Walrus assignments inside list comprehensions, and it works, but I haven't been able to find any way to avoid the extra tuple construction/destruction in the middle of that, so it's performance is pretty terrible.

fibonacci2() is just a fairly vanilla implementation for comparison. Turns out to be fastest.

fibonacci3() is quite fast. Note the use of the Walrus operator in the RHS of a double assignment, so I could concurrently do "a, b = b, a+b" and assign the a+b into the result.

fibonacci4() was just for comparison as a generator approach. It performed OK, but I expect all the state management imposes too much overhead.

In all cases, pre-initializing the list helped performance a lot.

The Output:

fibonacci1: 0, 1, 1, 2, 3, 5, 8,

/r/Python
[https://redd.it/1dypvkr
Streaming Chatbot with Burr, FastAPI, and React

Hey r/python,

I've been seeing a lot of people having issues managing server-side events for streaming, especially with user-facing AI applications.

What My Project Does

I wrote a full-stack guide about how to do this using a few different python frameworks. We represent the logic of the chatbot with Burr (a simple state machine framework, I am one of the creators), and serve it with FastAPI. While it has some frontend/typescript tooling, the majority of the post is about how to build a simple but extensive chatbot server. Even if you're AI-skeptical/cynical (like me) there's some useful stuff here on managing server-side-events/streaming responses back. Turns out its all pretty simple.

I really like the way the code shaped out, so I wanted to share it!

Blog post: [https://blog.dagworks.io/p/streaming-chatbot-with-burr-fastapi](https://blog.dagworks.io/p/streaming-chatbot-with-burr-fastapi)
Example code: https://github.com/DAGWorks-Inc/burr/tree/main/examples/streaming-fastapi

Target Audience

This is meant for BE/full-stack developers. Aimed to be production ready (we've observed this pattern in use in prod by a few different OS users).

Comparison

Burr is similar to tools like langgraph. FastAPI is one of many web-serving frameworks (but my personal favorite). I wrote this guide so the components are loosely coupled -- wanted to make sure users could still get value if they weren't using all the same tooling. FWIW you can easily run

/r/Python
https://redd.it/1dyeqj2
Static Files issue with Vercel

I am working on a Invoice Management system with django itself and I wanted to deploy it on vercel but the static files are not being served properly in the deployment but works fine in the local environment. what could be the cause? If anyone interested to colaborate you're welcome!

Note:- I haven't added any config for static files expect this "collectstatic" command

/r/django
https://redd.it/1dz1gvn
Crawlee for Python is LIVE 👏

# What My Project Does

Hi everyone, our team just launched [Crawlee for Python 🐍](https://github.com/apify/crawlee-python/). It's an open-source web scraping and automation library, which provides a unified interface for HTTP and browser-based scraping, using popular libraries like [beautifulsoup4](https://pypi.org/project/beautifulsoup4/) and [Playwright](https://playwright.dev/python/) under the hood.

# Target Audience

We've spent the last 6 months working on Crawlee for Python, but it didn't come out of nowhere. We designed it based on the [JavaScript version](https://crawlee.dev/), which is now 8 years old, and we hope we can say it's battle-tested.

We are opening it for [early adopters](https://github.com/apify/crawlee-python/issues/269) today, and we are eager to hear your feedback. Help us shape the future of Crawlee for Python!

# Comparison

Why use Crawlee instead of just a random HTTP library with an HTML parser?

* Unified interface for HTTP & headless browser crawling.
* Automatic **parallel crawling** based on available system resources.
* Written in Python with **type hints** - enhances DX (IDE autocompletion) and reduces bugs (static type checking).
* Automatic **retries** on errors or when you’re getting blocked.
* Integrated **proxy rotation** and session management.
* Configurable **request routing** - direct URLs to the appropriate handlers.
* Persistent **queue for URLs** to crawl.
* Pluggable **storage** of both tabular data and files.
* Robust **error handling**.

Why to use Crawlee rather than Scrapy?

* Crawlee has out-of-the-box support for **headless browser** crawling (Playwright).
* Crawlee has a **minimalistic & elegant interface** - Set up your scraper with fewer than 10 lines of

/r/Python
https://redd.it/1dyyaky
Syscall Showdown: Python vs. Ruby

Last time I showed how to count how many CPU instructions it takes to import seaborn and how to record and visualize system calls that your Python code makes.

We've since added support for Ruby to the tool that enabled all that, so naturally I had to check how Python compares to Ruby when it comes to syscall usage in some common situations: file IO, generating random numbers, telling time and even just printing a string.

Here's the blog post: Syscall Showdown: Python vs. Ruby.

Turns out there might be space for optimizations!

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