Saturday Daily Thread: Resource Request and Sharing! Daily Thread
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/y4981u
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/y4981u
reddit
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
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...
I wrote a tool for running tests 100x - 1000x slower
While looking at my test coverage reports, I noticed that they only measure which lines were executed while running the test suite, but don't prove if they were in fact *tested* in any meaningful way.
So I wrote a crude tool which takes a source file, and for every line in the file, temporarily removes the line and runs the test suite. In the end you get a report showing which lines can be removed and the tests would still pass. Here's the tool:
import subprocess
path = "hc/api/models.py" # the file we're analyzing
test_cmd = "python manage.py test --keepdb --parallel=8 -v 0 --failfast"
original = open(path, "r").read()
report = open("report-%s.txt" % path.replace("/", "."), "w")
lines = original.split("\n")
for idx in range(0, len(lines)):
print("Processing %d / %d" % (idx, len(lines)))
# Optimization: skip empty lines and comments
if not lines[idx].strip() or lines[idx].strip().startswith("#"):
report.write(" %s\n" % lines[idx])
/r/Python
https://redd.it/y3w4ss
While looking at my test coverage reports, I noticed that they only measure which lines were executed while running the test suite, but don't prove if they were in fact *tested* in any meaningful way.
So I wrote a crude tool which takes a source file, and for every line in the file, temporarily removes the line and runs the test suite. In the end you get a report showing which lines can be removed and the tests would still pass. Here's the tool:
import subprocess
path = "hc/api/models.py" # the file we're analyzing
test_cmd = "python manage.py test --keepdb --parallel=8 -v 0 --failfast"
original = open(path, "r").read()
report = open("report-%s.txt" % path.replace("/", "."), "w")
lines = original.split("\n")
for idx in range(0, len(lines)):
print("Processing %d / %d" % (idx, len(lines)))
# Optimization: skip empty lines and comments
if not lines[idx].strip() or lines[idx].strip().startswith("#"):
report.write(" %s\n" % lines[idx])
/r/Python
https://redd.it/y3w4ss
reddit
I wrote a tool for running tests 100x - 1000x slower
While looking at my test coverage reports, I noticed that they only measure which lines were executed while running the test suite, but don't...
This media is not supported in your browser
VIEW IN TELEGRAM
[R] MotionDiffuse: Text-Driven Human Motion Generation with Diffusion Model + Gradio Demo
https://redd.it/y4eehd
@pythondaily
https://redd.it/y4eehd
@pythondaily
Installing anaconda on a new MacBook Pro M2 chip
https://youtu.be/YoEs6DU_Vtk
/r/JupyterNotebooks
https://redd.it/vsg3sd
https://youtu.be/YoEs6DU_Vtk
/r/JupyterNotebooks
https://redd.it/vsg3sd
YouTube
Installing Anaconda on a Mac M2 & Windows
This is our initial video in our series of #datascience with #python /R #tutorials coming up next.
We will be daily uploading videos and content related to AI/ML, #data #analytics, #cloud Computing.
Watch this space for more such tutorials and don't to…
We will be daily uploading videos and content related to AI/ML, #data #analytics, #cloud Computing.
Watch this space for more such tutorials and don't to…
[P] A Proof-of-Concept of an AI Assistant Designer using UnrealEngine's Metahuman, stable diffusion, OpenAI's Whisper and GPT3
https://twitter.com/imcharleslo/status/1580591523447844865
/r/MachineLearning
https://redd.it/y4pzsv
https://twitter.com/imcharleslo/status/1580591523447844865
/r/MachineLearning
https://redd.it/y4pzsv
flask sqlalchemcy models tips on direction and where to find documentation
Hi all, I have two primary questions. I am not new to programing as I have a background in CS but I am new to Python/Flask/Flask-squalchemy. Though I am EXTREMELY rusty as I've spent the past 6 years working on embedded systems.
That being said, my first is on documentation for flask and sqlalchemy. When I need to know the details about a class in Java, I can go right to the website and see what methods and fields said class have. But I can't seem to find that for flask-sqlalchemy. I'm not sure if I am looking in the wrong places but every time I google fu or search a relevant website I just get a tutorial or overarching explanation.
My second question will highlight why the first question is important to me. I am wondering if I am going in the right direction for my project and if I am not would appreciate someone pointing me in the right direction. I started off following a tutorial to build a basic "notes" website. It's mostly python with a little html and JS for front end stuff.
/r/flask
https://redd.it/y4rnw8
Hi all, I have two primary questions. I am not new to programing as I have a background in CS but I am new to Python/Flask/Flask-squalchemy. Though I am EXTREMELY rusty as I've spent the past 6 years working on embedded systems.
That being said, my first is on documentation for flask and sqlalchemy. When I need to know the details about a class in Java, I can go right to the website and see what methods and fields said class have. But I can't seem to find that for flask-sqlalchemy. I'm not sure if I am looking in the wrong places but every time I google fu or search a relevant website I just get a tutorial or overarching explanation.
My second question will highlight why the first question is important to me. I am wondering if I am going in the right direction for my project and if I am not would appreciate someone pointing me in the right direction. I started off following a tutorial to build a basic "notes" website. It's mostly python with a little html and JS for front end stuff.
/r/flask
https://redd.it/y4rnw8
reddit
flask sqlalchemcy models tips on direction and where to find...
Hi all, I have two primary questions. I am not new to programing as I have a background in CS but I am new to Python/Flask/Flask-squalchemy....
nbsnapshot - Benchmarking cell's outputs for automated testing
​
nbsnapshot
Hi all!
I want to share a project I've been working on to facilitate Jupyter notebook testing!
When analyzing data in a Jupyter notebook, I unconsciously memorize "rules of thumb" to determine if my results are correct. For example, I might print some summary statistics and become skeptical of some outputs if they deviate too much from what I've seen historically. For more complex analysis, I often create diagnostic plots (e.g., a histogram) and check them whenever new data arrives.
Since I constantly repeat the same process, I figured I'd code a small library to streamline this process. nbsnapshot benchmarks cell's outputs with historical results and raises an error if the output deviates from an expected range (by default, 3 standard deviations from the mean). You can see an example in the image accompanying this post.
I'd love to hear what you think!
/r/JupyterNotebooks
https://redd.it/vreja5
​
nbsnapshot
Hi all!
I want to share a project I've been working on to facilitate Jupyter notebook testing!
When analyzing data in a Jupyter notebook, I unconsciously memorize "rules of thumb" to determine if my results are correct. For example, I might print some summary statistics and become skeptical of some outputs if they deviate too much from what I've seen historically. For more complex analysis, I often create diagnostic plots (e.g., a histogram) and check them whenever new data arrives.
Since I constantly repeat the same process, I figured I'd code a small library to streamline this process. nbsnapshot benchmarks cell's outputs with historical results and raises an error if the output deviates from an expected range (by default, 3 standard deviations from the mean). You can see an example in the image accompanying this post.
I'd love to hear what you think!
/r/JupyterNotebooks
https://redd.it/vreja5
Jupyter Notebook: Reproducibility Issue (IT students/workers)
Hey guys!
Are you doing something related to IT (work or study) and have you ever used Jupyter Notebooks before? If so, I need your help!
For my thesis, I am trying to solve a sharing/reproducibility problem found in computational notebooks such as Jupyter.
Computational notebooks are limited from the perspective of exploratory programming, since the sequential order of execution is not taken into account when saving and sharing notebooks.
I’ve designed a reproducibility feature that helps data scientists reproduce their exploratory programming efforts. I made a prototype that simulates a Jupyter Notebook environment and a usability test to evaluate it.
This test is unmoderated and you can do it easily at home on your PC.
You would help me out immensely since I need as many responses as possible :)
Duration: 10 minutes
Link: https://t.maze.co/1078084
/r/JupyterNotebooks
https://redd.it/vr81mt
Hey guys!
Are you doing something related to IT (work or study) and have you ever used Jupyter Notebooks before? If so, I need your help!
For my thesis, I am trying to solve a sharing/reproducibility problem found in computational notebooks such as Jupyter.
Computational notebooks are limited from the perspective of exploratory programming, since the sequential order of execution is not taken into account when saving and sharing notebooks.
I’ve designed a reproducibility feature that helps data scientists reproduce their exploratory programming efforts. I made a prototype that simulates a Jupyter Notebook environment and a usability test to evaluate it.
This test is unmoderated and you can do it easily at home on your PC.
You would help me out immensely since I need as many responses as possible :)
Duration: 10 minutes
Link: https://t.maze.co/1078084
/r/JupyterNotebooks
https://redd.it/vr81mt
t.maze.co
Maze | User Research & Testing Platform
Get user insights fast, early, and often so you can make data-informed product and design decisions.
How do you update Anaconda3?
I'm a pure idiot so can somebody tell me in exact baby steps how to update anaconda3 to the latest version?
Apparently it's a requirement for Infusion to be updated.
/r/IPython
https://redd.it/y50wgu
I'm a pure idiot so can somebody tell me in exact baby steps how to update anaconda3 to the latest version?
Apparently it's a requirement for Infusion to be updated.
/r/IPython
https://redd.it/y50wgu
reddit
How do you update Anaconda3?
I'm a pure idiot so can somebody tell me in exact baby steps how to update anaconda3 to the latest version? Apparently it's a requirement for...
Dynamic behavior with multiple tenants
Hello,
I'm working on a project that, once complete, will allow organizations (which have multiple users, some of which may overlap with other tenants) to interact with a third-party API. The bulk of how the users for each tenant interact with the API will be the same between all tenants; however, each tenant may also need some customization that allows its users to interact with the API in ways that are specific to that organization's needs.
I'm not sure how to go about implementing behavior like this. Is there a Django-approved way of doing it correctly? I'm thinking I'd like to identify each tenant via a subdomain, but how I can then use that to point toward specialized behavior for the users within said tenant is where I get stuck. I believe I have everything figured out besides this.
Any feedback is appreciated. I'm still quite new to Django development, so I apologize if this is a simple question.
Here is a diagram showing what I'm trying to explain: https://puu.sh/Jp77s/1f4167f73a.png
/r/django
https://redd.it/y514ey
Hello,
I'm working on a project that, once complete, will allow organizations (which have multiple users, some of which may overlap with other tenants) to interact with a third-party API. The bulk of how the users for each tenant interact with the API will be the same between all tenants; however, each tenant may also need some customization that allows its users to interact with the API in ways that are specific to that organization's needs.
I'm not sure how to go about implementing behavior like this. Is there a Django-approved way of doing it correctly? I'm thinking I'd like to identify each tenant via a subdomain, but how I can then use that to point toward specialized behavior for the users within said tenant is where I get stuck. I believe I have everything figured out besides this.
Any feedback is appreciated. I'm still quite new to Django development, so I apologize if this is a simple question.
Here is a diagram showing what I'm trying to explain: https://puu.sh/Jp77s/1f4167f73a.png
/r/django
https://redd.it/y514ey
Does there exist an example of a slider that trims a video?
I'm trying to find existing code that has an example of a modern slider GUI where you can move the slider from both the head and tail as if you're trimming a video?
​
Can't find an example of one using Django.
/r/djangolearning
https://redd.it/y50vli
I'm trying to find existing code that has an example of a modern slider GUI where you can move the slider from both the head and tail as if you're trimming a video?
​
Can't find an example of one using Django.
/r/djangolearning
https://redd.it/y50vli
reddit
Does there exist an example of a slider that trims a video?
I'm trying to find existing code that has an example of a modern slider GUI where you can move the slider from both the head and tail as if you're...
Output red in iPython
For some reason the standard color for Out in iPython appears to be red:
In 3: f()
Out3: True
In 4: 3
Out4: 3
Both “Outs” are red.
It makes it look like an error.
Is this just a design choice or is there something wrong I don’t know about?
Thank you
/r/JupyterNotebooks
https://redd.it/y5a7ni
For some reason the standard color for Out in iPython appears to be red:
In 3: f()
Out3: True
In 4: 3
Out4: 3
Both “Outs” are red.
It makes it look like an error.
Is this just a design choice or is there something wrong I don’t know about?
Thank you
/r/JupyterNotebooks
https://redd.it/y5a7ni
reddit
Output red in iPython
For some reason the standard color for Out[] in iPython appears to be red: In [3]: f() Out[3]: True In [4]: 3 Out[4]: 3 Both “Outs” are...
Django admin theme made with react and material-ui
## About
i made this admin theme last year but i gave up on since it was a lot of work. i'll probably make a demo for it some other time.
##
## Links
github: https://github.com/demon-bixia/django-bolt
figma: https://www.figma.com/file/iDvC7g040k6XswfIaX5xzg/Bolt-admin?node-id=5%3A54
​
## Screenshots
​
login
home
/r/django
https://redd.it/y5a460
## About
i made this admin theme last year but i gave up on since it was a lot of work. i'll probably make a demo for it some other time.
##
## Links
github: https://github.com/demon-bixia/django-bolt
figma: https://www.figma.com/file/iDvC7g040k6XswfIaX5xzg/Bolt-admin?node-id=5%3A54
​
## Screenshots
​
login
home
/r/django
https://redd.it/y5a460
GitHub
GitHub - demon-bixia/django-bolt: A modern Django admin ui made with React and MUI.
A modern Django admin ui made with React and MUI. Contribute to demon-bixia/django-bolt development by creating an account on GitHub.
Integrate DRF with React js - what to use?
Hey everyone, I've started DRF project and want to use React js frontend. Since doing this for the first time, not sure which tools to use to integrate DRF with React js.
Any recommendations?
/r/django
https://redd.it/y5mrr3
Hey everyone, I've started DRF project and want to use React js frontend. Since doing this for the first time, not sure which tools to use to integrate DRF with React js.
Any recommendations?
/r/django
https://redd.it/y5mrr3
reddit
Integrate DRF with React js - what to use?
Hey everyone, I've started DRF project and want to use React js frontend. Since doing this for the first time, not sure which tools to use to...
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/y52fbw
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/y52fbw
reddit
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...
Code completion in nbterm?
Would it be possible to have IntelliSense-type code completion in nbterm? How so?
https://github.com/davidbrochart/nbterm
Thanks very much.
/r/JupyterNotebooks
https://redd.it/y5m3w5
Would it be possible to have IntelliSense-type code completion in nbterm? How so?
https://github.com/davidbrochart/nbterm
Thanks very much.
/r/JupyterNotebooks
https://redd.it/y5m3w5
GitHub
GitHub - davidbrochart/nbterm: Jupyter Notebooks in the terminal.
Jupyter Notebooks in the terminal. Contribute to davidbrochart/nbterm development by creating an account on GitHub.
Monday Daily Thread: 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! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/y5vw8a
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! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/y5vw8a
reddit
Monday Daily Thread: 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...
Unable to add web scraper
If anyone is able to help thatd be great. Im learning web scraping for a data analytics class and when importing this code:
from splinter import Browser
from bs4 import BeautifulSoup as soup
from webdriver_manager.chrome import ChromeDriverManager
executable_path = {'executable_path': ChromeDriverManager().install()}
browser = Browser('chrome', **executable_path, headless=False)
i get this error:
TypeError Traceback (most recent call last) \~\\AppData\\Local\\Temp\\ipykernel_35972\\2830222817.py in <module> 1 executable_path = {'executable_path': ChromeDriverManager().install()} ----> 2 browser = Browser('chrome', **executable_path, headless=False) \~\\anaconda3\\envs\\PythonData\\lib\\site-packages\\splinter\\browser.py in Browser(driver_name, retry_count, *args, **kwargs) 119 raise DriverNotFoundError("No driver for %s" % driver_name) 120 --> 121 return get_driver(driver, retry_count=retry_count, *args, **kwargs) \~\\anaconda3\\envs\\PythonData\\lib\\site-packages\\splinter\\browser.py in get_driver(driver, retry_count, *args, **kwargs) 90 for _ in range(retry_count): 91 try: ---> 92 return driver(*args, **kwargs) 93 except driver_exceptions as e: 94 err = e TypeError: 'NoneType' object is not
/r/JupyterNotebooks
https://redd.it/vq5loq
If anyone is able to help thatd be great. Im learning web scraping for a data analytics class and when importing this code:
from splinter import Browser
from bs4 import BeautifulSoup as soup
from webdriver_manager.chrome import ChromeDriverManager
executable_path = {'executable_path': ChromeDriverManager().install()}
browser = Browser('chrome', **executable_path, headless=False)
i get this error:
TypeError Traceback (most recent call last) \~\\AppData\\Local\\Temp\\ipykernel_35972\\2830222817.py in <module> 1 executable_path = {'executable_path': ChromeDriverManager().install()} ----> 2 browser = Browser('chrome', **executable_path, headless=False) \~\\anaconda3\\envs\\PythonData\\lib\\site-packages\\splinter\\browser.py in Browser(driver_name, retry_count, *args, **kwargs) 119 raise DriverNotFoundError("No driver for %s" % driver_name) 120 --> 121 return get_driver(driver, retry_count=retry_count, *args, **kwargs) \~\\anaconda3\\envs\\PythonData\\lib\\site-packages\\splinter\\browser.py in get_driver(driver, retry_count, *args, **kwargs) 90 for _ in range(retry_count): 91 try: ---> 92 return driver(*args, **kwargs) 93 except driver_exceptions as e: 94 err = e TypeError: 'NoneType' object is not
/r/JupyterNotebooks
https://redd.it/vq5loq
reddit
Unable to add web scraper
If anyone is able to help thatd be great. Im learning web scraping for a data analytics class and when importing this code: from splinter import...
Puff - Python GraphQL engine and WSGI Runtime - Use Django on Rust's Tokio
Hello,
I wanted to share with you my recent experiment for Django, Puff: https://github.com/hansonkd/puff
The idea for the project is that there are an incredible amount of Django resources and developers out there and that Django makes it so easy to get an app running that it should be used as the primary developer layer for managing DB tables, Admin, Auth, etc.
But understanding Python performance means understanding the GIL. For parts of your code that are performance critical, as much work should be handed off to Rust as possible to avoid locking the GIL If you are constructing a response with thousands of rows, it doesn't make sense to iterate through that in Python creating a python dictionary only to convert it to JSON. This holds the GIL in the least effective way.
Puff is designed to allow you to pass off Python Objects to Rust to take advantage of Rust's async runtime. For example, in Puff's GraphQL engine you can hand off pure SQL strings from Python to be executed entirely in Rust, transformed to JSON bytes, and sent as an HTTP response without locking the GIL again.
You can write your own Rust functions that use any Rust library. Even when you
/r/django
https://redd.it/y5to33
Hello,
I wanted to share with you my recent experiment for Django, Puff: https://github.com/hansonkd/puff
The idea for the project is that there are an incredible amount of Django resources and developers out there and that Django makes it so easy to get an app running that it should be used as the primary developer layer for managing DB tables, Admin, Auth, etc.
But understanding Python performance means understanding the GIL. For parts of your code that are performance critical, as much work should be handed off to Rust as possible to avoid locking the GIL If you are constructing a response with thousands of rows, it doesn't make sense to iterate through that in Python creating a python dictionary only to convert it to JSON. This holds the GIL in the least effective way.
Puff is designed to allow you to pass off Python Objects to Rust to take advantage of Rust's async runtime. For example, in Puff's GraphQL engine you can hand off pure SQL strings from Python to be executed entirely in Rust, transformed to JSON bytes, and sent as an HTTP response without locking the GIL again.
You can write your own Rust functions that use any Rust library. Even when you
/r/django
https://redd.it/y5to33
GitHub
GitHub - hansonkd/puff: ☁ Puff ☁ - The deep stack framework.
☁ Puff ☁ - The deep stack framework. Contribute to hansonkd/puff development by creating an account on GitHub.
jupyter_nbextensions_configurator - error messages in JupyterLab startup
Any info on how to make these error messages go away?
*(I posted this same question into* r/JupyterLab *a couple of days back, but have not got any responses so far. I presume this* r/JupyterNotebooks *Subreddit can also consider JupyterLab questions).*
TBH not serious in that I am not aware of any components not actually working - but I prefer not to have nuisance errors in logfiles, lest they obscure items of real concern.
There are various lines in the JupyterLab server startup log relating to the configuration of jupyter\_nbextensions\_configurator - with the last one indicating that it failed to load. Console log below.
Versions of components in use listed below - as far as I know they are up to date (with Python 3.10.5). I have tried deleting and re-adding components with conda. Does not improve things.
Any info on....
\* what this failure to load actually implies (I am not aware of anything not working)
\* how to make this error message go away
thanks
\-----------------------------------------------------------------
Starting up Jupyter - first it suggests moving the extension...
[I 2022-06-28 11:56:49.588 ServerApp] jupyter_nbextensions_configurator | extension was found and enabled by notebook_shim. Consider moving the extension to Jupyter Server's extension paths.
But manages to link it ok
/r/JupyterNotebooks
https://redd.it/vo4f6i
Any info on how to make these error messages go away?
*(I posted this same question into* r/JupyterLab *a couple of days back, but have not got any responses so far. I presume this* r/JupyterNotebooks *Subreddit can also consider JupyterLab questions).*
TBH not serious in that I am not aware of any components not actually working - but I prefer not to have nuisance errors in logfiles, lest they obscure items of real concern.
There are various lines in the JupyterLab server startup log relating to the configuration of jupyter\_nbextensions\_configurator - with the last one indicating that it failed to load. Console log below.
Versions of components in use listed below - as far as I know they are up to date (with Python 3.10.5). I have tried deleting and re-adding components with conda. Does not improve things.
Any info on....
\* what this failure to load actually implies (I am not aware of anything not working)
\* how to make this error message go away
thanks
\-----------------------------------------------------------------
Starting up Jupyter - first it suggests moving the extension...
[I 2022-06-28 11:56:49.588 ServerApp] jupyter_nbextensions_configurator | extension was found and enabled by notebook_shim. Consider moving the extension to Jupyter Server's extension paths.
But manages to link it ok
/r/JupyterNotebooks
https://redd.it/vo4f6i
reddit
jupyter_nbextensions_configurator - error messages in JupyterLab...
Any info on how to make these error messages go away? *(I posted this same question into* r/JupyterLab *a couple of days back, but have not got...