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
Kazam 2.0 is released: screen recording, broadcasting, capturing and OCR in Linux

https://github.com/henrywoo/kazam

Kazam 2.0 is a versatile tool for screen recording, broadcasting, capturing and optical character recognition(OCR) with AI in mind.

🍄 Tested in: Ubuntu 20.04, 22.04, and 24.04 with Python 3.8 - 3.12.

Main Features:

1. Screen Recording: Kazam allows you to capture everything displayed on your screen and save it as a video file. The recorded video is saved in a format compatible with any media player that supports H264, VP8 codec and WebM video format.
2. Broadcasting: Kazam offers the ability to broadcast your screen content live over the internet, making it suitable for live streaming sessions. It supports Twitch and Youtube live broadcasting at the time of this writing.
3. Optical Character Recognition (OCR): Kazam includes OCR functionality, enabling it to detect and extract text from the captured screen content, which can then be edited or saved.
4. Audio Recording: In addition to screen content, Kazam can record audio from any sound input device that is recognized and supported by the PulseAudio sound system. This allows you to capture both the screen and accompanying audio, such as voice narration or system sounds, in your recordings.
5. Web Camera: Kazam support web camera recording and users can drag and drop webcam window anywhere in the screen

/r/Python
https://redd.it/1f4xjxh
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/1f5a0qh
D Monthly Who's Hiring and Who wants to be Hired?

For Job Postings please use this template

