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
This media is not supported in your browser
VIEW IN TELEGRAM
I made a web app using Flask that generates a randomized collage from user-submitted images. https://stitchit.app/

/r/flask
https://redd.it/iaszcp
Load CSVs or store in DB?

Hi all! I’m working on a small saas using flask with python. I’m importing a couple of CSVs that I use as bases to merge with user uploaded files. The files are small, around 50 to 10,000 observations in each.

My question: is it fine to leave them as CSVs that get loaded directly in the app as dataframes, or should I store them in a DB? Is there an advantage to one decision (like memory?)? Is there a best practice like for file sizes? (I.e. if my flat CSV files are ~1000 rows and not changing).

Thanks in advance— any input is appreciated!

/r/flask
https://redd.it/ib2siv
Just released Starshot, a space rogue-like made completely in pygame!

I've just finished development on my game, and developed it completely in pygame! I found pygame easy to get started with but harder to develop more advanced features on, and would love to answer any questions people have about it. Some of the programming challenges included integration into steam (achievements, overlay etc.), developing enemy AI, randomising the level layouts/enemies and testing.


Link to a playthrough of the game:
[https://www.youtube.com/watch?v=WYydSe9keVk](https://www.youtube.com/watch?v=WYydSe9keVk)


Game on steam store:
[https://store.steampowered.com/app/1364570/Starshot/](https://store.steampowered.com/app/1364570/Starshot/)

/r/Python
https://redd.it/ib34wy
Elastic Beanstalk with Celery and SQS

I am trying to set up Celery and SQS on Elastic Beanstalk Linux2 Python 3.7.

I got some error when I was deploying my app to EB. The error was "ImportError: The curl client requires the pycurl library.". I already included pycurl==[7.43.0.5](https://7.43.0.5) in my requirements.txt. I also have "yum:libcurl-devel: \[\]" in my config file. I have tried for many hours and still can't figure out how to fix it. Did anyone successfully configure SQS and Celery on EB Linux2 Python 3.7?

******************************celery-worker.log*************************

[2020-08-16 15:35:00,828: INFO/MainProcess] Connected to sqs://xxxxxxxxxxxxxxxx:**@localhost//
[2020-08-16 15:35:00,908: INFO/MainProcess] celery@ip-xxx-xx-xx-xx.us-west-2.compute.internal ready.
[2020-08-16 15:35:00,911: CRITICAL/MainProcess] Unrecoverable error: ImportError('The curl client requires the pycurl library.')
Traceback (most recent call last):
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/kombu/asynchronous/http/__init__.py", line 20, in get_client
return hub._current_http_client
AttributeError: 'Hub' object has no attribute '_current_http_client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/celery/worker/worker.py", line 208,

/r/django
https://redd.it/ib2bqo
Matplotlib Scatterplots, but with Emojis as Markers

I wrote a function to create scatterplots using emojis as markers to support some analysis & visualization I'm doing for a (very silly) side project. After a good bit of research (I was pretty shocked this didn't exist already), I built this based on [this article](https://towardsdatascience.com/how-i-got-matplotlib-to-plot-apple-color-emojis-c983767b39e0), but adapted to produce a scatterplot instead of a bar chart.

#function to create a scatterplot with emojis as markers
#based on https://towardsdatascience.com/how-i-got-matplotlib-to-plot-apple-color-emojis-c983767b39e0
#follow instructions above to install & build mplcairo

#Set the backend to use mplcairo
import matplotlib, mplcairo
print('Default backend: ' + matplotlib.get_backend())
matplotlib.use("module://mplcairo.macosx")
print('Backend is now ' + matplotlib.get_backend())

# IMPORTANT: Import these libraries only AFTER setting the backend
import matplotlib.pyplot as plt, numpy as np
from matplotlib.font_manager import FontProperties

# Load Apple Color Emoji font
prop = FontProperties(fname='/System/Library/Fonts/Apple Color Emoji.ttc')

# Load Apple Color Emoji font
prop =

/r/Python
https://redd.it/iazdqd
Share your experience and journey of becoming python/django developer.

So, I am new in python and djang and I am so confused where and how to learn django.
Reading your experience and journey would give me a roadmap.
If you are beginner or learning, feel free to dm me. Maybe we can help each other in learning.

/r/djangolearning
https://redd.it/ib7eoc
[D] Simple Questions Thread August 16, 2020

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/ib0et8
Hello r/flask check out this cool book recommendation system using Flask

Arkvl is a web-app we that gives you personalized recommendations based on books that you like!

Check out https://arkvl.space

It was made using Flask backend

Here's a glimpse into the app - https://imgur.com/a/DEF49Gq

/r/flask
https://redd.it/ibbnvj
Passing variable from form into url

I have a flask app which provides certain information based on a public key. It also allows editing of the information for those with the matching private key.

@main.route('/thing/<unique_key>/')
@main.route('/thing/<unique_key>/secret/<secret_key>')
def view_thing(unique_key, secret_key = None):
if secret_key == None:
# render public information page through jinja

if secret_key == the_right_secret_key_I_pull_from_the_database:
# render private information page allowing editing through jinja

These routes all work fine and as expected.

I would like to include a form on the public information page which allows users with a private key to enter it and redirect to the private page (eg "Are you the owner of this information? Enter your private key and click submit to edit")

I know how I can pass the contents of a form to a flask POST method, but I don't want to do that here. How do I get it to instead take the input of the text box and redirect to the

/r/flask
https://redd.it/ibb9kd
I play Super Mario with my Face

I just wanna know how openCV works on python and decided to make a simple project out of it. I play Super Mario with my face. Please check them out here:


[I play Super Mario with my Face (YouTube link)](https://www.youtube.com/watch?v=mHC6GhL4hNs)

&#x200B;

Please let me know what you think about the video and what can I improve with it for my next project. Thank you so much!

/r/Python
https://redd.it/ibcma1
[Beginner] Request for Django workflow suggestions

Hi all,

I'm currently learning Django and programming in general. I've managed to build a website, deploy it to a linux server, and use GCP for my static files. However, I'm not satisfied with my workflow.

I pushed to PROD using scp via the CLI. Then I continued to develop directly in PROD. This feels like a very bad way to continue.

How do development and deployment using GIT work in the context of webdev and Django? Develop locally, push to GIT and clone after logging on the server via ssh? Or do people use Docker to deploy to linux servers?

I would appreciate your advice and tips on how I can learn best-practices from the start. Thanks.

/r/django
https://redd.it/ibk317
I'm giving back - here's a free book on Python - keep learning during the pandemic!

I started writing "[Slither into Python](https://www.slitherintopython.com/)" a little over a year ago and I have recently completed it. I decided to release it online for free as a thank you to the programming community, in particular the Python community. I know a lot of you out there are learning Python at the moment and I hope this resource can serve you well.

If you have any questions, or feedback for me, then please let me know, my email is on the site!

I know this is a difficult time for many of us but we can use it to our advantage! Many of us have a lot more free time now then we ever had before, so use this time to continue learning and really ramp up your skills!

Check it out here: [www.slitherintopython.com](https://www.slitherintopython.com/)

/r/Python
https://redd.it/ibhr94
Tuesday megathread: Advanced questions

Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.

**If your question is a beginner question we hold a beginner megathread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.**

/r/Python
https://redd.it/ibq33c
Providing comments on code is a pain, so I built codecomments.dev

In here and r/learnpython there are frequently requests to look at others' projects and provide any comments.

It's actually kind of a pain to provide these comments. You can try to write comments back directly in reddit (eg your loop on line 27 sucks) or if you \*really\* care enough then you can clone the repo and edit it and then do a pull request back. But that's a lot of work.

There's obviously a ton of enterprise grade options for doing CI/CD and code reviews, etc - but they're a bit above my paygrade.

So I built [https://codecomments.dev/](https://codecomments.dev/) (in python, obv). Free, obv.

Paste in the url of a script on github and it will load it, display it with pretty code formatting and allow you to add comments on individual lines. The input accepts markdown so you can even include code or links in your comment. I built this for python but it displays proper formatting for most languages.

You can then share it back to the community or the person who asked for the review with a simple URL with a human-readable name. Have a look at [https://codecomments.dev/view\_script/uncovered-ammonite/](https://codecomments.dev/view_script/uncovered-ammonite/) as an example.

/r/Python
https://redd.it/ibcwak
[D] Machine Learning - WAYR (What Are You Reading) - Week 93

This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're researching, by all means elaborate and give us your insight, otherwise it could just be an interesting paper you've read.

Please try to provide some insight from your understanding and please don't post things which are present in wiki.

Preferably you should link the arxiv page (not the PDF, you can easily access the PDF from the summary page but not the other way around) or any other pertinent links.

Previous weeks :

|1-10|11-20|21-30|31-40|41-50|51-60|61-70|71-80|81-90|91-100|
|----|-----|-----|-----|-----|-----|-----|-----|-----|------|
|[Week 1](https://www.reddit.com/4qyjiq)|[Week 11](https://www.reddit.com/57xw56)|[Week 21](https://www.reddit.com/60ildf)|[Week 31](https://www.reddit.com/6s0k1u)|[Week 41](https://www.reddit.com/7tn2ax)|[Week 51](https://reddit.com/9s9el5)|[Week 61](https://reddit.com/bfsx4z)|[Week 71](https://reddit.com/d7vno3)|[Week 81](https://reddit.com/f1f0iq)|[Week 91](https://reddit.com/hlt38o)||||||||
|[Week 2](https://www.reddit.com/4s2xqm)|[Week 12](https://www.reddit.com/5acb1t)|[Week 22](https://www.reddit.com/64jwde)|[Week 32](https://www.reddit.com/72ab5y)|[Week 42](https://www.reddit.com/7wvjfk)|[Week 52](https://reddit.com/a4opot)|[Week 62](https://reddit.com/bl29ov)|[Week 72](https://reddit.com/de8h48)|[Week 82](https://reddit.com/f8fs6z)|[Week 92](https://reddit.com/hu6zq9)||
|[Week 3](https://www.reddit.com/4t7mqm)|[Week 13](https://www.reddit.com/5cwfb6)|[Week 23](https://www.reddit.com/674331)|[Week 33](https://www.reddit.com/75405d)|[Week 43](https://www.reddit.com/807ex4)|[Week 53](https://reddit.com/a8yaro)|[Week 63](https://reddit.com/bqlb3v)|[Week 73](https://reddit.com/dkox1s)|[Week 83](https://reddit.com/ffi41b)||
|[Week 4](https://www.reddit.com/4ub2kw)|[Week 14](https://www.reddit.com/5fc5mh)|[Week 24](https://www.reddit.com/68hhhb)|[Week 34](https://www.reddit.com/782js9)|[Week 44](https://reddit.com/8aluhs)|[Week 54](https://reddit.com/ad9ssz)|[Week 64](https://reddit.com/bw1jm7)|[Week 74](https://reddit.com/dr6nca)|[Week 84](https://reddit.com/fn62r1)||
|[Week 5](https://www.reddit.com/4xomf7)|[Week 15](https://www.reddit.com/5hy4ur)|[Week 25](https://www.reddit.com/69teiz)|[Week 35](https://www.reddit.com/7b0av0)|[Week 45](https://reddit.com/8tnnez)|[Week 55](https://reddit.com/ai29gi)|[Week 65](https://reddit.com/c7itkk)|[Week 75](https://reddit.com/dxshkg)|[Week 85](https://reddit.com/fvk7j6)||
|[Week 6](https://www.reddit.com/4zcyvk)|[Week 16](https://www.reddit.com/5kd6vd)|[Week 26](https://www.reddit.com/6d7nb1)|[Week 36](https://www.reddit.com/7e3fx6)|[Week 46](https://reddit.com/8x48oj)|[Week 56](https://reddit.com/ap8ctk)|[Week 66](https://reddit.com/cd7gko)|[Week 76](https://reddit.com/e4nmyk)|[Week 86](https://reddit.com/g4eavg)||
|[Week 7](https://www.reddit.com/52t6mo)|[Week 17](https://www.reddit.com/5ob7dx)|[Week 27](https://www.reddit.com/6gngwc)|[Week 37](https://www.reddit.com/7hcc2c)|[Week 47](https://reddit.com/910jmh)|[Week 57](https://reddit.com/auci7c)|[Week 67](https://reddit.com/cj0kyc)|[Week 77](https://reddit.com/eb4lxk)|[Week 87](https://reddit.com/gcx3uf)||
|[Week 8](https://www.reddit.com/53heol)|[Week 18](https://www.reddit.com/5r14yd)|[Week 28](https://www.reddit.com/6jgdva)|[Week 38](https://www.reddit.com/7kgcqr)|[Week 48](https://reddit.com/94up0g)|[Week 58](https://reddit.com/azjoht)|[Week 68](https://reddit.com/cp1jex)|[Week 78](https://reddit.com/ehbfst)|[Week 88](https://reddit.com/glm6sv)||
|[Week 9](https://www.reddit.com/54kvsu)|[Week 19](https://www.reddit.com/5tt9cz)|[Week 29](https://www.reddit.com/6m9l1v)|[Week 39](https://www.reddit.com/7nayri)|[Week 49](https://reddit.com/98n2rt)|[Week 59](https://reddit.com/b50r5y)|[Week 69](https://reddit.com/cvde5a)|[Week 79](https://reddit.com/entcxy)|[Week 89](https://reddit.com/gu5t0d)||
|[Week 10](https://www.reddit.com/56s2oa)|[Week 20](https://www.reddit.com/5wh2wb)|[Week