Python Daily – Telegram
Python Daily
2.56K subscribers
1.49K photos
53 videos
2 files
39.1K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Sharing Smoke Simulation Project I have Been Working On

Hello all, I have been working on this project for quite some time and found it to be very useful for my task as a software engineer trying to build Computer Vision applications. My daily job involves working with smokey images and finding models but getting smokey images on demand was not possible and hence I came up with an idea to make a simulator. I modified the existing solution from bijection/smoke.js and implemented it with Python.

Links:

GitHub Repo: [https://github.com/q-viper/SmokeSim/](https://github.com/q-viper/SmokeSim/)
Demo: https://q-viper.github.io/SmokeSim/ (This demo is from only the JavaScript Version.)

## What My Project Does

It simulates a reproducible smoke image using PyGame. The property of the smoke and its particles can be controlled by the properties like size, velocity, lifetime, color, etc. In addition to that, this package can act as an image augmentation and can return the overlayed smoke mask, overlayed image, and smoke too.

## Target Audience

The main target audience would be anyone who is working on Computer Vision projects or image augmentation and looking for a cool way to increase training images. However, anyone who is interested in building something fun with Python and collaboration might find it interesting.

## Comparison

There are packages like Torchvision and Albumentations and this feature

/r/Python
https://redd.it/1h9t8r7
Python Quiz for Beginners and Experts

Curated a 40 questions quiz on Python coding. Test your knowledge with this quiz. Would love to know your score and feedback!!

I will keep updatig this quiz to make it more comprehensive.

Try this Python quiz here.

/r/Python
https://redd.it/1h9fg6x
How can I host my dynamic Django website, which includes an ML implementation like a BERT model, for completely free?

Hey, I want to host my dynamic Django website, which includes ML implementations like a BERT model, an NSFW detector, and CNN, for free because I don’t have any money. I’m just a student, or you could say someone learning ML and DL from the internet. I’m not someone who’s completely mastered coding yet, so I haven’t landed a job—I’m still learning the code and math behind it all. I also come from a non-tech background.

With what I’ve learned so far, I want to expand my knowledge by implementing it in a website. However, I can’t afford to pay for hosting. I know some platforms, like AWS Free Tier, offer free services for 12 months, but what happens after that? From where would I pay? Also, I’m not expecting the website to become popular overnight—it might take more than a year to gain traction.

Can anyone suggest completely free hosting solutions for projects like this? Any advice or guidance would mean a lot!

/r/django
https://redd.it/1ha0h34
Convert Figma design into Python code

🔗 Link — https://github.com/axorax/tkforge

# What My Project Does

TkForge is a Python app that allows you to turn your Figma design into Python tkinter code. So, you can make a GUI design in Figma and use specific names like "textbox", "circle", "image" and more for interactable elements then use TkForge to get the code for a fully functional working GUI app from your design.

And it's free, open-source and regularly maintained!

# Target Audience

TkForge is made for anyone who wants to make a GUI with Python easily and efficiently. It's fast and you can make some really complex and beautiful GUI's with it.

# Comparison

There's another project similar to TkForge called Tkinter Designer. Personally without being biased, I think TkForge is better. TkForge supports everything Tkinter Designer does and more. TkForge generates better code, supports more elements, allows you to add placeholder text (which you can't by default in tkinter), automatically sets foreground color and a lot more! Placeholder text and foreground color generation is a bit buggy though. I use TkForge for most of my tkinter projects. You can get help in the Discord server.

# Updates

I updated the app to support multiple frames, fixed a lot of previous bugs and added checks

/r/Python
https://redd.it/1ha47wt
Question about best practices with ForeignKeys

I'm relatively new to django and i'm working on a project where I'm currently designing the model relationships, and I'm curious about the best practices for handling multiple foreign key references to the same model.

Here's my specific scenario:

I have an Assignment model
I want to track which users are assigned to this assignment (using a many-to-many field)
I'm also creating individual Job models for each assignee
Each Job will have a foreign key to a specific user

My questions for the community:

1. Is it considered an anti-pattern to have both a many-to-many relationship at the Assignment level and individual foreign key references in the Job model?
2. What are the performance implications of this approach?
3. Are there better ways to model this kind of workflow?

/r/django
https://redd.it/1ha50ay
Introducing PyKick: A Python Project Generator for PowerShell

**Hello everyone,**

Even with the intention of sharing, it's always a bit stressful to expose personal work to the community =}

But well... Maybe someone has the same question or need as I did, so with that in mind, I'm sharing my modest work done during my free time in the evenings (when the whole family is asleep =D) As you can see, besides the templates, there isn't anything particularly special – PyKick does what it needs to do and voilà – unit tests were the most time-consuming, as always (the PowerShell module was quick to write).

# What My Project Does

PyKick is an installable PowerShell module (or can be sourced otherwise) that quickly generates a new Python project with Git management, a virtual environment, and Sphinx documentation (if requested). In my Python projects, I need CLI exposure. Therefore, the generated Python project is immediately functional (a `pip install .` results in a CLI providing package information and version - the structure is here, just to complete)

