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
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
Looking for a mid-ish level web project in django or flash more info below

I am working on transitioning some data projects to the web. I know an okay amount of HTML CSS and a bit of JS so I could do it that way. I would rather build a couple sites just using python using flash or django. I just can't seem to find a repo or tutorial thats not super basic or advanced. Anyone have one that falls in the middle area they would be willing to share?

/r/Python
https://redd.it/1hb8f7h
Where would you host a web app expecting only about ~100 visitors per month?

Where would you suggest a relatively new dev host a django app expecting about \~100 users per month, with a postgres database containing about 100-200 entries? I have experience with Heroku and pythonanywhere but Heroku is a bit too expensive for now($5 hosting + $9 postgres). I've also used DO spaces but never hosted there and don't want to deal with DevOps right now. I've also seen Namecheap suggestions but not a lot of reviews.

/r/django
https://redd.it/1hb8hn4
Inventory management Schema

I figured this would be more appropriate asked in a database design group, but since I'm using Django, I'd like to get a better understanding with Django.

How would you handle items with different sizes and quantity in an inventory. For example, a pack of cigarettes has 12 pieces, a crate of eggs has 30 eggs. I procured 3 crates of eggs and 2 packs of cigarettes, how do I track that? How about if I have a liquid that comes in 20 liters, 30 liters and 10 liters bottles. How do I track these items including those properties in an inventory.




/r/django
https://redd.it/1hba5yb
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

/r/Python
https://redd.it/1hbg7qh
Question about storing audio files

I am creating a web application where you can put music files inside that are added to a list where you can start, delete and eventually download in the future all your files that you have put. Now, what I was thinking of doing was using a database that keeps the path where each user's files are (divided into folders and subfolders; example: songs/Amanda56/song.mp3). I was thinking of creating these in urls that are added dynamically over time (example: when a user registers with the nickname Giorgio192, a url called: https:/www.mysite.com/storage/songs/Giorgio192/ will be created. The songs url already exists, the one that will be added is Giorgio192 (his username therefore). When Giorgio192 adds a new song to his list, this song will be stored in songs/Giorgio192/song.mp3 while the url that is used to extract the songs from there will be saved in my database. Is this method strange? Would it slow down my site a lot over time? If so, how? Is there a way to do what I want?

/r/flask
https://redd.it/1hb6fp0
D From Unemployment to Lisp: Running GPT-2 on a Teen's Deep Learning Compiler

A couple months ago I found myself unemployed, uncertain about what to do next. I wanted to learn more about deep learning, but from a systems prespective. Coming from Andrew's Ng course on supervised learning, I was eager to learn more about how deep learning frameworks (or deep learning compilers) like Pytorch or Tinygrad.

I started to poke around Tinygrad, learning from the tutorials I found online, and I found it fascinating because it was an actual compiler, it took conventional python code and translated them into an Abstract Syntax Tree that was parsed into UOps and ScheduleItems, to finally have a codegen layer. While the design was interesting, the code was hard to read.

That's when I stumbled across something completly unexpected, A deep learning compiler built on Common Lisp, maintained by a Japanese 18-year-old during his gap year. And currently we have acomplished something great, it can run gpt2!

For now, it just generates C-kernels, but in the future we would like to support cuda codegen as well as many other features, and serve as a learning tool for anyone who would like to get to work on deep learning compilers in Common Lisp.

This is an open source project and anyone

/r/MachineLearning
https://redd.it/1hb7v5h
D Why are the Stella embedding models so much smaller than other models of similar quality?

On the MTEB Leaderboard, stella_en_v5 is currently ranked 3rd overall, while using one fifth the memory of all non-Stella models in the top 10.

stella_en_400M_v5 is ranked 10th, while using 15-20 times less memory than the models ranked near it. This appears to be relatively consistent across several subtasks of the benchmark (for English).

What is the secret sauce here? Alternatively, what is the catch? There is no paper yet. Anyone know details?

/r/MachineLearning
https://redd.it/1hbkww5
Did an open source tool for code exploration

# Denoscription

Treeline is a code analysis and visualization tool designed to help developers understand the quality and structure of their Python codebases. It does some complexity metrics, detects code smells, and generates an interactive HTML-based visualization for relatively easy exploration. I hope it will give developers some insights into architectural dependencies, complexity hotspots, and maintainability issues.

# Links

