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
editair webapp

Hey! I was playing around with flask for a backend API and built a webapp that converts long form videos into short form sharable content. I linked the demo below. If this is something that could be useful to you or someone you know, sign up for the beta and let me know via DM or tyler@editair.app

editair webapp

demo video


If it is a project you think you could help on the dev side, also let me know!

/r/flask
https://redd.it/12sdzzy
Software engineering with Python?

I have been self-studying python for a little bit over a month. I don't exactly wanna go into data analyst/data science/ data engineering, etc. my goal is to become a software engineer/developer (maybe something to do with backend). did I choose the wrong language?

EDIT: @ evryone fucking love you guys. I was so damn confused this morning when i posted this, the 52 comments cleared up so many things you have no idea. I haven't even finished digesting all the information but that clears up so much!!

/r/Python
https://redd.it/12rsedi
Having issues with multiple SQL queries in my app

So I have an app I am working on. Its a simple idea where you register, tell it what streaming services you subscribe to. It then shows you the movies available on those platforms and you can like the movie to add to a watchlist or dislike it to ignore the movie. I have the list of movies in my own DB.

I have the basics of user registration, login, dashboard and logout working. My issue now is the main function. I need to read the users subscriptions from the Users table, show the titles that are on that provider, drawn from a table called StreamingTitles, and then when they click like add the movies id into a liked_titles column in the users table. It's the manipulation of the different tables that are tripping me up and chatgpt isn't being very helpful.

I think I am trying to achieve this in a logical manner. I will end up with a table of users with all their wishlists held as an array which I can manipulate later on. Does it make sense to do it this way?

Database structure:

https://imgur.com/a/lla70ED

​

As it's Flask I have used a Jinja2 template structure, and again it's working fine. I

/r/flask
https://redd.it/12spwiz
Just made a python script to post to Mastodon

Just made a python script that allows you to update your status (i.e. make a post on Mastodon). The script allows you to upload an image to your post as well. Hopefully yall think this is useful:
https://github.com/rfrlcode/Public/blob/main/mastodon.py

/r/Python
https://redd.it/12sbxlt
N Stability AI announce their open-source language model, StableLM

Repo: https://github.com/stability-AI/stableLM/

Excerpt from the Discord announcement:

> We’re incredibly excited to announce the launch of StableLM-Alpha; a nice and sparkly newly released open-sourced language model! Developers, researchers, and curious hobbyists alike can freely inspect, use, and adapt our StableLM base models for commercial and or research purposes! Excited yet?
>
> Let’s talk about parameters! The Alpha version of the model is available in 3 billion and 7 billion parameters, with 15 billion to 65 billion parameter models to follow. StableLM is trained on a new experimental dataset built on “The Pile” from EleutherAI (a 825GiB diverse, open source language modeling data set that consists of 22 smaller, high quality datasets combined together!) The richness of this dataset gives StableLM surprisingly high performance in conversational and coding tasks, despite its small size of 3-7 billion parameters.

/r/MachineLearning
https://redd.it/12rxtjj
RE: If you had to pick a library from another language (Rust, JS, etc.) that isn’t currently available in Python and have it instantly converted into Python for you to use, what would it be?

Re u/Tymbl's post.
I implemented Rust's Option and Result types in Python because the amount of times I write code that works straight away is embarrassing when I write Python.
https://github.com/gum-tech/flusso


However, my first feedback was: "It's not Pythonic".
I thought Python is a multi-paradigm programming language. If so, what makes a code Pythonic?

/r/Python
https://redd.it/12sv2m8
Event driven development with FastAPI and Kafka


Event driven development with FastAPI and Kafka.


https://preview.redd.it/2eew690lj0va1.png?width=1400&format=png&auto=webp&v=enabled&s=60e378b72d42551c56fb57859304a312aaf3b425

Kafka is a distributed data streaming platform that allows you to publish, store, and process streams of records (messages) in a fault-tolerant and scalable manner. In simple terms, Kafka is like a messaging system that enables applications to send and receive data in real-time.


Tutorial is split into 2 parts
In part 1, we will set up a single-node Kafka and Zookeeper environment using Docker Compose. We will then produce and consume test messages using the Kafka console producer and consumer. In part 2 we will adds a FastAPI endpoint that handles requests and produces messages.

https://ahmed-nafies.medium.com/fastapi-event-driven-development-with-kafka-zookeeper-and-docker-compose-a-step-by-step-guide-3e07151c3e4d

/r/Python
https://redd.it/12stcsj
Introducing pyautoenv: Activate and deactive python environments as you move around the file system