PyKick doesn't aim to replace anything. Not finding something that met my needs, I ended up writing it without realizing it =}

# Target Audience

I think it's quite clear =þ

* If you are a developer or need a

/r/Python
https://redd.it/1ha65l9
Create a complete WORD SEARCH BOOK with a single click.

# [BOOP (Book Of Organized Puzzles)](https://github.com/Muneer320/BOOP)

# Denoscription

BOOP is a Python-based automation project that generates a fully personalized puzzle book. With just a list of words as input, it creates a complete PDF with noscript pages, index pages, word search puzzles, and solutions.

Why did I make this? Honestly:

1. I was bored and needed something fun to work on.
2. I already had a noscript that could make word search puzzles, so I thought, "Why not take it up a notch?"
3. I’ve always wanted to write a book but lack the intellectual supremacy to do so. This project seemed like the next best thing!

# Links

* [Sample PDF Output](https://drive.google.com/file/d/1KkbCUuIuO8hmeHavUyO8e90r4qIQCxPc)
* [GitHub Repository](https://github.com/Muneer320/BOOP)

# What My Project Does

* **Word Search Puzzles**: Generates 17 puzzles per topic, categorized into Normal, Hard, and Bonus modes.
* Normal: 10 puzzles (13x13 grid).
* Hard: 5 puzzles (17x17 grid).
* Bonus: 2 challenging puzzles.
* **Fully Designed Book**: Includes noscript pages, a detailed index, puzzle pages, and solution pages.
* **Automation**: Users only need to input a list of 200 words per topic; the noscript handles everything else.

# Target Audience

* Puzzle enthusiasts looking for custom-made puzzle books.
* Educators creating engaging learning materials.
* Developers interested in Python-based automation

/r/Python
https://redd.it/1ha82ex
Udemy Fred's Python 3 course vs. GT Computing in Python course

I am an average Python programmer (I can do some OOP and simple noscripts, but nothing really advanced) and wanted to improve my skills. I have narrowed down my Python resources to two courses, both in four parts:

1. Fred Baptiste Udemy course on Python 3 (in four parts)

2. Georgia Tech Computing in Python course (in four parts, too)

My employer should be able to reimburse both, so money is not an issue here - the question is which one would you suggest to choose to actually improve my Python skills and practice coding along the way? Meaning learning, but also implementing new concepts (so that they stick)? I assume the Georgia Tech is a nicer certificate to have (which is a plus for sure), but curious about actual content. Thanks so much!

/r/Python
https://redd.it/1ha7o5n
D Has anyone managed to train an LLM with model parallelism?

Hello,

I am working on fine-tuning Llama-3.1 for my master’s thesis research. Unfortunately, my current situation forbids access to high-memory GPUs such as A100s. Instead, I have access to setups with multiple lower-memory GPUs, such as 4×3090 or 8×V100.

Therefore I need to implement model parallelism to train my model as it doesn’t fit into a single GPU. However, I’ve noticed that most frameworks primarily focus on data parallelism, which doesn’t address my needs.

Has anyone successfully trained a model by splitting it across multiple GPUs? If so, could you recommend frameworks or approaches I should explore? I am specifically looking for full training, although I am interested in hearing if someone managed this using LoRA.

Also, if there’s a more suitable subreddit for this type of question, please direct me to there.

Thank you!

/r/MachineLearning
https://redd.it/1habr8l
Best way to serve media files via flask?

Hello,

Working on a flask project currently which will serve a lot of media files. Photos aren't really an issue just videos, im not streaming them since the hadware isn't great enough to do so.

What would be the best way to serve them with low hardware? Use object storage? Or even use flask?

/r/flask
https://redd.it/1hae62n
Flask socketio production server

I have a flask application that is only accessed by me. It is hosted on a google cloud linux VM and I have a firewall set up to only allow my IP.

I've been using socketio.run(app) for now, but get the warning that this is a development server. I tried following tutorials for gunicorn and nginx but encountered problems with socketio and selenium chromedriver (there is so scraping that periodically runs in my app).

Since I don't have problems using the development server and I'm the only person accessing the web app, is there any problem with me leaving my app running like this? I've spent a whole day trying to get a production server up following various tutorials but always seem to have problems.

/r/flask
https://redd.it/1hacdg2
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1haod3g
How do we send email using django-allauth now when Less Secure Apps are disabled?

Is there any way to use Oauth2.0 with django-allauth to keep sending verification emails now? I cant find anything on how to do this ( too dumb to figure it out )

/r/django
https://redd.it/1haju0a
DNS server written in Python

Hi All

I am researching the DNS protocol in depth (security research) and have written a DNS server in Python that relies on responses from a upstream service (Quad9,for now). Hope you all like it. Do recommend improvements.

Link: https://xer0x.in/dns-server-in-python/

PS: I am aware of the Blocklist parsing inconsistency bug.

/r/Python
https://redd.it/1hagkql
Suggestions

I have been working with Django framework for like 1.5 years or more. Built couple of projects.However at this point i m confused, if i am eligible for the entry level job.What kind of code will we be writing in the actual workplace and what essential topics are required to master in backend frameworks like django or flask or restapi

/r/django
https://redd.it/1harpqr
Looking to Transition from Web Development to Python – Seeking Tips and Insights

I’ve been working as a JS web developer for over 8 years now, but I’ve found myself losing interest in it. I’m really looking to make a switch to something new, and I’ve been getting advice to get into Python and move into that field. However, I’m not entirely sure what the career opportunities in Python are like, or how I can best break into it.

Has anyone else made a similar transition? I’d love to hear about your experiences and any advice you have on how to make this switch successfully. Specifically, I’m curious about:

The job market for Python developers
The skills and projects I should focus on to get noticed. How much time would it take.
Any roadmaps or resources you’d recommend.

Thank you in advance!

/r/Python
https://redd.it/1hagupi
3rd year university student with solid skills developing in Django, looking to work on projects or under someone. I can send link to my resume and some projects I've worked if interested.

On winter break from university and looking for some things to do, hoping to learn and expand my skills. Been applying to internships, but no luck so far. Reach out if interested.

/r/django
https://redd.it/1hanfcf
I build PdfDing with Python

Hi r/Python,

over the last six months I have build PdfDing. You can find it on GitHub.

What My Project Does

PdfDing is a selfhosted PDF manager and viewer offering a seamless user experience on multiple devices. Some of its features include:

Remembers current position - continue where you stopped reading on any device
Share PDFs with an external audience via a link or a QR Code. Shared PDFs can be access controlled
Dark Mode, colored themes and custom theme colors
Inverted color mode for reading PDFs
SSO support via OIDC

 I have used the following tech stack:

the web app is build using Python (Django)
The frondend is build using Alpine.js, htmx, jQuery and Tailwind CSS
Mozilla's PDF.js is used for viewing PDF files in the browser

Target Audience

Homelabs or businesses who want a self-hosted solution for their PDFs.

Comparison

There are solutions like self-hosted ebook readers. However, they are using the inbuilt PDF viewer of the browser. This works fine on desktops and laptops but on smartphones it will simply download the PDF file and not display it in the browser (at least it is like this on my mobile devices). This solution also does not allow you to continue reading where you stopped on another

/r/Python
https://redd.it/1haxeb7
Django-tenant: Accessing tenant data in public domain

I was working on Django-tenant where I have tenant model called Appointment now I want to get the appointment of a specific tenant from the public domain but I'm having an issue when rendering it in the template

class OrganizationAppointmentList(LoginRequiredMixin, TenantMixin, ListView):
templatename = 'main/appointments/listappointment.html'
paginateby = 10

def get
queryset(self):
tenantid = self.kwargs.get('pk')
try:
tenant = Organization.objects.get(id=tenant
id)
self.schemaname = tenant.schemaname
with schemacontext(self.schemaname):
queryset = Appointment.objects.all()
return queryset


/r/django
https://redd.it/1hazu2h
Difference between get and filter? Cant understand even after reading several posts.

I am trying to write a function which requires to get some values from the database.

following is the model.

class Questions(models.Model):
    category = models.CharField(maxlength=50)
    question = models.CharField(max
length=255)
    answer1 = models.CharField(maxlength=255)
    answer2 = models.CharField(max
length=255)
    answer3 = models.CharField(maxlength=255)
    answer4 = models.CharField(max
length=255)
    answerkey = models.CharField(maxlength=25)

so in shell when I use Questions.objects.get(id = 1) I get <Questions: Questions object (1)>

but when I use

Questions.objects.get(id = 1).values() i get an error.

AttributeError: 'Questions' object has no attribute 'values'

When I use Questions.objects.filter(id = 1).values()

I will get <QuerySet [{'id': 1, 'category': 'gk', 'question': 'What is the 10th letter of english alphabet?', 'answer1': 'K', 'answer2': 'j', 'answer3': 'l', 'answer4': 'i', 'answer_key': 'answer2'}]>

So what's the difference? All articls/post answers say that filter will filter results and will give all objects where id = 1 (in this case id is default primary key so its only one), while get will get you exact match. But then why cant values() does not work with get if it has found

/r/django
https://redd.it/1hb2rj2
Pype - Python Desktop App Framework

I created a python framework that easily enables users to create reactive desktop applications with Python backend and HTML frontend.

What My Project Does

Easily enables the user to create desktop applications with a Python backend and a HTML frontend. Using the frameworks functions listed in the documentation reactive variables, state-management and dynamic UI-s can be created with ease.

Feel free to use it if you see fit. Also im very much open to discussion as this is my first public project that i published, errors have a very high chance of appering.

PyPI pype-framework

Pype Github


edit: I used a post template so i can post here and forgot the delete the post templates text...

/r/Python
https://redd.it/1hb0jr4