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
How you customise & simplify the Django admin so your non tech savvy client can use it like a CMS?

The title.

/r/django
https://redd.it/1ed2ifj
I've noticed when I try to update my flask database structure it takes much longer than it used to. Why is that?

I just added a model to my Flask project and updated it by running `flask db migrate` and it hangs for a long time here. It happened the last time I changed the project too. The time it takes is about five minutes. `flask db upgrade` is zippy as usual.

Anything I should be checking for?

The table I added just now is a super simple one. A couple small integer and string fields.

/r/flask
https://redd.it/1ed5m45
D Is it even appropriate to be comparing open source LLMs to closed models?

For example comparing LLaMA-3 to GPT-4. To me it doesn't make sense because it feels like comparing a model to an actual product. A product being a model with a bunch of other things that have been applied (e.g., pre-/post-processing techniques).

/r/MachineLearning
https://redd.it/1ed7bg7
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/1ed2too
My first published FOSS | DynamicDict | Yet another dot-access dictionary wrapper.

Here's my first real contribution to the world of open source: https://github.com/gebnar/PythonDynamicDict

What My Project Does

It's a dictionary wrapper that allows attribute access and mutation using both dot notation and dictionary-style indexing.

Target Audience

Production, with caution

Comparison

I found a couple similar serious projects out there that do the same thing. I think mine approaches the space from a slightly different philosophy. My priorities were preserving namespace, making usage feel predictable in a "pythonic" way (whatever that means), and lots of dunders for high interoperability. I also added several safety/convenience features to make usage in production a bit safer, including optional strict typing, key renaming, and a bunch of unit tests.



I knew when I started this that probably a lot of someones had to have implemented something like this before me. But I wanted to learn a bit more about python internals and object behaviors, so I rolled my own version from scratch before reading any of the others.

Having now reviewed some of the competition, I do think I bring some valuable ideas to the table.

I realize this kind of thing is a bit silly. But I've actually found it quite useful. There are lots of ways to use dynamic objects wrong. We all

/r/Python
https://redd.it/1ed8jdt
What is too much type hinting for you?

For me it's :

from typing import Self

class Foo:
def bar(self: Self) -> None:
...

The second example is acceptable in my opinion, as the parameter are one type and the type hint for the actual attributes is for their entire lifetimes within the instance :

class Foo:
def init(self, par1: int, par2: tuplefloat, float):
self.par1: int = par1
self.par2: tuplefloat, float | None = par2

/r/Python
https://redd.it/1edcel1
D what's the alternative to retrieval augmented generation?

It seems like RAG is the de-facto standard of question answering in the industry. What's the alternative?

/r/MachineLearning
https://redd.it/1edbg0h
I love django. A thread.

It’s such a straight forward framework and every time I meet someone who works with sjango, they have an amazing community that they engage with.

It’s really the framework for interesting people doing interesting things. Why do you guys like django?

/r/django
https://redd.it/1edds6d
Deploy a flask app with mysql

Hi, I have a flask app that uses a MySQL database. What services can I use to deploy the website including an SQL server. ik vercel can be used for flask deployments but does it work with mysql too. Currently I'm using a local host MySQL server

/r/flask
https://redd.it/1eddoy8
I made a tool to increment the version of Poetry projects

I was tired of making dirty scripts to bump the version of my projects in CI pipelines, so i think i went a bit overkill and made a dedicated tool for it.

Increasing version is a task that was surprisingly harder than i thought for what it is, as you need to parse TOML and Python files, parse versions, increase the version, update the files and push it to your repo without triggering an infinite loop of pipelines. Also since it automatically update files in your project i guess it should be somewhat reliable too.

Note: this is made only for Poetry projects because it reads poetry sections in the pyproject.toml file.

What My Project Does

After it is installed, you basically use it with poetry-incr-version --patch/minor/major . and it updates the pyproject.toml and the __init__.py file(s) to increase the version, you add-commit-push all of that and you are done !

Target Audience

I am mainly targetting myself lol, but i guess it can be usefull to you if you maintain projects made with Poetry with automatic versionning in CI pipelines.

Comparison

I tried to find similar projects, but i could not, maybe no one does that, or maybe (more probably) i am bad at searching.

The repository is

/r/Python
https://redd.it/1edffk9
I've made some big improvements to my chess openings explorer (Python+Flask)

Hi everyone,

I posted a few days ago about my opening explorer website I'd made. I've made some big updates to it so I wanted to share my progress.

Play here: https://www.jimmyrustles.com/chessopeningtheory

