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
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
Can I use flask in production?

I'm building a basic API to use with reactjs or nextjs and I think Django is overkill.

Is flask good in production? Any pointers appreciated?

/r/Python
https://redd.it/1ee2r83
Should I choose Next.js or pure HTMX over Django?

I'm working on a startup and planning to build the backend using Python. I'm not a big fan of JS frameworks, so I prefer to let AI handle that while I focus solely on the backend without AI assistance. My current project aims to provide users with low-latency data.

1. Would I be making a mistake by choosing Next.js for the frontend?

2. Is it worthwhile to consider using HTMX with FastAPI or HTMX with Django for this project?

/r/django
https://redd.it/1ee67y3
developing a project management interactive dashboard

Greetings,


I'm considering to develop an interactive dashboard that allows the below features


- allows orchestrating tasks between different teams, along with the ability to track the progress

- generate automated reports based on a predefined template

- has an interactive dashboard so I can see the number of tasks per X time and their status

- can be connected to Excel sheet as an input source


would you please advice on what libraries should I use and whether this work is a daunting task and I should go for a vendor-tool? I know the answer would depend on the details of my context, however I'd like to have a general estimation


thanks in advance





/r/Python
https://redd.it/1ee51yz
system design mock interviews

Where should i take mock interviews on system design so i can learn more and improve myself

/r/flask
https://redd.it/1ee551q
How to pass context to render_template?

Hi,
I use Flask with htmx. In case its a normal request, I call `render_template` as usual. But in case the request is coming from htmx, I want to return only a part of the template.

I've created two templates each time I need to return either or.
```jinja2
# login.html
{% extends "base.html" %}
{% block main %}
{% include "login_form.html" %}
{% endblock main %}
```

```jinja2
# login_form.html
<form>
...
</form>
```

In my route I can easily do:
```python
from flask import render_template
if htmx: template = "login_form.html"
else: template = "login.html"
return render_template(template, ...)
```

Now I came across [Jinja2-Fragments](https://github.com/sponsfreixes/jinja2-fragments) which allows to render only individual blocks of a template. That means I wouldn't have to create the wrapper templates, which would be desirable.

Problem is, I now end up with something like:
```python
from flask import render_template
from jinja2_fragments.flask import render_block
if htmx: return render_block("login.html", "main", ...)
else: return render_template("login.html", ...)
```

Okay, cool. But if I pass n variables as context to the template, I have to repeat those in both function calls. Not exactly DRY.

I could create a dict like `vars = {"var1": var1, "var2": var2, ...}` and pass that to both function calls, but then in the template I need to prefix all variables with `vars.var1` which is not so pretty either.

Is

/r/flask
https://redd.it/1eebend
Cli scraper Dedicated to Alibaba v0.2.0

I have already showcased this package project. I just want to inform you all about my package evolution.

What My Project Does ?

Gathering data from Alibaba based on keywords provided by users and save them in database MySQL/sqlite

Targeted Audience

Thoses who want to build an ALIBABA datasets for analysis.

Comparisons

Asynchronous request to handle many page results.

New features:

Set your bright data api key to use async mode.

Export your scraped data to csv file (you must to have an updated sqlite file which will be converted to csv).

Future enhancements:

Add a rag to chat with your database and let him do your SQL query for you .
This will probably the least feature that in planning to add to this project.
Maybe I will make it croos plateform. Cause now it's only works on windows.


Still looking for testers an reviews and suggestions to improve.

Do you think this package have a potential to grow ? Is it useful ? If not how to make more interesting ?

Here is the repo : https://github.com/poneoneo/Alibaba-CLI-Scrapper

Also excuse me for orthography errors on 'scraper'
I'm find a way to rename my package but its seems to be hard and risky and I dont want to

/r/Python
https://redd.it/1ee79hd
Django seems like a full-stack framework as opposed to a back-end framework, Is it right for me if I'm looking for a back-end framework?

Title basically sums it up. I wanna get into Django but the tutorials I've seen so far make it seem like it's more of a full-stack framework, and this is making it really difficult for me to know what I'm learning?

I plan on using it with frameworks like React, HTML, CSS, Next.js and more.

This might be a dumb question but I really need to know. Thanks!

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