Python Daily – Telegram
Python Daily
2.57K subscribers
1.49K photos
53 videos
2 files
39K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
D Neurips 2024 Hotel Roommate Search

The hotels around the venue for Neurips 2024 are pretty expensive, and I'm looking for a roommate to split the cost with (my university has a limit on the nightly hotel rate they are willing to reimburse). I currently have reserved a room for Tuesday-Sunday in the Century Plaza Hotel, which is 0.9 miles from the convention center. The nightly rate is $414. If anyone wants to split the cost of a room, please reach out! Also, it would be helpful if you could share this post with your research group or other attendees that you know.

If you are unsure about rooming with a complete stranger, you can get to know me a little bit through my personal website (https://mtcrawshaw.github.io/), which has links to my google scholar page, CV, etc. I do have a paper at the conference in the area of federated learning/distributed optimization. Just a grad student trying to make conferences affordable! Thanks.

/r/MachineLearning
https://redd.it/1gs0gj8
Game 987, Like 2048 but Fibonacci (Made in Python)


https://987.reflex.dev/


What My Project Does

From Adhami the author: I was wondering how 2048 would feel like if instead of powers of two, we can merge consequent fibonacci numbers. Turns out to be a rather interesting game that is fairly forgiving and grows very slowly. I found it difficult to come up with an overall strategy. I had a simple search algorithm that was able to achieve a score of exactly 66,666 (not joking). Getting a 987 block shouldn't be difficult.


You can take a look into the code here: https://github.com/adhami3310/987 (the simple search algorithm is inside the code as well)

Target Audience: Anyone

Comparison: Similar to 2048 but fib



/r/Python
https://redd.it/1gs56f7
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/1gsaiu7
I played a minute-long video in Windows Terminal

I recently worked on a project combining my love for terminal limits and video art. Here’s what I achieved: • Rendered a 1-minute-long (almost two) ASCII video in the terminal, without graphics libraries or external frameworks. • Used true 24-bit colors for each frame, offering deeper color representation in terminal-based projects. • Processed 432 million characters over 228 seconds, translating each frame’s pixels to colors. • Optimized performance with multi-processing, running on an integrated graphics card.

Specs:

• 30 FPS
• 160,000+ characters per frame
• 2,700 frames
• 3 pixels per character for better performance

For further optimization, I reduced the font size to 3 pixels and used background colors to handle brightness.

What my project does?
While not the most practical project, it’s an experiment I’m satisfied with it. No real use, but hey, it’s fun!

Target audience
This is more of a fun project so I can't say it has a specific target audience, but I could say that people that strangely feels good coding "useless" things might like it.

Comparison
Well it is not an ASCII player anymore to be precise, but what it does now is just display video in the terminal using basically pure ANSI, I

/r/Python
https://redd.it/1gro3kl
Hidden Trigger: Unlock Python’s Built-in Debugging Superpower with PDB

Alert: New Python Tutorial!
Did you know Python has a built-in debugger that can turn you into a bug-slaying detective? In just 5 minutes, learn all the secrets to enhance your debugging skills by using the built-in PDB tool to track down errors, set breakpoints, and inspect your code like a pro!

**tutorial link**

/r/Python
https://redd.it/1gsdcj8
Yami - A music player made with Tkinter Now on pypi!

I would like some user feedback
**Github Link:** [https://github.com/DevER-M/yami](https://github.com/DevER-M/yami)
**Pypi Link:** [https://pypi.org/project/yami-music-player/](https://pypi.org/project/yami-music-player/)
**Some of the features**

* ***mp3 , flac, and many audio formats supported for playback***
* ***Clean UI***
* ***Can download music with art cover***
* ***it is also asynchronous***

**Libraries used**

* customtkinter
* spotdl
* mutagen

**Target audience**
This project will be useful for people who do not want ads and want a simple user interface to play music

**Comparison**
There are currently no projects that have all the features covered and is made with tkinterTo use this install all requirements in the .txt file and you are good to go

**RoadMap**
I will update it now and then

A follow would be nice! [https://github.com/DevER-M](https://github.com/DevER-M)

/r/Python
https://redd.it/1grzxre
Have started the django doc again, and got stuck.

At this part of "Writing your first app", I try to type in "py manage.py startapp polls" and it shows "ModuleNotFoundError: No module named 'polls". Why is that?

/r/djangolearning
https://redd.it/1grq58d
🚀 Feature Friday: PostgreSQL Connection Pools!

Welcome to this week's Django Feature Friday on PostgreSQL Connection Pools!

This small-but-mighty change lets you enable connection pooling with a single line in your settings. This reduces the overhead of accessing your database, leading to improved performance.

You can turn it on like this:

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
# ...
"OPTIONS": {
"pool": True,
},
},
}

If you want fine-grained control over your connection pools, you can also explicitly configure them by passing in a dictionary of settings:

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
# ...


/r/django
https://redd.it/1grwhlk
P Analysis of why UMAP is so fast

Hi, I recently spent some time to understand the core implementation of the UMAP algorithm from the point of view how it was implemented and why it's so fast (even though it's in python). I decided to decompose the algorithm into smaller steps in which I add some minor improvements to the code (one by one), so that at the end the final results are very similar to what I can get from the UMAP.

To my surprise, most of these changes were just tricks in the optimization code to run things faster or update less important things less often. Of course, my implementation does not reproduce the UMAP algorithm in 100% as it was done in the educational purposes.

I provided a detailed explanation in my project of what I had to add in each step to move towards UMAP like algorithm. Here is the project page: https://github.com/kmkolasinski/nano-umap

If you are a person like, who likes to optimize the code for performance you may find this interesting. Here is a demo what I was able to get:

https://preview.redd.it/eww57c3x881e1.png?width=1921&format=png&auto=webp&s=ed4a345e40b47782ddf39cb93eb9d03207db1160

TLDR: in UMAP they:

use ANN library to quickly find top k-NN,
use good initialization method which makes things more stable and algorithm requires

/r/MachineLearning
https://redd.it/1gsjfq9
fxgui: Collection of Python Classes and Utilities designed for Building Qt-based UIs in VFX

Hey Python enthusiasts! Any VFX folks here? I've developed a little package called `fxgui` \- a collection of Python classes and utilities designed for building Qt-based UIs in VFX-focused DCC applications.

It's available on [GitHub](https://github.com/healkeiser/fxgui), [PyPI](https://pypi.org/project/fxgui), and comes with [documentation](https://healkeiser.github.io/fxgui). I'd love to hear your thoughts and get some feedback!

# Target Audience

* VFX/CGI people working from multiple DCCs.

# Key Features

* Quick setup of common widgets.
* Reusable custom UI components.
* Fully compatible over PySide2/PySide6, thanks to [qtpy](https://pypi.org/project/QtPy/).

# Comparison

* Specifically designed for multi-DCC environments (Maya, Houdini, Nuke, etc.).
* Saves development time by offering ready-to-use components.
* Maintains consistency and standardization across projects and DCCs.

/r/Python
https://redd.it/1gru93h
Unable to Login with Flask-WTF and Flask-Login

\---

**Denoscription:**

I'm building a Flask application with user login functionality using Flask-WTF for form handling and Flask-Login for user authentication. However, I am unable to log in successfully. The page does not redirect as expected, and the login validation does not work.

I have implemented CSRF protection, and I believe the issue might be with how the data is being validated or how the routes are configured.

\---

**What I've Tried:**

1. Ensured that I am redirecting using \`url\_for()\` to a valid route.
2. Added \`csrf.init\_app(app)\` in my \`create\_app()\` function.
3. Included \`{{ form.csrf\_token() }}\` in my login form.
4. Verified that my database connection works, and user data is stored correctly.
5. Checked that Flask-Login's \`login\_user()\` function is being called.

\---

**Code Snippets:**

**\_\_init\_\_.py**

**python**

`from flask import Flask`

`from flask_sqlalchemy import SQLAlchemy`

`from flask_migrate import Migrate`

`from flask_bcrypt import Bcrypt`

`from flask_login import LoginManager`

`from flask_wtf.csrf import CSRFProtect`

`db = SQLAlchemy()`

`migrate = Migrate()`

`bcrypt = Bcrypt()`

`login_manager = LoginManager()`

`csrf = CSRFProtect()`

`def create_app():`

`app = Flask(__name__)`

`app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:Root1234!@localhost/school_hub'`

`app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False`

`app.secret_key = 'your-secret-key'`

`db.init_app(app)`

`migrate.init_app(app, db)`

`login_manager.init_app(app)`

`bcrypt.init_app(app)`

`csrf.init_app(app)`

`login_manager.login_view = 'login'`

`from .routes import main as main_blueprint`

`app.register_blueprint(main_blueprint)`

`with app.app_context():`

`db.create_all()`

`return app`

`login_manager.user_loader`

`def load_user(user_id):`

`from .models import User`

`return User.query.get(int(user_id))`



**routes.py**

**python**

`from flask import render_template, request, redirect, url_for, flash`

`from flask_login import login_user`

`from .models import User`

`from .forms import LoginForm`

`app.route("/login", methods=["GET", "POST"])`

`def login():`

`form = LoginForm()`

`if form.validate_on_submit():`

`email = form.email.data`

`password = form.password.data`

`user = User.query.filter_by(email=email).first()`

`if user and user.check_password(password):`

`login_user(user)`

`return redirect(url_for('home'))`

`else:`

`flash("Invalid credentials", "danger")`

`return render_template("login.html",

/r/flask
https://redd.it/1gsm10l