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
Interactive plots in the terminal

I made a library to create interactive plots in the terminal ([pip install itrm](https://pypi.org/project/itrm/)). It uses braille characters (by default) to display the data with sub-character resolution. There are several keybindings for moving a vertical cursor left and right, for zooming in or out on data, and for changing which curve to focus on. There are occasions (such as when working with a server) where MatPlotLib is not an option and the terminal is the only available tool. But, in my opinion, it is actually faster to use this tool (itrm) to zoom in on interesting parts of data and analyze patterns than using other tools like MatPlotLib. In fact, with large data sets (\~1 million points), this tool actually renders faster than MatPlotLib. Please check it out and let know what you think.
![](https://gitlab.com/davidwoodburn/itrm/-/raw/main/figures/fig_iplot.png)

/r/Python
https://redd.it/1cor562
Django + React Shopping Cart

For Django Developers, mastering full-stack web app development with Django and a frontend framework sets you apart in the job market. I recently began a beginner series on creating web apps with Django and React. If this aligns with your interests, I'm confident this series will be extremely beneficial for you.

Episode 1 starts here 👇.
https://youtu.be/SD2l2-_y2sw?si=QEWI6I78exr7o45A

/r/djangolearning
https://redd.it/1cofsla
How to do unit and integration testing?

I created this project for a college project, but I have doubts about how I should do the unit and integration tests. I created some tests, but my colleague said they were e2e tests, which does not fit the job requirements. So if anyone can explain how I should do these tests and how far my tests are from the objective of the work.

https://github.com/GabrieldbSouza/Personal-Finance-Management/tree/main/server%2Ftests

/r/flask
https://redd.it/1cozm7e
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/1cp43wy
Need some advice for Auth with Django Rest Framework APIs

Here is some context

App will be used by people that hold sensitive information
App will be accessed via web (Nextjs) and mobile (React Native)
I need organization support
I want to use HTTP-only cookies for web and token based auth for mobile

App structure

I will add organization and add an admin for it
Organization admin can then make other admins and organization users

I have looked at Auth0, Clerk, and Supertokens. I don't mind paying for auth but these platforms seem to only provide token based authorization that resides in Authorization header of request. Or maybe I have missed something in their documentation.

Secondly, I want to build a single auth API that can be consumed on both web and mobile.

I have also looked at django-allauth and django-organizations to see if I can self-do authentication but I am not sure if it is worth the risk to do it myself considering security implications. Also, I havent found anything that is exactly what I need.

Let me know what you guys think. Also does anyone have a demo or open source project that does similar to what I am trying to do? I would love to look at it.

/r/django
https://redd.it/1cp2ozf
I have learned django from cs50w course. what I should do next?

I have learned basic django from cs50w course, but I want to built good websites, what are thr things should I learn next and from where (if u can tell me)? Please!

(I know basic Javascript)

/r/django
https://redd.it/1cp61n6
IP subnet or IP calculator tool need feedback

Hey folks,

I've been dabbling with a Python project recently that's all about making life easier for us I.T. people. It's a nifty little tool that calculates IP subnets and does IP calculations from the command or CLI.

Here's the GitHub link and the code:

https://github.com/nicanorflavier/ipnet

I’m pretty stoked about it, but I know there’s always room for improvement. So, I thought, better to turn to than the wise minds of this python community?

I’m all ears for any feedback, tips, tricks, or advice you guys might have. Thanks a ton in advance!

/r/Python
https://redd.it/1comgeg
Help with Django-star-ratings and django-comments-xtd

I think I have really confused myself. I wanted to make the star rating part of the comment form but I’m not sure how to do it.

Has anyone had any experience with this?

I’m not sure how to add a field to the comment model for it to be then used in the form and render like it’s meant to in the Django-star-ratings library.

It seems that in the documentation for Django-star-ratings they just have template tags but not sure how I should make this work with the rest of the comment code.

/r/djangolearning
https://redd.it/1co1v0e
Dictionary is not getting populated with the a list of users

I have code query below. Anniversary stores the number of years after burial date. If anniversary is less than or equal to zero, then the deceased person is not yet buried, therefore, users are allowed to send condolence messages, otherwise the tab changes to anniversary messages. A user is only allowed to send one condolence or anniversary message, otherwise the button to edit his/her condolence/anniversary message appears. But unfortunately the author_dict is not getting populated for the code to check whether a user has already posted or not. Help me understand and correct my code why the authors_dict is not getting populated. The database has data. I am using flask, sqlachemy and sqlite database:

# Initialize the variable
authors_dict = {}

/r/flask
https://redd.it/1cp9n58
R Marcus Hutter's work on Universal Artificial Intelligence

Marcus Hutter, a senior researcher at Google DeepMind, has written two books on Universal Artificial Intelligence (UAI), one in 2005 and one hot off the press in 2024. The main goal of UAI is to develop a mathematical theory for combining sequential prediction (which seeks to predict the distribution of the next observation) together with action (which seeks to maximize expected reward), since these are among the problems that intelligent agents face when interacting in an unknown environment. Solomonoff induction provides a universal approach to sequence prediction in that it constructs an optimal prior (in a certain sense) over the space of all computable distributions of sequences, thus enabling Bayesian updating to enable convergence to the true predictive distribution (assuming the latter is computable). Combining Solomonoff induction with optimal action leads us to an agent known as AIXI, which in this theoretical setting, can be argued to be a mathematical incarnation of artificial general intelligence (AGI): it is an agent which acts optimally in general, unknown environments. More generally, Shane Legg and Marcus Hutter have proposed a definition of "universal intelligence" in their paper https://arxiv.org/abs/0712.3329

In my technical whiteboard conversation with Hutter, we cover aspects of Universal AI in detail:

https://preview.redd.it/o6700v1udrzc1.png?width=3329&format=png&auto=webp&s=c00b825dbd4d7c266ffec5a31d994661348bff49

Youtube: https://www.youtube.com/watch?v=7TgOwMW\_rnk&list=PL0uWtVBhzF5AzYKq5rI7gom5WU1iwPIZO



/r/MachineLearning
https://redd.it/1cpcwuz
I made a Python text to speech library - Pyt2s

What my project does: It supports services like IBM Watson, Acapela and Stream labs' demo websites to convert your text to speech.

Target audience: It's a toy project and would not recommend you to use in Production.

Comparison: It's wayyyyy easy to use. Just pip install and use in your project. No extra setup required like other libraries. Also supports various languages and voices and accents. Check docs for more.

Here is the link to repository.

Please go do check it out and star it if it's helpful to you guys. Thank you.

I made this library taking inspiration from this php tts library by chrisjp.

/r/Python
https://redd.it/1cpbn3u
Jupyter Themes Not Working Recently?

Today, out of nowhere, my anaconda Navigator would not launch in Windows 10, so I uninstalled/reinstalled it. This fixed that issue, but when I boot up the Anaconda Navigator --> Jupyter Notebook, open Notebook,
pip install jupyterthemes
!jt -t monokai -T -N -kl

it runs fine, but when I refresh it is still set to setting light theme and nothing changed (I can change the theme in the settings bar only to light or dark). I have tried restarting my machine, closing the browser, clearing the browser cache, running the jt -t monokai -T -N -kl command in anaconda prompt (seems to run fine there with no errors), but nothing is changing my theme anymore to monokai. Anyone know if this is a problem with some recent change or if I have something setup wrong?

/r/JupyterNotebooks
https://redd.it/1cp35e4
Should I share on Github the source code of the Django websites I design for commercial purposes?

Hello everyone. I have successfully designed my first professionally looking django blog that is production ready, with bookmarks, likes, etc. I intend to deploy it someday for personal use or sell to someone else. I also want to show this project to potential employers as part of my portfolio projects. Eventhough I have kept sensitive information in a .env file, kept in gitignore, I worry the logic powering the site, such as views.py files, may be widely accessible. What is considered good practice in showcasing your Django projects without hosting every website you design?

/r/django
https://redd.it/1cpd0l6
D Dealing with conflicting training configurations in reference works.

I am working on active learning for object detection, and I am at the stage where I need to setup my training configuration to run the experiments. I am not planning on rerunning the experiments of the other works because I don't have the compute, nor time. But I will still be comparing my results with theirs, and for that I will have to follow the training configurations used in those works.

The problem is different papers report different configurations, although they are comparing their results with each other. The paper that other methods usually compare themselves with is the MI-AOD - CVPR21 paper, since it is the first AL method for object detection in CVPR. For RetinaNet, they train 26 epochs with LR of 0.001, stepping by 0.1 at epoch 20.

Then comes the CVPR22 paper which uses the standard 1x schedule for RetinaNet training (12 epochs, 0.02 LR, and steps at epoch 8 and 11). Yet, they're comparing their results with the MI-AOD paper and it doesn't seem like they rerun the experiments with their settings because the mAP looks exactly the same as the one reported in the original. I can only judge it by looks because they only

/r/MachineLearning
https://redd.it/1cpi9gc
APScheduler vs Schedule package

Hey folks, looking to use one library to implement some background scheduling logic on my application.

I find in Google search APScheduler to be frequently mentioned, but I can see the Schedule package has more GH stars.

Was curious if anybody has used one of them, and which one would you recommend based on your own experience.

/r/Python
https://redd.it/1cpj8ra
2,000 lines of Python code to make this scrolling ASCII art animation: "The Forbidden Zone"

* What My Project Does

This is a music video of the output of a Python program: https://www.youtube.com/watch?v=Sjk4UMpJqVs

I'm the author of Automate the Boring Stuff with Python and I teach people to code. As part of that, I created something I call "scroll art". Scroll art is a program that prints text from a loop, eventually filling the screen and causing the text to scroll up. (Something like those BASIC programs that are 10 PRINT "HELLO"; 20 GOTO 10)

Once printed, text cannot be erased, it can only be scrolled up. It's an easy and artistic way for beginners to get into coding, but it's surprising how sophisticated they can become.

The source code for this animation is here: https://github.com/asweigart/scrollart/blob/main/python/forbiddenzone.py (read the comments at the top to figure out how to run it with the forbiddenzonecontrol.py program which is also in that repo)

The output text is procedurally generated from random numbers, so like a lava lamp, it is unpredictable and never exactly the same twice.

This video is a collection of scroll art to the music of "The Forbidden Zone," which was released in 1980 by the band Oingo Boingo, led by Danny Elfman (known for composing the theme song to The Simpsons.) It

/r/Python
https://redd.it/1cpq2d9
P Open source library to scrape PDFs, YouTube, URLs, Presentations, etc for API-hosted vision-language models

Here I will share an open source library you can use to extract text and visual unstructured data from files, webpages, youtube videos, etc to immediately feed the results into API-hosted vision language models (like GPT-4-Vision or Gemini). I made this simple tool because I was unable to get vision functionality with other extraction frameworks like unstructuredio, langchain exctractors, document layout analysis models, etc,

Cheers & have fun!

/r/MachineLearning
https://redd.it/1cpnlqe