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
Looking Under the Hood of Python's Set Data Structure

This article dissects how Python implements the Set data structure. It covers a background on hash tables along with implementation of the key Set APIs: insertion, contains, removal and pop. A good way to learn how hash tables are implemented for real-world use cases.

https://blog.codingconfessions.com/p/cpython-set-implementation

/r/Python
https://redd.it/1dowa49
Share your ruff config.

I'm stressed because I couldn't always figure out the standard style to match most people. Please share your ruff.toml config for your go-to with Python that you use across all your projects. If possible, please share the config via gist.github.com

/r/Python
https://redd.it/1dp4jrm
SQLAlchemy vs Flask-SQLAlchemy

Hi! I have a hobby Flask app that I'm pitching for internal use at my company. I set it up using regular SQLAlchemy, I can't remember why I chose this over Flask-SQLAlchemy, and it connects to a MySQL database.


I'm now trying to build out a login functionality and am running into issues since the tutorials I'm following use the Flask plugin (mostly issues with circular imports). Should I just move everything over to Flask-SQLAlchemy or is there a way to do it with what I've got? Is either method the preferred way of doing things?

/r/flask
https://redd.it/1dp60rt
Speech to Text using Python, anyone?

I am writing a Python script to take my M4A or WAV file and perform speech-to-text on it. I tried several different APIs including ffmpeg with no good results.


Has anyone had success doing this and how?

/r/Python
https://redd.it/1dp632p
SQLAlchemy vs Flask-SQLAlchemy

Hi! I have a hobby Flask app that I'm pitching for internal use at my company. I set it up using regular SQLAlchemy, I can't remember why I chose this over Flask-SQLAlchemy, and it connects to a MySQL database.


I'm now trying to build out a login functionality and am running into issues since the tutorials I'm following use the Flask plugin (mostly issues with circular imports). Should I just move everything over to Flask-SQLAlchemy or is there a way to do it with what I've got? Is either method the preferred way of doing things?

/r/flask
https://redd.it/1dp60d3
[D] Thoughts on Best Python Timeseries Library

There are many python libraries offering implementations of contemporary timeseries models and data tools. Here is an (incomplete) list. Looking for feedback from anyone who has used any of these (or others) on their pros and cons. Extra points if you have used more than one and can offer an opinionated comparison. I am trying to figure out which one(s) to invest time into. Much appreciated!