Github: https://github.com/sgriffin53/openingexplorer_app

**What My Project Does**

You play an opening on the board and it shows you wiki articles for each move in the opening as you play through it. It shows the most popular responses in the wiki for each opening with an explanation of each response. It also shows stats from lichess such as winning chances, engine analysis, and historical games. It's intended to be a tool for opening analysis and study.

**Target Audience (e.g., Is it meant for production, just a toy project, etc.**

My audience is chess players and enthusiasts who are interested in studying openings. I think this could be a valuable tool for studying openings for chess players of all levels.

**Comparison (A brief comparison explaining how it differs from existing alternatives.**

The main comparison to this is the Lichess opening explorer, which is similar in many ways. The Lichess opening explorer gives you a page from the wiki (though a shortened version compared to mine) and gives the responses based on winning percentages.

Mine is different in that it shows you

/r/Python
https://redd.it/1ed2gy3
Pythonic HTTP compatible data acquisition & control system for scientific/engineering applications

You can expose your devices/hardware on HTTP to control and capture data from them remotely. Write dashboards, web apps or make them as part of IoT integrations. Technically, its an implementation that allows distributed systems, so you can start off with something as simple as controlling your hardware locally in one computer; also with ZMQ interprocess communication so that you don't have to bother about networking concepts. One can continue further to create a fully networked control system with HTTP or ZMQ over TCP. In this way, one can also learn how to do data-acquisition step-by-step in a Pythonic way.

The package embraces Python whole-heartedly rather than trying to be a multi-language tool. For interoperability, Web of Things standards are supported to a decent extent. There are client tools available for javascript, rust etc.

BSD licensed, I believe in fork and do what you want philosophy - please find it here : https://github.com/VigneshVSV/hololinked

Target audience are scientists and engineers with lab hardware, university students, research labs who are looking for a decent modern tool for remote control to manage their lab hardware and the data that comes out it. Individual projects where remote data logging is necessary, IoT

/r/Python
https://redd.it/1edpc1u
What UI library do you recommend?

I am currently working on an app to display basic computer metrics (CPU, GPU, RAM, HDD, etc.) along with a quick action/quick launch for use on the computer. I am wanting it to be a modern looking application, but don’t know what to use.

I’m a Java developer for work, but I am wanting to broaden my horizons in development languages.

I have some experience with tkinter and PySimpleGui, but don’t know if they would be a modern solution.

/r/Python
https://redd.it/1edqp8l
My first ever project! Any suggestions would be appreciated.

What My Project Does

My project is a simple number guesser that I made from my basic knowledge of python.

Target Audience

Just a fun toy, pretty bare bones.

Comparison

Doesn't really compare to anything, just a fun project

https://github.com/voltxge33/My-first-project

/r/Python
https://redd.it/1edrv44
POST request not being sent after successful preflight request/response on iphone

Hello,

I have a static web page with a form that sends data to a flask app on heroku. On desktop it works fine to send the data and getting it stored in the flask app.


however when trying to do the same thing on the mobile version site, a preflight (OPTIONS) request is sent, and a 200 ok response is sent back with the xcsrf token and the allowed headers etc.

but then after this, no subsequent POST request is being sent with the actual data.

Anyone knows if this is a known issue with iphone? Or if it should work?

/r/flask
https://redd.it/1ebzf67
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/1edud5n
How to you guys sharpen your coding skills?

How do you guys sharpen your coding skills, is it by coding challenges like leetcode or coders or doing random projects,

Me i do a ton of coding challenges and I want your suggestions to sharpen my skills more

one more question how do you guys find good open-source project to contribute?

/r/Python
https://redd.it/1eduua5
How much Python should I learn to start with Django and what are the resources that you would recommend?

So as the title suggests, I want to start with Django mainly because I really want to contribute to an open-source organization for the upcoming GSoC 2025.

A bit about my coding experience:

I know JavaScript. In fact, it was the first language that I ever learned.
I learned React and Node.js too.
I built some projects with them (for example, a real-time multiplayer chess app).
I learned Data Structures and Algorithms in the past 2 months in C++ (I chose this because everyone suggested me to do so).

As you can see, I am not a complete beginner in this programming space. The problem is, I just don't know Python, and to contribute to that open-source organization (which uses JS and Django mainly), I would really need to learn Python first and then Django.

So now lets get to the point i.e. how much python do i need to learn to start with Django? What are all the resources(documentations or courses) that you would recommend to get started with python and then subsequently to Django?

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