>Hiring: [Location\], Salary:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] and [Brief overview, what you're looking for\]

For Those looking for jobs please use this template

>Want to be Hired: [Location\], Salary Expectation:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] Resume: [Link to resume\] and [Brief overview, what you're looking for\]

​

Please remember that this community is geared towards those with experience.

/r/MachineLearning
https://redd.it/1f5cy0v
Introducing pipefunc: Simplify Your Python Function Pipelines

Excited to share my latest open-source project, pipefunc! It's a lightweight Python library that simplifies function composition and pipeline creation. Less bookkeeping, more doing!

What My Project Does:

With minimal code changes turn your functions into a reusable pipeline.

- Automatic execution order
- Pipeline visualization
- Resource usage profiling
- N-dimensional map-reduce support
- Type annotation validation
- Automatic parallelization on your machine or a SLURM cluster

pipefunc is perfect for data processing, scientific computations, machine learning workflows, or any scenario involving interdependent functions.

It helps you focus on your code's logic while handling the intricacies of function dependencies and execution order.

- 🛠️ Tech stack: Built on top of NetworkX, NumPy, and optionally integrates with Xarray, Zarr, and Adaptive.
- 🧪 Quality assurance: >500 tests, 100% test coverage, fully typed, and adheres to all Ruff Rules.


Target Audience:
- 🖥️ Scientific HPC Workflows: Efficiently manage complex computational tasks in high-performance computing environments.
- 🧠 ML Workflows: Streamline your data preprocessing, model training, and evaluation pipelines.

Comparison:
How is pipefunc different from other tools?

- Luigi, Airflow, Prefect, and Kedro: These tools are primarily designed for event-driven, data-centric pipelines and ETL processes. In contrast, pipefunc specializes in running simulations and computational workflows, allowing different parts of a calculation to run on different resources (e.g., local machine,

/r/Python
https://redd.it/1f583cp
A write-up of what's new in pip 24.2 — or why legacy editable installs are deprecated

Hi all,

**Link to post.**

Last time I was here, I was speaking with my maintainer of black hat. I no longer wear that hat. Earlier this year, I've joined the pip triage team.

About a month ago, we released pip 24.2. This release included neat improvements and one important deprecation (the deprecation of legacy `setup.py develop` based editable installs. setup.py itself is not deprecated). While the changelog is an accurate summary of the changes, the changelog is often hard to parse if you aren't already experienced in packaging and it simply lacks a lot of detail, too. So, I thought a post discussing the changes in detail would be useful and interesting. I tried my best to strike a balance between including the technical details where I could, but also explaining things in a way where you didn't have to be a tenured packaging expert to understand everything 🙂

This isn't anything official. pip doesn't have a blog, and I'm linking to my personal site here, but I do think it's valuable to have more detailed communications for a foundational piece of the packaging ecosystem. I make no promises that this will continue, but I'd love to write future pieces if I can.

Please

/r/Python
https://redd.it/1f4zvaw
Interpol Wanted Persons Data Downloader with an Interactive Dashboard

# What My Project Does

Interpol Red-DL is a project designed to retrieve, save and display data published by Interpol on wanted persons.
The project creates a copy of the data of wanted persons to keep the data, even if deleted by Interpol, and it also extends the features of Interpol website by adding a data visualization dashboard on top.

Github Repo
Demo Video
Demo Website*

*I have a Streamlit app deployed temporarily, using a snapshot of the database from the last complete run few weeks ago.

# Target Audience

Those who are curious about reverse-engineering APIs or data scraping. The README contains a short write-up about the challenges faced when working with the API. The project also gives some ideas for anyone into data visualization, showing how you can extend existing websites to create data dashboards with easy prototyping libraries like Streamlit.

# Comparison

Most similar open-source projects scraping Interpol's data are either outdated, likely because of stricter API checks, or they use Selenium for data extraction, which feels like an overkill.

I worked on this project as a challenge during my internship at an AI-based company. Following are some of my opinions:

Is Interpol preventing bots?

I’ve always enjoyed messing around with APIs, but this one was

/r/Python
https://redd.it/1f57h6m
Automate Your Reddit Saved Post Backups with Context Using Reddit Stash

Hey Everyone,

**What My Project Does**

A while back, I realized that many of the posts I had saved on Reddit for future reference were disappearing. To solve this problem, I developed a Python script called **Reddit Stash**. This tool automatically saves your Reddit saved posts and comments, along with your own posts and comments, and includes the necessary context (e.g., associated comments or parent posts). The script runs daily at around 00:00 CET using GitHub Actions, ensuring your data is backed up without any manual intervention on Dropbox. The files are saved in Markdown format, making them easy to read and reference later.

**Target Audience**

**Reddit Stash** is ideal for users who want to preserve their saved Reddit content without losing context, such as those interested in:

* **Personal Knowledge Management:** Users who save Reddit posts for later reference and want to ensure they keep the full context for future use.
* **Developers/Researchers:** Those planning to use Reddit content in local Retrieval-Augmented Generation (RAG) systems or similar projects.
* **Casual Reddit Users:** Anyone who doesn’t want to worry about manually backing up their saved content.

Whether you're a serious developer or a casual Reddit user, this tool can save you time and effort.

**Comparison**

While there are existing tools

/r/Python
https://redd.it/1f5n53a
Build plugins in marimo with anywidget

Blog post: https://marimo.io/blog/anywidget

marimo is now standardizing on anywidget as the third-party plugin API. With anywidget, users can create custom widgets to be used directly in marimo and hook into marimo's reactive framework.

Context:

marimo is a next-generation reactive notebook for Python and SQL.

anywidget provides a single interface for developing embeddable widgets inside other applications, such as Panel, Jupyter, and, of course, marimo. anywidget also comes with an excellent developer experience in creating these widgets with either vanilla JavaScript or popular frameworks like React and Svelte.

/r/Python
https://redd.it/1f56lj9
Is My CI Pipeline for my Python Library Overkill?

So this is what my GitHub insights are looking like:

|Date|Clones|Unique Clones|
|:-|:-|:-|
|29 Aug|1376|16|
|30 Aug|1326|9|

The majority of this is just my CI pipeline.

This is a snippet of the strategy section of the CI:

strategy:
matrix:
python-version: "3.8", "3.9", "3.10", "3.11", "3.12"
django-version: 32, 42, 51
db: postgres, mysql, sqlite
broker: rabbitmq, kafka
exclude:
# Django 5.1 does not support Python <3.10
- python-version: "3.8"
django-version: 51
- python-version: "3.9"


/r/Python
https://redd.it/1f5qlui
Modal button not working when following this Flask tutorial. Please help!

I'm following a Flask tutorial on YouTube and have hit a point where I can't get the code to work. The button doesn't pop up when I click on it. Any ideas? I have tried switching "data-toggle" to "data-bs-toggle" and likewise for "dismiss" and "target" (in line with bootstrap 5) but it doesn't work. The button doesn't do anything at all when I click on it.


Here's the button:

<button type="button" class="btn btn-danger btn-sm m-1" data-toggle="modal" data-target="#deleteModal">Delete</button>

And here's the modal:

<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteModalLabel">Delete Post?</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>


/r/flask
https://redd.it/1f5xqyf
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/1f617a7
UPD with code: help, flask server’s link doesn’t show anything. Everytime I try to open it, it shows ‘not found’.

/r/flask
https://redd.it/1f6mqnp
Hosting a Django website that supports a few thousand requests per minute

We're working on a site for an event and we're using a template that uses Django, though none of us is an expert in it. At the beginning of the event we expect a few thousand requests per minute, especially in a mini game that uses post requests. The template comes with files asgi.py and wsgi.py to run it with gunicorn, and as I understand asgi is async so it should be better to control concurrent connections.

So far we tried hosting it on Heroku using a postgres database and trying up to 25 standard dynos, which I feel like it's a lot, and with a load of 100 virtual users testing it with k6 we still got response times of around 2 seconds for those post requests. We also tried pythonanywhere using the default sqlite database and the results were worse.

We're not sure where the bottleneck is exactly. We thought it was a matter of the CPUs not keeping up, but we also tried running it on my main PC and we were also getting times of about 2 seconds with 100 VUs in k6, and the CPU was just running at 50% (though on that one we didn't

/r/django
https://redd.it/1f6k3rk
Developing flask backend

Hey guys, hope y'all are doing well.
I'm developing a flask backend to run a segformer and an stable diffusion model. I got both of them off of hugging face. I tested everything out in Jupiter and they work fine.
My tech stack is currently a next/reactjs frontend, SupaBase for auth etc, stripe for payments and flask as an API to provide the key functionality of the AI.
I'm getting started with the flask backend, and although I've used it in the past, this is the first time I'm using it for a production backend. So, logically, my questions are:

-Do I need to do something for multi threading so that it can support multiple users' requests at the same time?

-Do I need to add something for token verification etc.

-Which remote server service provides good GPUs for the segformer and stable diffusion to run properly?

-Any other key things to look out for to avoid rookie mistakes would be greatly appreciated.

I already installed waitress for the deployment etc and I was wondering whether I should dockerize it too after it's developed.

/r/flask
https://redd.it/1f6nwxt
Monday Daily Thread: Project ideas!

# Weekly Thread: Project Ideas 💡

Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.

## How it Works:

1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.

## Guidelines:

* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.

# Example Submissions:

## Project Idea: Chatbot

**Difficulty**: Intermediate

**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar

**Description**: Create a chatbot that can answer FAQs for a website.

**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)

# Project Idea: Weather Dashboard

**Difficulty**: Beginner

**Tech Stack**: HTML, CSS, JavaScript, API

**Description**: Build a dashboard that displays real-time weather information using a weather API.

**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)