* [https://github.com/duriantaco/treeline](https://github.com/duriantaco/treeline)
* [https://pypi.org/project/treeline/](https://pypi.org/project/treeline/)

# What My Project Does

* **Dependency Analysis**: Identifies which modules import others, which classes belong to which modules, and which functions call which, creating a complete dependency graph.
* **Metrics Computation**: Calculates cyclomatic complexity, cognitive complexity, maintainability index, function length, and code smell occurrences.
* **Visualization**: Renders an interactive HTML report using D3.js, where each node represents a module, class, or function. You can hover over nodes to see detailed metrics, search for specific elements.
* **Quality Reporting**: Produces Markdown and HTML reports summarizing complexity hotspots.

# Target Audience

* Anyone using Python

# Extra Details

Started of as a simple ASCII tree generator. Promised to add more stuff so here i am.

# Conclusion

Hopefully you guys will find it useful. If you think it's a stupid idea or ways to improve, do let me know too. I'm open to criticisms and constructive feedback. If you find any bugs

/r/Python
https://redd.it/1hbnasw
Django Web Application Hosted on LAN

Is it possible to set up a centralized application server that hosts a Django web app and a local database, allowing clients on separate computers to access the app for CRUD operations (e.g., managing mail/blacklists) while storing updates locally? The server would also communicate with a ROS2 system on another computer (running AI models and managing daily logs) and optionally sync data to the cloud. Are there any potential challenges or considerations with this architecture?

/r/django
https://redd.it/1hbnynb
Nodriver - The next step in web scraping

Hey guys! Scraping is something we've all needed at some point, whether for personal or professional reasons. But nowadays I feel like I get blocked immediately if I go to any website and tbh I don't want to setup complex patches and go through all that stuff for like a tiny thing. Nodriver solved this problem for me.

Here's an article I wrote about getting started with nodriver and how it faces up with the competition - https://www.hyperbrowser.ai/blog/nodriver_:_The_next_step_in_web_automation


/r/Python
https://redd.it/1hbea0n
Proof of PCAP Certification?

For those of you who have taken (and passed) the PCAP, did you receive anything other than the paper printout after the exam? (I know the PCAP isn't particularly useful, but my company offered me a 3% raise if I passed it so...) I'm just wondering if I should expect an email with some official looking certification or if I should just show the exam printout to my company.

/r/Python
https://redd.it/1hbq85s
The hand-picked selection of the best Python libraries and tools of 2024 – 10th edition!

Hello Python community!

We're excited to share our milestone 10th edition of the Top Python Libraries and tools, continuing our tradition of exploring the Python ecosystem for the most innovative developments of the year.

Based on community feedback (thank you!), we've made a significant change this year: we've split our selections into General Use and AI/ML/Data categories, ensuring something valuable for every Python developer. Our team has carefully reviewed hundreds of libraries to bring you the most impactful tools of 2024.

Read the full article with detailed analysis here: https://tryolabs.com/blog/top-python-libraries-2024

Here's a preview of our top picks:

General Use:

1. **uv** — Lightning-fast Python package manager in Rust
2. **Tach** — Tame module dependencies in large projects
3. **Whenever** — Intuitive datetime library for Python
4. **WAT** — Powerful object inspection tool
5. **peepDB** — Peek at your database effortlessly
6. **Crawlee** — Modern web scraping toolkit
7. **PGQueuer** — PostgreSQL-powered job queue
8. **streamable** — Elegant stream processing for iterables
9. **RightTyper** — Generate static types automatically
10. **Rio** — Modern web apps in pure Python

AI / ML / Data:

1. **BAML** — Domain-specific language for LLMs
2. **marimo** — Notebooks reimagined
3. **OpenHands** — Powerful agent for code development
4. **Crawl4AI** — Intelligent web crawling for AI
5. **LitServe** — Effortless AI model serving
6. **Mirascope** — Unified LLM

/r/Python
https://redd.it/1hbs4t8
Introducing My New Favicon Extraction Tool

## What My Project Does

I've created a tool that extracts favicons from any website. It works by parsing HTML pages, checking fallback routes for icons, and even supports inline base64-encoded images. The tool can also verify availability, guess missing icon sizes, and download the favicons for further processing. It aims to streamline favicon retrieval for web scraping, data analysis or just curious exploration.

## Links

- Source code: https://github.com/AlexMili/extractfavicon/
- Documentation:
https://alexmili.github.io/extractfavicon/


## Target Audience

The project is designed for developers and data enthusiasts who work with web metadata. Whether you’re building a crawler, enhancing a web directory, or simply analyzing website branding. My intention is to maintain and improve it, making it stable and ready for production use cases.


## Comparison

While there are other favicon extraction libraries out there, many of them have become unmaintained or lack features like asynchronous support, thorough availability checks, and automatic size guessing. My project is actively maintained, built with modern Python standards, and provides a more robust, flexible solution than many existing alternatives.

/r/Python
https://redd.it/1hbtf03
How to test Flask with dummy DB

Hi, I have been making a Flask CRUD API, I am using pytest to test the models and everything that can be done without having to initialize the Flask App. However, now I really need to start testing the endpoints. I have checked https://flask.palletsprojects.com/en/stable/testing/ and I am getting a general idea on how to do so, however, I am still a bit lost on how to initialize the database and populate it during the testing. Would love any tips :)

/r/flask
https://redd.it/1hbrbb3
D Resources to get up to the speed with the state of the art evolutionary optimization

There're plenty of good books letting you get close to the state of the art in the field, on Machine Learning, and Deep Learning in particular. However, are there any good modern books on evolutionary optimization? Are there any good courses?

/r/MachineLearning
https://redd.it/1hbt986
Django's built-in test client or pytest?

For testing in a Django project, what should I use Django's built-in test client or pytest?

Or what's the benefit of using one of them instead of the other one?

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