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
Mutmut 3 released

I've just released version 3 of mutmut, the industry standard mutation tester for Python. It's an almost complete rewrite to using mutation schemata, which (when coupled with some other changes) massively improve performance.

There is also a new terminal based UI for working with mutants that makes doing MT much faster and more fun.

Docs: https://mutmut.readthedocs.io/

Code: https://github.com/boxed/mutmut

/r/Python
https://redd.it/1g806h6
Digital ocean spaces for static file storage

I'm hosting a Django app on heroku and I want to use digital ocean spaces for serving static files. Does anyone have any insight on this? I'm pretty new to dev but really love how far I've come thanks to Django.

/r/django
https://redd.it/1g80s1k
D Simple Questions Thread

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/1g80nkv
R Google Shopping 10M dataset for large scale multimodal product retrieval and ranking

We have finally released the Marqo Google Shopping 10 million dataset on Hugging Face (Marqo-GS-10M). One of the largest and richest datasets for multimodal product retrieval!

+ 10M rows of query, product title, image and rank (1-100)

+ \~100k unique queries

+ \~5M unique products across fashion and home

+ Reflects real-world data and use cases and serves as a good benchmark for method development

+ Proper data splits, in-domain, novel query, novel document and novel-document and novel query.

The dataset features detailed relevance scores for each query-document pair to facilitate future research and evaluation.

!pip install datasets
from datasets import loaddataset
ds = load
dataset("Marqo/marqo-GS-10M")

We curated this large-scale dataset as part of the publication of our training framework: Generalized Contrastive Learning (GCL).

Dataset: https://huggingface.co/datasets/Marqo/marqo-GS-10M

GCL: https://github.com/marqo-ai/GCL

Paper: https://arxiv.org/abs/2404.08535

/r/MachineLearning
https://redd.it/1g8a3pv
Please help me create the perfect structure for my Flask App

I am making an URL shortener with Flask and MongoDB and just wanted to figure out the perfect project structure which follows the best practices.... I have already created this before but the structure sucks... I dont want auth right now and want to keep things modular... This is the current structure of the code:

C:.
│ .env.example
│ .gitattributes
│ .gitignore
│ botuseragents.txt
CODEOFCONDUCT.md
contributing.md
│ docker-compose.yml
│ dockerfile
emojies.py
│ LICENSE
main.py
│ pyproject.toml
│ railway.json
README.md
│ render.yaml
│ requirements.txt
│ vercel.json

├───.github
│ └───workflows


/r/flask
https://redd.it/1g7zb9h
Django's TechTuber?

There are Youtubers or content creators who are a reference about Django, to learn about the framework, to know the latest news?.

/r/django
https://redd.it/1g8f4xs
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/1g8cr07
Live server set-up for developing with Flask?

I'm new to programming (few months in, learning in my spare time) and I've started to learn Flask to develop web apps with Python.

I'm using VSCode mostly and what I really need is for a live server type of setup so I can see the changes I'm making in HTML/CSS, as I make them. The difficulty I'm facing is that the live server plugins I've tried in VSCode don't show the results properly. E.g. they will display {{ myflaskvariable }} rather than the actual variable - which obviously makes things harder than I feel they need to be!

Everything displays fine using 'flask run' from the terminal, but I can't seem to get a live server to work the same way. Any suggestions?

/r/flask
https://redd.it/1g8lchg
D Efficient CNNs for inference

I am working on an object detection project using high resolution images.

Are there any techniques that can make a trained CNN (UNet) efficient during inference? I know pruning is one such technique, but it risks loss of accuracy and parallelizability.

/r/MachineLearning
https://redd.it/1g8kpl6
What do you do when you are frustrated?

Hi everyone!

I know this post deviates a bit from what people usually post here, but I thought it would be interesting to hear what those of you who are already developers or have code longer do with this.

How do you deal with the frustration? I'm in the phase where I haven't fully understood yet that writing code and making it actually work properly takes time, so I can get frustrated when I've been sitting for a little while and haven't found a solution yet.

Of course, what I'm doing now is just stepping away from the PC for a while and thinking about something else, but want to hear what other tips you have.

Thank you!

/r/Python
https://redd.it/1g8jrmd
temporals - A time, date and datetime periods support

Hi guys!


I'm excited (and mostly nervous) to share my first Python project that is aimed at the wider audience of Python users.


# What Does It Do


temporals aims to provide a minimalistic utility layer on top of the Python standard library's datetime package in regards to working with time, date and datetime periods.


The library offers three different flavours of periods:

`TimePeriod`
DatePeriod
`DatetimePeriod`


As you can probably guess from the names, each period corresponds to a `datetime`object and contains the same as its start and end variables.


When working with periods, each and every one of them is viewed as existing on a timeline, thus each period contains its own implementation of methods related to that position in time:


Methods like is_before, is_after and get_interim serve the purpose of comparison between periods that exist in time in a non-overlapping fashion;
Methods like `overlapped_by`, `overlaps_with`, `get_overlap` and `get_disconnect` provide the ability to work with periods that exist in time in an overlapping fashion;
Operations such as equality between periods and the in keyword allow you to determine if a period is equal to, or exists fully within, another period


