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
Open .ipynb files directly with terminal automatically (OS X)

Hey guys,

This post is for jupyter users in OSX. Sorry for Linux/Windows users.

I have been using Jupyter Notebooks for a while and I thought that opening the terminal, typing "jupyter notebook path_to_file.ipynb" was a pain, so I created an Apple script with automator that does this directly.

Do you think it's useful?
Are there any alternatives to do this more easily?

Here is the [link](https://github.com/alexisgaziello/JupyterNotebookTerminalOpen) to the repo.

Please feel free to install it and let me know if it's useful/useless.

Cheers

/r/JupyterNotebooks
https://redd.it/iu3cnj
Flask app requires restart to display new database records on the page

I'm a bit new to flask and have run into an issue that I haven't been able to remedy.I've got a form in one my templates that allows the user to enter a URL and an accompanying label. Submitting this adds a record to my database for the new link. I have a for loop in my template that loops through the records in the database and displays them on the page. Everything is working correctly, but when I submit the link it does not display on my page even after reloading the page. Instead, I have to close my flask app an re-run it in order to see the newly added links on my page. The same goes for editing or deleting these links, which I also have actions for.

In summary, database changes are not seen on my page until I reload my flask app.

If my sql app/templates/static files are needed in order to help let me know. Thanks!

App code -

***https://www.ppaste.org/JOTQf88vj***

/r/flask
https://redd.it/iuv3zx
Paint with Machine Learning: a Semantic Image Synthesis Demo

[Paint with Machine Learning](http://paintwith.spell.ml/) is a semantic image synthesis (or image-to-image translation) demo application I built as a consulting project. Hand-drawn semantic segmentation maps go in, [GauGAN](https://arxiv.org/abs/1903.07291) generated images ([NVLab/SPADE](https://github.com/NVlabs/SPADE)) come out.

I trained the model on [ADE20K](https://www.kaggle.com/residentmario/ade20k-outdoors) and fine-tuned it on [a dataset of Bob Ross paintings I hand-labelled](https://www.kaggle.com/residentmario/segmented-bob-ross-images). The model generates [some nice-looking results](https://i.imgur.com/wGwNAh6.png), considering I had just 250 paintings to work with, albeit at a very low resolution, just 256 by 256 pixels.

The application and model code is in [a public GH repo](https://github.com/spellml/paint-with-ml).

/r/Python
https://redd.it/iumcxq
App with 2 ports. One port needs to be private, how to accomplish?

An application has a costumer side which is publicly available, in development is running on port 5000. Now we want an admin panel that is online but not accessible to the general public only admin staff as with this panel you can modify directly the database and make big changes. It's running on port 5001

Im exploring 3 possibilities.

\+ One involves making a username and password plus using MFA like the guy in this [video](https://www.youtube.com/watch?v=kMTXL5FUHGM&ab_channel=MiguelGrinberg). to access the admin panel.

\+ The second is adding admins via invitation, which is somewhat similar like the above and my question is how to add the first admin user to send invitations. (same question applies to the first option).

\+ The third one someone at work mention SSH tunnelling, Im yet to look into this one deeply but wonder if anyone here has any opinion about it and it's ease of implementation.

If anyone has any tips or better potential solutions I'd love to hear about it.

(Bonus question) The admin panel is running in port5001 so we have [app.py](https://app.py) and [app2.py](https://app2.py) in one project. But in order to run it in parallel I used threading and that disabled

/r/flask
https://redd.it/iv0pl2
Is there a program to help you document Python functions?

I just finished a Python project and now want to go back and document each function while it is still fresh in my head. Is there a program that will scan your code for functions that don't have a doc-string and then interactively ask you to:

* describe the function
* document each parameter
* document the return value

It would then create a doc-string for you that you could simply copy/paste into your code.

Thanks.

/r/Python
https://redd.it/iuoxt0
Django, Django + ajax, Django +r react, which is best for creating like and unlike or follow or unfollow button functionality?

I m learning Django and try to create a web app with like unlike button and follow unfollow button functionality. when I search about this function many options came. some tutorials did it with Django some did it with django+ajax and some did it with django+react. if it's done only with Django then why ajax and react is important. right now I don't want to learn ajax or react that's why I m asking this question. is it ok to create those functions with just Django n python? is it possible?

/r/django
https://redd.it/iv2kla
GitHub Codespaces with Django.

Hi this is my first try at making a YouTube video. I was really nervous and reluctant to make one.

But I anyhow needed up making this one about GitHub Codespaces.

Please watch the video and give me feedback! I know (I have a very bad microphone.😅)

https://youtu.be/O9NASwWInQY

/r/djangolearning
https://redd.it/iuzrf2
Access PC notebook from mobile

I have a Jupyter notebook running on my PC. Is it possible to access the notebook from a mobile browser? Both the PC and the mobile device are in the same WiFi network.

/r/IPython
https://redd.it/iuzo1c
JoCrypt. Easy low level encryption framework.

So i made this project for school purposes, but i built on it in my free time, added sql compatibilty and all.
I aimed to make a complete basic algorithmic encryption tool, but ended up adding hashes and steganography.

https://github.com/JodisKripe/JoCrypt

This is the github link...
Also i made a repl so you can try it out. Some features are limited tho..

www.jocrypt.sidjo.repl.run

It has websocket issues sometimes but should run okay.

Please let me know about any suggestions.

Cheers,
JodisKripe.

/r/Python
https://redd.it/iv2u64
Saturday megathread: 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/ivhocx
I made my large flask project open source! CryptoCurrency based community with wallets.

This has been a nonstop project during covid. It was on gitea but moved it to github. Its made with Python flask/ flasksqlalchemy / postgres. I decided to work on the project with my wife after she got a reddit gold and realized it was worth nothing and complained it should be a bitcoin or crypto something. Then we found out it probably benefits tencent (China) the most. So work began to bring the coin back to the people.

#Github
https://github.com/tipvote

#url
www.tipvote.com

#contribute or advice
Looking for people who want to contribute or help out. Also offering advice if you need help with a crypto based service.

/r/flask
https://redd.it/iv9xcq
How to deploy Django project that has a function that could take an hour to run?

Context: I am pulling data from an api via a function in my views.py file. The API i’m pulling data from has rate limits that could mean this function and ultimately, the template to be displayed would take an hour and all the while the user would just see a blank page while the function competes.

Two questions;

1) Is there a best practice for implementing large/time-intensive python functions in django apps? E.g submit a request, have some backend process run the function in the background then immediately return a “process running” confirmation?

2) Is there a way to return status updates a django template while the function is running so the user can get feedback on it’s status? (e.g 10% complete...)?

/r/django
https://redd.it/ivjeh3
storing passwords

how long is the expected output for a password that was salted and hashed using pbkdf2 and sha256? also, is using pbkdf2 and sha256 enough? or should I be using something else? what is the industry standard for salting and hashing?

/r/django
https://redd.it/ivo085