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
In ipyparallel, how does one reset the namespace of the engines without restarting them?

If I'm not mistaken, each engine in ipyparallel has its own persistent namespace. As a result, if I import some module **M** in **engine\_i**, kill the main process (client code), and finally modify **M,** simply restarting the main process (client code) will not be sufficient for the changes in **M** to be reloaded in **engine\_i**.

The most reliable way to solve that problem so far has been to kill/reset all engines, but it is really tedious as I have to make a lot of frequent modifications to modules that are imported to engines.

I've tried reloading/deep\_reloading modules in engines, using the magics %reset etc, but to no avail. Is there a trivial way to reset engine namespaces? I can't believe that all developpers working with ipyparallel constantly kill/restart clusters.

Thanks for your help.

PS: if farming reputation on stackoverflow is your thing, I've made a more detailed post [here](https://stackoverflow.com/questions/63968732/ipyparallel-what-is-the-most-reliable-way-to-clear-reset-engine-namespaces-with).

/r/IPython
https://redd.it/iwaqrz
Python decorators

Hi, decorator are useful and quite simple to use, at the beginning they may seem a little complex, but once you get the way they work they can save you tons of time keeping the code in order, making it more readable, mantainable and flexible. Have a look at the code into this repo [GH repository](https://github.com/formazione/python_cheatsheet) and take a look at the video in this post [https://youtu.be/C62Nu4yFFsM](https://youtu.be/C62Nu4yFFsM)

​

https://preview.redd.it/nxgaiwg839o51.png?width=800&format=png&auto=webp&s=3775c3192774f3598a3443a5c8e6ca136ba723c5

/r/Python
https://redd.it/iw8ytp
Why have I not been using f-strings...

I have been using format() for a few years now and just realized how amazing f strings are.

/r/Python
https://redd.it/iwdzzx
Need to make a web app that shares info (through dashboards) and handles basic automation, but should be incredibly secure - is Flask the right tool for the job.

I figured I would make a Flask portal where clients could log in and access visualizations (tool I will use is Dash) of various sorts we need them to see.

Depending on the person logged in, this flask app would also allow some degree of automation to be done - I.e. the user just clicks stuff on the site and some code runs on the backend and executes the necessary results.

Given that I've always been itching to get into web development, the first thing that came to mind was Flask. But I'm not sure about the security aspect of things.

1. I will be hosting the flask app on an EC2 instance and fetching data from our prod DB essentially via an SQL connection - is this something that is generally completely safe, given the environment variables will probably be access keys to our DB
2. Is it possible to implement industry standard MFA mechanisms into the login process, say through OTPs or Google Authenticator
3. Some of the automation I have in mind will involve interfacing with AWS APIs, which again means the environment variables will need to be access and secret keys. Is this generally safe?

/r/flask
https://redd.it/iwbkpz
Monday megathread: Project ideas!

Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code!

/r/Python
https://redd.it/iwpexy
This media is not supported in your browser
VIEW IN TELEGRAM
[R] Photorealistic Rendering and 3D Scene Reconstruction - Double free zoom lecture by the author of both papers

/r/MachineLearning
https://redd.it/iwl0b9
Original Zen of Python

/r/Python
https://redd.it/iwoml8
How to handle forever-incremental Models and setup Meta-Models?

Been trying to properly get started with Django on-off, but there are just some things I cannot work out. Been using Flask for smaller projects now with SQLAlchemy & Celery because it's way more straight forward. But now that I want to start building something bigger and focus on it, I wanted to get some – probably basic – questions out of the way.

Let's assume we're a bank. And we're making a model for `client`, `account` and `transactions`.

1. Because we're a bank, we do not want to rely on simply updating an `account balance` value, but evaluate the account's balance by evaluating every transaction that was ever made on said account to see how much the current value is. **Q:** after a while this gets quite big and takes long to compute; how do you *squash* to say "hey, this is the current value – calculated on Sept 1st – you only have to re-evaluate new transactions for said account starting Sept 1? Like how do we handle that on a database/model level and how do we run the task?

2. We have multiple `account` types a `client` can have, with various conditions (like monthly cost, max

/r/django
https://redd.it/iwhbv7
Help

Hello Everyone,

I need help with my Django project, which is about rating the professors of my college. Part I'm Struck with is, I want to give an option for the user to give an anonymous rating if they wish to.

/r/django
https://redd.it/iwu2zb
IPython in VSCode? Help please

I'm new to programming and VSCode, so please forgive my ignorance or lack of understanding!

I am following a Computer Science college course which might be a tad out-dated. Anyways, in the course it is recommended that the students use VSCode as their text editor and the Anaconda distribution of Python. I am using the regular version of Python, not the Anaconda distribution.

Since IPython is not installed by default, I went to the VSCode marketplace and downloaded the extension "IPython for VSCode". However, IPython still appears not to work (I am trying to use the IPython REPL in the terminal).

Does anyone know how to use IPython in VSCode? I don't even know if this is still a thing.... I'm confused re: the relationship between IPython and Jupyter. But what I'm trying to do is to use the IPython REPL in the VSCode terminal, so that I can follow along with my college course.

​

Thanks for your help!

/r/IPython
https://redd.it/iwpkvx
[R] 'Less Than One'-Shot Learning

[https://arxiv.org/abs/2009.08449](https://arxiv.org/abs/2009.08449)

>Deep neural networks require large training sets but suffer from high computational cost and long training times. Training on much smaller training sets while maintaining nearly the same accuracy would be very beneficial. In the few-shot learning setting, a model must learn a new class given only a small number of samples from that class. One-shot learning is an extreme form of few-shot learning where the model must learn a new class from a single example. We propose the \`less than one'-shot learning task where models must learn N new classes given only M<N examples and we show that this is achievable with the help of soft labels. We use a soft-label generalization of the k-Nearest Neighbors classifier to explore the intricate decision landscapes that can be created in the \`less than one'-shot learning setting. We analyze these decision landscapes to derive theoretical lower bounds for separating N classes using M<N soft-label samples and investigate the robustness of the resulting systems.

Update:

Code - [https://github.com/ilia10000/SLkNN](https://github.com/ilia10000/SLkNN)

Binder demo - [https://mybinder.org/v2/gh/ilia10000/SLkNN/master?filepath=%2Fsoft-knn%2Fsoft\_knn\_vis.ipynb](https://mybinder.org/v2/gh/ilia10000/SLkNN/master?filepath=%2Fsoft-knn%2Fsoft_knn_vis.ipynb)

&#x200B;

/r/MachineLearning
https://redd.it/iwex8z
Fully Featured Live Chat Social Media Web App Made With Django Channels

Unfortunately it’s not open sourced as of now, but I’m happy to answer any questions you might have!


#Website:


[theHang](https://thehang.io/)


#Videos:


[Browse and open rooms](https://youtu.be/19onK9H3mbg)


[Participate in conversations](https://youtu.be/mvcCvGjPtt0)


[Form relationships](https://youtu.be/EE953qGYNZc)


[theHang on mobile](https://youtu.be/RPmz4YtqfcQ)

/r/django
https://redd.it/ix37ex
created some customized tkinter widgets with a 3d looking

/r/Python
https://redd.it/iwzbzs
Django multiple forms as popups and AJAX!!!

In my project I have a page where all the multiple user types are listed as cards and I was trying to add a detail view to each card with update and delete options within the card detail display. So this basically calls for AJAX calls. But I can't seem to figure out how to nest views within templates and style each forms according to my needs. Any advice?

/r/django
https://redd.it/ix243a
Needed python packages and versions of jupyter notebook

I want to retrieve all the pip packages and versions what is needed in a specific jupyter notebook so I know what packages are required to execute the notebook without errors.

Is there such a library or one liner to achieve this.

The problem with "pip freeze" is that it will show all installed packages what is more than needed for a minimalistic environment.

/r/JupyterNotebooks
https://redd.it/ix1cdc
Just made a learning Python Diagram that I made my background to learn terms easier. Let me know what you think.

/r/Python
https://redd.it/iwtgvj
CSS Static files in Django

Why do I need to keep changing the name of my css file to load it's features?
What triggers the issue?
And is there another way around it?

What am I missing here

/r/djangolearning
https://redd.it/ix6ydc