Additionally, each period instance contains a Duration under its duration attribute which is built on top

/r/Python
https://redd.it/1g8nu9s
Asynchronous framework for working with RabbitMQ

Hello everybody! I wrote the first version of a small (so far) framework that allows you to work with the RabbitMQ broker.

I hope that this small project can benefit people and grow into something more. The main idea is to process essays asynchronously without resorting to extending the code ring in the project. Among the nice bonuses: there is validation of field types from messages (something like what is in FastAPI, only without dependency injection).

I would like you to study my code and, if anyone has any criticism or recommendations, leave your feedback. Thank you very much!

https://pypi.org/project/aiocarrot/
https://github.com/d3nbr0/aiocarrot/

/r/Python
https://redd.it/1g8dt16
How long can you confidently build app using django from Flask experience?

recently learn web development using flask, started 3 months ago but not consistent, building a capstone project.
I notice that django jobs are in demand than flask.

Can you share the learning curve switching frameworks.?

/r/flask
https://redd.it/1g8uiwl
Issues with flask, uwsgi, nginx, and websockets.

I have an existing application (resume website) that is being served just fine with flask/python/uwsgi/nginx, the problem was when I tried to introduce websockets. I have read the documentation for flask socket.io in terms of deployment, not even sure if I need it, honestly I have no idea what the h3ll I am doing with the sockets. It seems like there is gevent, websocket native uwsgi, socket.io, and probably a myriad of others.

I essentially wrote a chat server backend in golang that uses rabbitmq, and i then wrote a test python script that sends messages over websockets using asyncio and websockets, this works fine.

The thought behind the project was to have an administration page be served by flask that allows the admin to see all rabbitmq queues, choose a queue, read messages from queue, and respond to queue. I could achieve this through polling directly to the backend, but I wanted to securely incoporate websockets to handle this in a secure asynchronous way being served by flask/python.

Then implement a chat modal on my resume page that allows anonymous users, to initiate chats, creating a rabbitmq queue unique to that user based on session id, admin receives new queues and messages,

/r/flask
https://redd.it/1g8zmh0
Best framework for large scale web apps

Wondering what’s the community’s best web framework for building large scale and reliable web apps ? Especially django (with rest framework) VS flask VS fastapi

/r/Python
https://redd.it/1g8xeoy
AI-generated pictures: What do you use?

Hey guys, I'm searching for some tool/website/anything that could take my design of the Website and generate pictures similar to my branded website.

Something like train model with pictures of my website and then generate new pictures with the same fonts and colors.

Is there any simple way to do so? Thanks!

/r/flask
https://redd.it/1g8oayh
Can I migrate my website from WordPress to a coded platform like Django

Five months ago, I posted a similar question on the WordPress subreddit, but it didn’t gain much traction, and the feedback was mostly negative, tbh.

My original post was along these lines:

"I'm currently trying to launch an e-commerce site using WordPress with a theme builder. I really believe this business idea can succeed in the near future (God willing). This might sound odd, but I feel uneasy about WordPress, even though I’ve never written a single line of code. To add to that, I’m not comfortable using Dokan (the marketplace plugin) either, as I want to create a highly customized multi-vendor marketplace."

Fast forward a few months, and I've returned to working on my website. I’m not as uncomfortable with WordPress anymore, and I’ve completed the entire site design—it looks great! But now, I’m aiming Big. I want to grow this into a fully-fledged platform with apps for buyers, sellers, and delivery. I’m considering finding a technical co-founder to build this vision from scratch. The challenge? My budget is tight (hence, WordPress initially).

Any advice on how to proceed or whether I should stick with WordPress? Should I really be looking for a co-founder at this stage?

/r/django
https://redd.it/1g8z6h0
Configuring a Lambda to act as a Celery Worker.

Hi, i'm looking for advise on how to proper use a lambda to mimic a worker job, by using the following configuration:

AWS MQ using rabbitMQ as broker.

Lambda with configured Trigger listening on a MQ queue.

A Workflow defined in my celery app with some tasks:

task\_01: runs on a celery worker instance.
task\_02: runs on lambda, i put then on a specific queue that no other worker listen to.
task\_03: runs on a celery worker instance.

    workflow = chain(
        task_01.s(),
        task_02.s(),
        task_03.s()
)

If i execute task\_01, the lambda on task\_02 is triggered correctly, but i need to mimic celery code, save the result to the backend and trigger task\_03 correctly.

I'm currently using the code below to save the task\_02 result, but i need to make some workflow functions like chain, group, chord, to be called.

from celery.worker.request import Request

def handler(event, context):
message_data = # get the data from the

/r/django
https://redd.it/1g97dfl
Personal portfolio

I made my personal portfolio using flask, I am serving a blog and resource sharing there. Just wanted to show it to the world, theres a link to a flask ecommerce template there under resources if someone wants to take a look! Also feedback is welcome
silverboi.me https://silverboi.me

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