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
Saturday Daily Thread: Share your resources!

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/ky7bib
Django rest - Testing

Hi!

Im my work im using django rest framework with Reactjs an im testing the frontend. My question is, is there any way that i can make a mock database just for testing in a request made in the frontend? idk if im clear about the question, let me know

thanks in advanced

/r/django
https://redd.it/ky3jfe
Second version of my first Django App

I want to show you how my project is going. The first pic is when I was learning django basics and the last one is the app with django + vuejs.

​

Learning Django basics \(How it started\)

​

Current version built with DRF + Vue.js \(How it's going\)

​

Left aside on hover event

Rigth now i'm very happy for the results and I'm very close to have a mvp of this app so I want to know if you guys want to help me proving that, looking for possible bugs and giving me feedback when this app be ready.

Also I want to know if you would like that I write a blog telling how I built it or what was my learning proccess or tell me what kind of thing you would like that I write about.

/r/django
https://redd.it/kyc3yy
How can I perform push notifications in flask?

The only library I can find that the provides what I need is called Flask-Notifications but is no longer hosted on pypi and it is almost 6 years old now. Is there any modern flask library or something similar that allows me to perform web push notifications?

/r/flask
https://redd.it/ky4kbc
P best-of-jupyter: A ranked list of awesome Jupyter Notebook, Hub, and Lab projects

https://i.redd.it/pq6h29f3qbb61.gif

We've curated a list of the best Jupyter Notebook, Hub, and Lab open-source projects!

The list is fully automated via GitHub Actions, so it will never get outdated. Every week it collects metadata from GitHub and package managers, calculates quality scores to rank projects inside categories, and identifies trending projects.

🔗 GitHub: https://github.com/ml-tooling/best-of-jupyter

🎉 We also released a few other best-of lists on Reddit today:

[best-of-ml-python](https://www.reddit.com/r/MachineLearning/comments/kx8e13/p_bestofmlpython_a_ranked_list_of_awesome_machine/): Python libraries for machine learning.
best-of-web-python: Python libraries for web development.
[best-of-python-dev](https://github.com/ml-tooling/best-of-python-dev): Python developer tools and libraries.
best-of-python: General overview of Python libraries & tools.

📫 For updates on trending projects, new additions and detailed comparisons, follow us on Twitter or subscribe to our weekly newsletter.

/r/IPython
https://redd.it/kx8v15
RepostSleuthBot - Now Public

I've been working on this project for the last 2 years. It has gotten super popular and I've had a ton of requests to open the code up. I was always resistant since I considered it kind of a mess. I decided to take some time to clean it up a bit and make the repo public.

It has a lot going on, but nothing very complicated.

It makes heavy use of Celery for scheduling jobs and runs \~20 Docker containers for the various services.

It's not something you would easily be able to deploy on your own, however, I figured some people might be interested in seeing the workings.

https://github.com/barrycarey/RedditRepostSleuth

/r/Python
https://redd.it/kyb9rc
Rock Paper Scissors by a Beginner

Just a little game I programmed to test and improve my skills and I am pretty much satisfied with the end-product.

My first program where input function hasn't been used so no need to press ENTER key and you can play it by pressing "R", "S" and "P" keys.

Rock Paper Scissors Game

Thank You.

/r/Python
https://redd.it/kyhpm2
How to disable "searching..." message in django-autocomplete-light dropdown

Hey everyone,

I've been struggling with something I guess should be simple: I'm using django-autocomplete-light and django-taggit to autocomplete a tag select. The dropdown briefly shows a "searching ..." message at the top of the result list, even when all the results are already there.

I'd like to disable it, but have difficulties figuring out how.

It's possible that I should overwrite a javascript function, but I'm not sure and my javascript knowledge is limited, so debugging is hard. Any pointers would be greatly appreciated.

Thanks!

/r/django
https://redd.it/kyhu6s
Package that allows you to import files like modules

Hi everyone! Just made a package that allows you import data files (like .json , .yaml and more) like they are python modules

Link to github: https://github.com/mishankov/crazy-imports

And a question: does anyone know other packages that do similar things?

/r/Python
https://redd.it/kyir2l
Is bleach.clean() adequate protection from XSS attacks?

I have forms and url query string inputs that are returning a bleached output for CharFields.

FORMS:
def cleanemail(self):
email = self.cleaned
data‘email’
if email:
return bleach.clean(email.lower())

URL QUERY STRING:
query = request.GET.get(‘q’)
bleachedquery = bleach.clean(query).lower()

blogs = Blogs.objects.filter(poststartswith=bleached
query)


If this enough or overkilled? What are better alternatives?

/r/django
https://redd.it/kypom5
Whats the best way to implement this idea?

I'm working on creating my first real django web app and its going good but I can't decide on how to implement the next part.

So far my app takes in a search query from the user, then scrapes a website based on that search query, saves the scraped info into a list of dictionaries, and then displays those results in a nice grid display back to the user.

Where I'm stuck at now is I want there to be either a checkbox, or a button in each result that the user can check/click and each of the items the user checked off, will be added to a new list to be sent to another scraper function to gather more in depth data on those items.

So user enters a search query, app returns basic info on matching items, user checks which of those items they want more details on, then app scrapes more detailed data but only for the items the user clicked the checkbox.

Should each checkbox be its own django form?
Or should there be a submit button at the bottom and when the user clicks it, a script can iterate through all the items and if checkbox is checked,

/r/djangolearning
https://redd.it/kyqr6s
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/kyuo40
For those interested in Audio DSP coding in Python

Hi all,
over the past year I got back into coding after 6 years in the audio industry. I worked on an audio effects python library for processing audio files and streams for the past 6 months. It actually works quite well with a few bugs remaining and I would just like to share it and maybe get some feedback. I think it is cool, because the only dependency is numpy and you can actually see whats happens with your arrays, so nearly no blackboxing takes place. I mainly used numpy and with some tricks managed to stay below 1.0 millisecond for most processors with a buffer size of 512, so you can actually use most of them in real-time with pyaudio.

Also, I released it under the MIT licence, so feel free to use it in any way you want.


There are quite a few effects I managed to implement and it is one of those resources I wish I had a year ago, just to see different fx in action in a simplified manner. It might also be useful for super easy batch-processing of audio data-sets for CNNs, prototyping vst plugins or do fun stuff with

/r/Python
https://redd.it/kyop0d
I want to create a simple video based website, i don't know how to manage the videos.

Sorry if this isn't the place to post this.

The website will just be a main page, about and a post page, i will be the only one that will upload the videos from the backend, users can only see the website and the videos.

where do i store the videos and how can i upload them?
do i use a form ?
What form can i use for this?
or in what other way can i do this?

/r/django
https://redd.it/kysbjg
Instead of being productive, I wasted my time creating a tool that helps me be productive

Title says it all. Instead of studying, I created a pomodoro GUI application that helps me battle my procrastination and it actually helped. I did this over the course of two days in Python with PyQt5

https://github.com/burakmartin/pomodoro

/r/Python
https://redd.it/kyws9p
This media is not supported in your browser
VIEW IN TELEGRAM
[P] (Updated) Automatically Overlaying Baseball Pitch Motion and Trajectory in Realtime (Open Source)

/r/MachineLearning
https://redd.it/kykfh0
N GPT-3 replicate as open source

This is a grassroots group of researchers working to open source AI research https://www.eleuther.ai/

including https://www.eleuther.ai/gpt-neo

/r/MachineLearning
https://redd.it/kyzv0u
Book recommendations

I have been learning the Django for a bout one and half months, after leaning a basic python for two months(i have no experience with programming before, super noob). Now I can build just a simple to do app stuff and blogs but I still habe no idea what’s really going on behind scenes, and felt I need a book for better understanding or whatnot,

So my question is; is there a good guide book for me at the moment? I looked it up and found some ‘Django for beginners by William Vincent’ and ‘two scoops of django’ which lots of people say it’s not for beginners.

Or another way is to learn Flask first for better understanding behind surfaces,,and then back to learning Django,,

What do you guys think?
Your advice and opinion will be very appreciated!

/r/django
https://redd.it/kz4fv2
Worried that heavy use of SQL is an antipattern?

Hi,

I'm setting up a couple of routes whereby I'd like to fetch a set of results for the user based on some complex(ish) filter behaviour.

What I've been doing so far is creating queries in SQLalchemy, wrapping them up into a custom BaseQuery class to standardise some of the methods, and invoking the relevant query instance in my routes.

The queries themselves get quite complex, so I've made efforts to break them into CTEs for testing and traceability purposes, in a couple of cases I've got 3 or 4 CTEs chained together. I've also delegated the more complex queries to background tasks in celery, to stop them from clogging up the request queue.

I'm also using Azure SQL so I have the option to scale the hardware if needed.

My thinking was that offloading the filtering logic to SQL gives the query optimiser the chance to do its magic and would be better than me trying to optimise inside the application.

I am, however, worried that implementing logic in this way is a bit of an anti pattern because:

I haven't seen many examples online with a similar approach
The filtering logic is sitting within the SQL query, which I'm worried

/r/flask
https://redd.it/kz5rjk
I just created a script that relocates dowloaded files based on their extensions!

This script is very useful in case your downloading files all day long and you feel kind of lost in your download folder!

Please tell me what you think of my repo and what I could Improve.

I'm posting this to get visibility but also to get some returns so that I can improve my repo and code :)

here is the repo: https://github.com/aime-risson/pyFileManager

/r/Python
https://redd.it/kz4gqu