[https://github.com/hsaunders1904/pyautoenv](https://github.com/hsaunders1904/pyautoenv)

Hi, all!

Tired of forgetting to activate your virtual environment before running your program? `pyautoenv` is here to help.

Inspired by [autoenv](https://github.com/hyperupcall/autoenv), `pyautoenv` hooks into the `cd` command in your shell and will automatically activate a `poetry` or `venv` Python environment if that environment is defined in the directory you're cd-ing into. Zsh, Bash, and PowerShell are supported.

It will:

* Activate a `poetry` environment if a directory, or any of its parents, contains a `poetry.lock` file.
* Activate a `venv` environment if a directory, or any of its parents, contains a `.venv` directory.
* Deactivate any active virtual environment if a directory does not define an environment in one of the above 2 ways.

Any and all comments/suggestions welcome!

/r/Python
https://redd.it/12st900
P LoRA adapter switching at runtime to enable Base model to inherit multiple personalities

Hi all,
Hope you are all well. Last time I posted about the fastLLaMa project on here, I had a lot of support from you guys and I really appreciated it. Motivated me to try random experiments and new things!


Thought I would give an update after a month.

Yesterday we added support to enable users to attach and detach LoRA adapters quickly during the runtime. This work was built on top of the original llama.cpp repo with some modifications that impact the adapter size (We are figuring out ways to reduce the adapter size through possible quantization).

We also built on top of our save load feature to enable quick context switching during run time! This should enable a single running instance to server multiple sessions.

We were also grateful for the feature requests from the last post and we have implemented features that were requested like perplexity calculation, returning embeddings etc.

Why this repo and how are we different from other wrappers?
Previously someone had asked this in the other post. Thought I would address it here as well. I am really excited to see many people building on top of llama.cpp and I think it deserves all

/r/MachineLearning
https://redd.it/12ssjl8
QualityScaler 2.0 - image/video AI upscaler

​

https://preview.redd.it/yzvfha4mc1va1.png?width=1126&format=png&auto=webp&v=enabled&s=cde493fb5c566af51c7eec4cebe8b187fa891ee4

[https://jangystudio.itch.io/qualityscaler](https://jangystudio.itch.io/qualityscaler)
https://github.com/Djdefrag/QualityScaler

### THANKS

I want to sincerely thank the people who support and will support this work (financially and otherwise).
Thank you for allowing me to learn how to develop these projects and at the same time be able to help my parents financially.

# Changelog 2.0.

### NEW

It is now possible to upscale images and videos in one shot
The message box is now more "conversational"
Now the app will save the upscaled files by adding the chosen resolution % tag.
this allows you to try different % resolutions without overwriting the previous file.
for example, an image with BSRGANx4 and Resolution 70%:
QualityScaler 1.14 => image_BSRGANx4.png
QualityScaler 2.0 => image\_BSRGANx4\_70%.png
New GUI based on the splendid work of customtkinter:
it is now possible to select files via a "Select files" button instead of the Drag&Drop function that presented several problems
this new library allows for much more organized and optimized code
the new interface is fully resizable and so adaptable to any screen
the new interface also allows more space to add new

/r/Python
https://redd.it/12sxlx5
I just want to say, I love django!

I have been programming for more than 15+ years and professionally about than 7 years. Out of all the frameworks, and the languages, I have worked with. I think django is one of most well thought framework, it has a simplicity that matches with python and Damm, the documentation, it just makes building and programming such an enjoyable experience.

I have worked with some huge and legacy Django code bases too but, getting around in it still feels familiar and not much overhead.

Django all the way!

/r/django
https://redd.it/12so91h
Just created a set of Python info cards - would love your feedback!

Hey everyone! I recently put together a set of information cards on Python basics for those getting started, covering topics like data types, file i/o, and debugging. I'd love to hear your thoughts on the content, design, and overall usefulness.

https://preview.redd.it/s095n2w2v1va1.png?width=4154&format=png&auto=webp&v=enabled&s=c24aaccaf59e5accb368d1a67265a03bd6f09a34

/r/Python
https://redd.it/12t0mk5
Create a simple, yet beautiful design with Python and CSS for your next Flask project. (Part 2/2)

Hi all, just published part 2/2 of my frontend mini-series for Flask in Level Up Coding. This time focusing on CSS.
Tutorial includes:
\- All the CSS needed to create the design.
\- How to structure the CSS into multiple files to improve code maintenance and readability.
\- How to use the Flask Assets package to minify and optimise your CSS for production.

Check it out here: https://levelup.gitconnected.com/create-a-simple-yet-beautiful-design-with-python-and-css-for-your-next-flask-project-part-2-2-f189bfe9492f

Here is the final design:

https://preview.redd.it/ftn5lucan0va1.png?width=3360&format=png&auto=webp&v=enabled&s=67cabdb599d1bd666d0f1f6329b8aebe1e21200d

PS: if you missed part 1 on the HTML, you can find it here: https://levelup.gitconnected.com/save-money-on-expensive-no-code-tools-build-the-frontend-for-your-flask-app-with-python-html-b2f8f1c8cb84

/r/flask
https://redd.it/12stv85
Spooky Static Files

Ok, I'm at my wit's end. I just spent give hours trying to solve an issue and I'm not getting any further.

Here's my stack:

Docker
Nginx
Gunicorn
Django

Everything works fine with Debug is true.

My css files that are under the same folder structure as my images and Javascript files do not seem to completely load when I run the production server.

Everything is served though. If I manually input the url in my web browsers (Mozilla, Edge, Chrome) I can see them fine, but when I inspect elements they do not show up in the styles panel, even though they do show up in the development server.

So in essence my css does not load in production, even though the files are served under the correct static link and everything.

Any idea?

I can provide more in info upon request, but seeing I literally went over everything I could think of, I didn't want to make this a huge wall of text just yet.

I asked chatgpt and he's been very helpful, but he seems to be clueless on this as well.



Any ideas?

/r/django
https://redd.it/12tig93
Unicodeitplus: Convert simple LaTeX into an unicode approximation and paste it anywhere.

This is a small library with a CLI to convert simple LaTeX into unicode. There are much more powerful LaTeX to HTML converts, like KaTeX, but the beauty of unicode is that it works everywhere, in the terminal, in Powerpoint, ... . The library is inspired by unicodeit but uses a better LaTeX parser that fixes a few bugs in unicodeit.

Package on PyPI

Source on Github

/r/Python
https://redd.it/12tguck
All Python books 25%-off at No Starch Press

Note: I am not affiliated w/ NoStarch in any way, am not using any referral links, was not asked to post this and do not receive any compensation for doing so. I'm just a fan of their books and personally own a bunch.

Just got an email that all Python books at No Starch Press are 25%-off now through Sunday "in honor of PyCon's 20th anniversary celebration this week". Use coupon: PYTHONISTA

https://nostarch.com/catalog/python

/r/Python
https://redd.it/12tagoo