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
simplesi - a units-aware package for engineers

GitHub Link: [https://github.com/jkbgbr/simplesi](https://github.com/jkbgbr/simplesi)

**What my project does**

simplesi is a package for units-aware engineering calculations with the primary scope to be used in applications / calculation documentation rather than interactive environments.

simplesi provides:

* A means of defining SI and non-SI unit environments, possibly at a package-external location.
* Arithmetics, comparisons etc. with units-aware quantities - use them as regular numbers.
* Options to set printing and error handling behaviour.
* Substantial speedup when compared to [forallpeople](https://github.com/connorferster/forallpeople) or [pint](https://github.com/hgrecco/pint).

The project is used in production environment, but should be considered beta as only the structural environment is actively used. Testers, contributors etc. are welcome, the project will be actively maintained in the forseeable future.

Though the current scope is as stated above, I'm not against enhancements towards jupyter, numpy etc. usage; these are likely possible already now but not tested.

**Target audience**

* Whoever needs to use units in their calculations - probably engineers, engineering students.

**Why I made this**

I work as design engineer and got frustrated over issues with both forallpeople and pint in my use cases.

/r/Python
https://redd.it/1khjfmo
TIL that a function with 'yield' will return a generator, even if the 'yield' is conditional

This function (inefficient as it is) behaves as expected:
def greet(as_list: bool):
message = 'hello!'
if as_list:
message_list = []
for char in message:
message_list += char
return message_list
else:
return message


>>> greet(as_list=True)
['h', 'e', 'l', 'l', 'o', '!']
>>> greet(as_list=False)
'hello!'


But what happens if we replace the list with a generator and return with yield?
def greet(as_generator: bool):
message = 'hello!'
if as_generator:
for char in message:
yield char
else:
return message


>>> greet(as_generator=True)
<generator object greet at 0x0000023F0A066F60>
>>> greet(as_generator=False)
<generator object greet at 0x0000023F0A066F60>


Even though the function is called with as_generator=False, it still returns a generator object!

Several years of Python experience and I did not know that until today :O

/r/Python
https://redd.it/1ki1qem
all routes with rendertemplate() stopped working after deleting and recreating database.

I deleted my posts.db and suddenly after creating a new one all of the routes that end with return render\
template() don't work anymore, they all return 404. I deleted it after changing around the User, BlogPost and Comment db models. It worked perfectly fine before. I'm following a course on Udemy to learn Python btw

https://github.com/ldclaura/helpme/tree/main/helpme1

/r/flask
https://redd.it/1ki5i0m
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/1ki537m
What problems in the Django framework still have no direct solution?

Good day, everyone. I am planning to create an extension or a Django app specifically aimed at providing solutions to recurring problems that affect the development process—particularly those that cause headaches during integration or development.

This thread is a safe space to share suggestions, constructive criticism, and ideas for improvement, all with the goal of making Django more efficient, developer-friendly, and robust.

Your input is valuable and highly appreciated. Let’s work together to enhance the Django ecosystem.

/r/django
https://redd.it/1kias7m
Could anyone help us with this program problem?

my wife and I have been going to couples therapy and we've been assigned to work on something we both like. We've both enjoyed robotics back in school so we bought the maqueen plus. We've hit a wall with our program. It's supposed to be going around the black edge and stopping at the top opening (as you could see if you try it). The problem is if he even stays on track long enough, he doesnt stop at the white opening. If anyone knows how to fix our bug, we'd be so grateful.

from mbrobot import *

RobotContext.useBackground("sprites/field2.gif")

rightArc(0.1)

delay(1000)

forward()

def aufDerKanteFahren():

count = 0

if count == 0:

forward()

vR = irRight.read_digital()

vL = irLeft.read_digital()

if vR != 1 or vL != 1:

count += 1

if count == 1:

if vL == 0 and vR == 0:

rightArc(0.1)

delay(300)

count +=1

elif vL == 0 and vR == 1:

leftArc(0.1)

delay(300)

count +=1

elif vL == 1 and vR == 0:

rightArc(0.1)

delay(1000)

count +=1

elif count == 2 and vR == 1 and vL == 1:

stop()

print(count)

setSpeed(50)

while True:

vR = irRight.read_digital()

vL = irLeft.read_digital()

aufDerKanteFahren()

delay(100)

/r/IPython
https://redd.it/1kic4ts
Every script can become a web app with no effort.

When implementing a functionality, you spend most of time developing the UI. Should it run in the terminal only or as a desktop application? These problems are no longer something you need to worry about; the library Mininterface provides several dialog methods that display accordingly to the current environment – as a clickable window or a text on screen. And it works out of the box, requiring no previous knowledge.

What My Project Does

The current version includes a feature that allows every script to be broadcast over HTTP. This means that whatever you do or have already done can be accessed through the web browser. The following snippet will bring up a dialog window.

from mininterface import run

m = run()
m.form({"Name": "John Doe", "Age": 18})

Now, use the bundled mininterface program to expose it on a port:

$ mininterface web program.py --port 1234

Besides, a lot of new functions have been added. Multiple selection dialog, file picker both for GUI and TUI, minimal installation dropped to 1 MB, or added argparse support. The library excels in generating command-line flags, but before, it only served as an

/r/Python
https://redd.it/1kie6uw
: are replaced with \x3a

this is i have set in the .env file

DATABASE_URL=mysql+pymysql://root:@localhost/test_flask_db

os.getenv("DATABASE_URL",'')

mysql+pymysql\\x3a//root\\x3a@localhost/test_flask_db

if i access like this then im getting : are replaced with \\x3a

how can i solve this issue.

/r/flask
https://redd.it/1kierwb
I feel stuck, books recommendations?

I’ve been programming in python for almost 2 years. I love python and I’m focusing in data analytics using python.

I’m tired of watching YouTube videos and tutorials, do you guys have some books to recommend?

I’m looking to improve my programming skills in general, to understand in a deeper level how python works or useful things to know about it idk.

I haven’t read any programming books in my life so idk what they talk about haha

Preferably, intermediate level books.

Thank you!


/r/Python
https://redd.it/1kif0pz
I built cutieAPI, a Python CLI tool for interactive API testing with a Rich TUI.

I created CutieAPI, a terminal-based, beginner-friendly API manager.

Most beginners are intimidated by curl commands—I was one of them too! That’s why I built this tool to simplify API interactions in the terminal.

Check it out and let me know what you think!

here github link :

https://github.com/samunderSingh12/cutieAPI.git

/r/Python
https://redd.it/1kie6tn
Looking for Full Stack Django Engineer (Django/Angular)

I work for a large public sector software company and I am looking to hire a full-time Django full stack engineer (US citizens only due to security compliance for some of the data we deal with). We are deciding between Django or .NET for the backend, and it will largely be dependent on the best resource we find and their skill set. On the frontend, we are are planning to use Angular (to be consistent with our other applications).

I have hired two other Django developers that I found through this subreddit in the past, and they both have been awesome, so hoping for a similar experience again.

The job is located in College Station, TX. In a perfect world, the candidate we choose would be close to this location, but I am open to hiring a remote resource if we can't find the right person close (some travel will be required, especially at the beginning if this is the case). The primary reason we would like the resource to be close is that they will need to work with the existing product team to understand the existing product in order to build automation and tooling to simplify the configuration and deployment

/r/django
https://redd.it/1kii3az
JetBrains will no longer provide binary builds of PyCharm Community Edition after version 2025.2

As the title says, PyCharm Community Edition will only be available in source code form after version 2025.2

Users will be forced to build PyCharm Community Edition from source or switch to the proprietary Unified edition of PyCharm.

https://www.jetbrains.com/help/pycharm/unified-pycharm.html#next-steps

/r/Python
https://redd.it/1kitdld
I made a Vim Game in Python

I made a vim game in python using pygame. I would describe it as if Letter Invaders from Typing Tutor 7 had vim motions. It is in the early stages of development, so please go easy in the comments.

\#What My Project Does

It is a vim game in pygame designed to help the user build up speed and familiarity with the vim motions

\#Target Audience

People who use vim and want to become fast with the motions

\#Comparison

Alternative games include VimBeGood and Golf.Vim. This is closer to VimBeGood, in that it focuses on building up speed, rather than giving the user a single puzzle to study.

\# Repo

https://github.com/RaphaelKMandel/chronicles-of-vimia

/r/Python
https://redd.it/1kiseo7
How to deploy?

Hello guys !! Iam new to flask , learnt and made a small application using flask , HTML , CSS , JS . Iam not understanding how to deploy it? . Iam from MERN stack background . I use vercel , netlify , firebase more to deploy those . But iam stuck with flask deployment . Can anyone help me out?

/r/flask
https://redd.it/1kiozil
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/1kix1lf
What's New in Wagtail is NEXT week!

/r/django
https://redd.it/1khxegv
I uploaded my flask app in a shared hosting with cpanel, but getting 404 error

I uploaded my flask app and install that app as a package. I have no terminal access beacuse of shared hosting. All i can do is run script through cpanel run-script interface.

if i include blueprint or routing in __init__.py, at the root of the package where passenger_wsgi.py located all routing works without any error. But if i have routing or blueprints in app.py, even in that same directory, i get 404 error.

what is the solution, is there will be any problem if i use __init__.py
thanks in advance.

/r/flask
https://redd.it/1kizc3x
Kamal deploy makes database upgrades effortless.

/r/django
https://redd.it/1kj6xkj
D Best Way to Incorporate Edge Scores into Transformer After GNN?

Hi everyone,

I’m working on a social recommendation system using GNNs for link prediction. I want to add a Transformer after the GNN to refine embeddings and include score ratings (edge features).

I haven’t found papers that show how to pass score ratings into the Transformer. Some mention projecting the scalar into an embedding. Does adding the score rating or the relation scalar is not recommended ?

Has anyone dealt with this before please?

/r/MachineLearning
https://redd.it/1kj7ylw