## Project Idea: File Organizer

**Difficulty**: Beginner

**Tech Stack**: Python, File I/O

**Description**: Create a script that organizes files in a directory into sub-folders based on file type.

**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)

Let's help each other grow. Happy

/r/Python
https://redd.it/1f6syvh
Table goes blank when page is refreshed...

shows is a list of lists being passed to the HTML file used to populate a table. When I run the program and open the page for the first time, the table populates just like it's supposed to. But if I refresh the page in the browser, the table goes blank except for the headers. Why is this happening?

from flask import Flask, rendertemplate
from getshows import get
shows
import pandas as pd
from time import sleep


filename = "Output.csv"
df = pd.read
csv("ListedVenues.csv")
# create an empty dictionary to hold the show information
shows
tonight = {
"venue": ,
"show": ,
"date": ,
}
# make the API calls to get show information and store it in the showstonight dictionary
for index, row in df.iterrows():
venue, bands, date = get
shows(row"Venue

/r/flask
[https://redd.it/1f6spgz
Hey, I’m new to Flask and have a question. When I have a flask server running the URL never works and always says ‘Not found’ even though its running. Any help?



/r/flask
https://redd.it/1f6jhh3
Something really really weird happens...

So my base template is (deleted link to the CSS spreadsheet due to debugging):

https://preview.redd.it/mwpy7k4r29md1.png?width=422&format=png&auto=webp&s=3adfe342a4ff8fc77b3c3eb71ffcc08950e67224

https://preview.redd.it/d0oyqtj139md1.png?width=708&format=png&auto=webp&s=74e061b7cab2a7e49053f33e00d5732f1b5f5dc5

https://preview.redd.it/5awcger739md1.png?width=708&format=png&auto=webp&s=f23df724d6f3c88dfc96ffe69f194febef3e162e

\^ And then I have this template with internal CSS. And when I extend it (pic 2), it doesn't render at all. When I write a text to these divs, they only expand to the point to accomodate that text.


But when I'm not extending it (3), then it renders fine, like it's supposed to render.

Anyone?

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