* TSA - [https://github.com/timeseriesAI/tsai](https://github.com/timeseriesAI/tsai)
* TSLib - [https://github.com/thuml/Time-Series-Library](https://github.com/thuml/Time-Series-Library)
* AEON - [https://github.com/aeon-toolkit/aeon](https://github.com/aeon-toolkit/aeon)
* SKTime - [https://www.sktime.net/en/stable/](https://www.sktime.net/en/stable/)
* TSLearn - [https://tslearn.readthedocs.io/en/stable/](https://tslearn.readthedocs.io/en/stable/)
* Nixtla - [https://github.com/Nixtla/](https://github.com/Nixtla/)
* Pytorch-forcasting - [https://pytorch-forecasting.readthedocs.io/en/stable/](https://pytorch-forecasting.readthedocs.io/en/stable/)
* DARTS - [https://unit8co.github.io/darts/index.html](https://unit8co.github.io/darts/index.html)
* Merlion - [https://github.com/salesforce/Merlion](https://github.com/salesforce/Merlion)

/r/MachineLearning
https://redd.it/1dp4y8p
Flask web app error

Been trying to follow https://www.leniolabs.com/software-development/2023/01/10/Create-and-host-your-web-app-with-Python-and-Flask/ to start creating app using visual studio code. However , i keep seeing this error

Error: Failed to find Flask application or factory in module 'app'. Use 'app:name' to specify one.

I have tried the methods on stackover , chatgpt, etc etc to solve this error but it keeps giving me the same issues. Any advice on whats wrong?

/r/flask
https://redd.it/1dp4sa1
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1dpdhpn
Building a SaaS for Scraping and Categorizing News Articles: Need Your Help!


I'm developing artikle, a platform that processes and analyzes millions of articles and LinkedIn posts each week. The backend (python) is working perfectly.

I'm trying to setup a frontend for this app (I have 0 experience in front). I'm using dash bootstraap and flask.

Currently, I'm focusing on creating a page dedicated to store openings worldwide.

You can check it out here: Artikle - Store Openings.

I want to make the page more user-friendly and better explain its use case. Do you have any resources or suggestions to help improve it?

Thank you!

/r/flask
https://redd.it/1doybmr
Just released: Episode 1 of "Introduction to Programming"!

In a world where technology shapes our future, we believe learning to code should be an adventure. Through our engaging and entertaining cartoons, kids will embark on exciting journeys with Aadi, Gogu, and their friends. As they enjoy the fun and laughter, they'll unconsciously absorb the fundamentals of programming. Our mission is to make coding accessible, enjoyable, and second nature to the next generation.

You can watch full video on You tube :

https://youtu.be/X7L6qw1kqeA?si=bLK4dLvTD1jpzDD8



/r/Python
https://redd.it/1dpn503
Those dicts you probably needed at some point

Hi everyone!

I have created a dependency-free package those-dicts that provides some subclasses of dict with a twist: BatchedDict(no, it is not ChainMap from collections), GraphDict and TwoWayDict. At some point I have personally needed those and finally decided to materialize them. Of course there are some specialized libraries, that can provide similar functionality, but they are very bloated. And those-dicts are just dicts.

https://github.com/jakubgajski/those\_dicts

If you have some dict with a twist in mind, please open a PR or describe it to me, so I will implement it in the free time :) The only requirements for an idea to fit is: it is a dict (conforms to vast majority of dict interface) and is dependency free.

just: pip install those-dicts

/r/Python
https://redd.it/1dpnc09
What attracted you to django?

When I was previously working in some company, I used django for their internal project. I merely knew name of this framework & nothing else. When I went further on, I realised how simple & fun it was to use django, i.e. DB connection, simplicity of customizing authentication etc. Things were gr8..
And I read news about Elon Musk buying Twitter and rebranding it to "X". I suddenly thought how easy & fun it would be to change all things if Twitter engineers were using django for their backend as well as frontend. (It might sound strange tho.)
That's when I decided to make a career as Python backend developer.
So what was "turning point" for you to get attracted to django framework??

/r/django
https://redd.it/1dpmitf
Flask Architecture Question

Hope this is an alright place to ask, but worried this is "obvious" to seasoned developers and only doesn't make sense to me.

I work on a Flask API fronted by nginx. There's another team working on a React front-end that I have nothing to do with. I don't know how the front-end runs, whether it needs nginx in front of it...

My question is this - I understand the chain of nginx -> gunicorn -> Flask.

Say I wanted to stand up a web-app with my friend who is a FE developer, but has only deployed in "serverless" environments and is relying on me entirely for the architecture.

What's the "normal" way of setting things up? In other words, if my Flask API is only consumed by whatever JS front-end he builds, and is never open to the internet, and they're all running on the same server, does it go nginx -> front-end -> Flask API? Or do I need another layer of nginx between the front-end and the Flask API?

Also, should there be authentication built-in between the FE and the Flask API, even if they're running on the same server in say, a docker compose setup and commuincating over the docker network?

Sorry

/r/flask
https://redd.it/1dpnd0n
C++ binding library

I am looking for a Python binding library to expose a pretty big set of C++ classes to Python code. The following features are important to me:

Compatibility with C++ shared pointers
Function and method overloading
Operator overloading. Example: a = Vec3(1, 2, 3) + Vec3(1, 0, 0)
std::wstring has to be supported, some way, somehow, even if it involves jumping through a lot of hoops
Compatibility with the Microsoft Python Debugger for Visual Studio Code
We need to maintain compatibility with the greater Python ecosystem of libraries.

Which lib would best be suited for this purpose?

/r/Python
https://redd.it/1dpsazq
Check for Open Ports using Python

## What my Project Does
This Python script is designed to scan specified ports on one or more target IP addresses to determine if they are open or closed. It uses multi-threading to perform the scans efficiently and outputs the results in a color-coded tabulated format for easy reading. The script provides the ability to scan either a single port or a range of ports on multiple targets.

## Target Audience
This project is intended for:
- Network administrators who need to check the status of ports on various devices within a network.
- Security professionals who want to perform network reconnaissance to identify open ports that could be potential security risks.
- IT support staff who need to troubleshoot connectivity issues by verifying open ports.
- Enthusiasts and learners who are interested in network security and port scanning techniques.

## Features
- Multi-threaded for efficient scanning
- Supports scanning multiple targets
- Supports single port or port range
- Color-coded output for easy reading
- Verbose mode for detailed output

## Requirements
- Python 3.6+
- colorama library
- tabulate library

## Installation
Before running the script, ensure you have the required libraries installed. You can install them using pip:

pip install colorama tabulate


## Sourcing the script
You can download the script here on GitHub.

## Usage
Run the script with the

/r/Python
https://redd.it/1dptsb5
Favourites chrome extension for Django Admin

I was getting very tired of searching for and scrolling through links in my admin page. To solve this problem I built a chrome extension that allows you to add a list of favourite links to the top of your django admin home page. Find the extension here.

The extension runs locally and will be free forever! Hope this is helpful for you.

Example of favourites links:

Favourites chrome extension for Django Admin

/r/django
https://redd.it/1dpmt6g
Do people actually use blueprints?

I have made a number of flask apps and I have been wonder does anyone actually use blueprints? I have been able to create a number of larger apps with out having to use Blueprints. I understand they are great for reusing code as well as overall code management but I just truly do not understand why I would use them when I can just do that stuff my self. Am I shooting my self in the foot for not using them?

/r/flask
https://redd.it/1dpuf0t
Copy model instance to prefill form?

I am making a recipe application. I want to be able to copy an existing recipe and make edits to create a new recipe. How I can prefill a form/edit view using an existing model instance and then save the data into a new model instance?

Here is my current model structure, it's implementation assumes that a recipe is composed of pre-existing ingredients and, potentially, other user generated recipes.


Models.py

class Ingredient(models.Model):
"""Base ingredient class"""
name = models.CharField(max_length=500)
...

class Recipe(models.Model):
"""Base recipe class containing instructions and description"""
name = models.CharField(max_length=500)
...
ingredients = models.ManyToManyField(Ingredient, through='RecipeIngredient')
sub_recipes = models.ManyToManyField('self',


/r/django
https://redd.it/1dq7jrh
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/1dq60v8