Open-Source Hawkeye for Volleyball
​
example\_usage.gif
Hello Python Community!
I would like to present you my thesis project, where I trained models to detect and track the ball, players, the court and an additional model for action recognition. My mission is to contribute to the open-source community, create volleyball datasets and bring volleyball into the AI spotlight.
Check out the code and datasets on GitHub - VolleVision
The success of my project is counted by number of people that will benefit from it, so please consider giving it a STAR if you find it interesting or useful.
/r/Python
https://redd.it/13f815u
​
example\_usage.gif
Hello Python Community!
I would like to present you my thesis project, where I trained models to detect and track the ball, players, the court and an additional model for action recognition. My mission is to contribute to the open-source community, create volleyball datasets and bring volleyball into the AI spotlight.
Check out the code and datasets on GitHub - VolleVision
The success of my project is counted by number of people that will benefit from it, so please consider giving it a STAR if you find it interesting or useful.
/r/Python
https://redd.it/13f815u
GitHub
GitHub - shukkkur/VolleyVision: Applying Deep Learning Approaches to Volleyball Data
Applying Deep Learning Approaches to Volleyball Data - shukkkur/VolleyVision
Introducing Solara: A Pure Python, React-style Framework for Scaling Your Web Apps
We're excited to introduce Solara: A pure Python web framework built for large, complex apps.
While there are many Python web frameworks out there, most are designed for small data apps or use paradigms unproven for larger scale. Code organization, reusability, and state tend to suffer as apps grow in complexity, resulting in either spaghetti code or offloading to a React application.
Solara addresses this gap. Using a React-like API, we don't need to worry about scalability. React has already proven its ability to support the world's largest web apps.
Solara uses a pure Python implementation of React (Reacton), creating ipywidget-based applications. These apps work both inside the Jupyter Notebook and as standalone web apps with frameworks like FastAPI. This paradigm enables component-based code and incredibly simple state management.
By building on top of ipywidgets, we automatically leverage an existing ecosystem of widgets and run on many platforms, including JupyterLab, Jupyter Notebook, Voilà, Google Colab, DataBricks, JetBrains Datalore, and more.
We look forward to your thoughts and feedback!
Check out our web (running on solara itself) at solara.dev or visit our repo at https://github.com/widgetti/solara
The application shown below allows you
/r/Python
https://redd.it/13fegbp
We're excited to introduce Solara: A pure Python web framework built for large, complex apps.
While there are many Python web frameworks out there, most are designed for small data apps or use paradigms unproven for larger scale. Code organization, reusability, and state tend to suffer as apps grow in complexity, resulting in either spaghetti code or offloading to a React application.
Solara addresses this gap. Using a React-like API, we don't need to worry about scalability. React has already proven its ability to support the world's largest web apps.
Solara uses a pure Python implementation of React (Reacton), creating ipywidget-based applications. These apps work both inside the Jupyter Notebook and as standalone web apps with frameworks like FastAPI. This paradigm enables component-based code and incredibly simple state management.
By building on top of ipywidgets, we automatically leverage an existing ecosystem of widgets and run on many platforms, including JupyterLab, Jupyter Notebook, Voilà, Google Colab, DataBricks, JetBrains Datalore, and more.
We look forward to your thoughts and feedback!
Check out our web (running on solara itself) at solara.dev or visit our repo at https://github.com/widgetti/solara
The application shown below allows you
/r/Python
https://redd.it/13fegbp
solara.dev
Solara: Build high-quality web applications in pure Python
Which method for running Flask inside Google Colab is better?
I have a GC notebook that I want to share with non tech-savvy end users, so I looked up how to run Flask and expose to the internet in order to access it, and found this thread with two different methods?
I've tried out both of them, but I don't like idea of including my own authorization token inside a public notebook in order to use ngrok, and I'm worried about stuff like security when simply launching a server on a port. Can someone shine a light on the topic?
/r/flask
https://redd.it/13fnnk3
I have a GC notebook that I want to share with non tech-savvy end users, so I looked up how to run Flask and expose to the internet in order to access it, and found this thread with two different methods?
I've tried out both of them, but I don't like idea of including my own authorization token inside a public notebook in order to use ngrok, and I'm worried about stuff like security when simply launching a server on a port. Can someone shine a light on the topic?
/r/flask
https://redd.it/13fnnk3
Stack Overflow
Is there a general way to run Web Applications on Google Colab?
I would like to develop web apps in Google colab. The only issue is that you need a browser connected to local host to view the web app, but Google colab doesn't have a browser inside the notebook....
Python init Vs new Method - With Examples
​
https://preview.redd.it/syny6wm3ceza1.png?width=1600&format=png&auto=webp&v=enabled&s=53af28ad8bf13b806b7901fb1d0d14be9758b08f
You must have seen the implementation of the
The
When we define both the
Most programming languages require only a constructor, a special method to create and initialize objects, but Python has both a constructor and an initializer.
In this article, we'll see:
Definition of the `__init__` and `__new__` methods
When they should be used
The distinction between the two methods
Here's the guide👉 Python \_\_init\_\_ Vs \_\_new\_\_ Method - With Examples
/r/Python
https://redd.it/13fk77q
​
https://preview.redd.it/syny6wm3ceza1.png?width=1600&format=png&auto=webp&v=enabled&s=53af28ad8bf13b806b7901fb1d0d14be9758b08f
You must have seen the implementation of the
__init__ method in any Python class, and if you have worked with Python classes, you must have implemented the __init__ method many times. However, you are unlikely to have implemented or seen a __new__ method within any class.The
__init__ method is an initializer method that is used to initialize the attributes of an object after it is created, whereas the __new__ method is used to create the object.When we define both the
__new__ and the __init__ methods inside a class, Python first calls the __new__ method to create the object and then calls the __init__ method to initialize the object's attributes.Most programming languages require only a constructor, a special method to create and initialize objects, but Python has both a constructor and an initializer.
In this article, we'll see:
Definition of the `__init__` and `__new__` methods
__init__ method and __new__ method implementationWhen they should be used
The distinction between the two methods
Here's the guide👉 Python \_\_init\_\_ Vs \_\_new\_\_ Method - With Examples
/r/Python
https://redd.it/13fk77q
DataClass through decorator vs base class
This is not a protest but a question about the principles and philosophy behind the decision to use decorators in Python. Although personally I don't like decorators, I do not object to their inclusion in Python.
I am happily open to hearing arguments FOR decorators, however it seems to me that, for example, the DataClass could have been implemented as a base class and that the use of decorator is more about adding a cool new feature.
My concern is that in the pursuit of cool, Python will go down the same death spiral as the monstrosity that Java has become.
So what are the good words for decorators in Python?
/r/Python
https://redd.it/13fncv7
This is not a protest but a question about the principles and philosophy behind the decision to use decorators in Python. Although personally I don't like decorators, I do not object to their inclusion in Python.
I am happily open to hearing arguments FOR decorators, however it seems to me that, for example, the DataClass could have been implemented as a base class and that the use of decorator is more about adding a cool new feature.
My concern is that in the pursuit of cool, Python will go down the same death spiral as the monstrosity that Java has become.
So what are the good words for decorators in Python?
/r/Python
https://redd.it/13fncv7
Reddit
r/Python on Reddit: DataClass through decorator vs base class
Posted by u/buzzwallard - 22 votes and 9 comments
Logging in a flask app
So I am running a flask app that has a lot of logging. Currently the log level is set to warning. But in the event of some issue, I'd would like to see the lower level debug logs.
Is restarting the app with the log level set to debug, the only way to do this? I'd need the error to happen again in this case. How is this done on production apps? Or do they set the log level to debug right from the start?
/r/flask
https://redd.it/13fwr6t
So I am running a flask app that has a lot of logging. Currently the log level is set to warning. But in the event of some issue, I'd would like to see the lower level debug logs.
Is restarting the app with the log level set to debug, the only way to do this? I'd need the error to happen again in this case. How is this done on production apps? Or do they set the log level to debug right from the start?
/r/flask
https://redd.it/13fwr6t
Reddit
r/flask on Reddit: Logging in a flask app
Posted by u/grchelp2018 - No votes and 2 comments
When using a filefield with WTForms, is the file fully uploaded to the server to validate file format?
I noticed it took more time when I submitted a larger file with invalid file format, for the page to reload with errors. Does the server receive the full file? If it does not receive the file, then how does the server know the file type?
TL;DR: Does a large file with invalid file type submitted in a WTForms filefield put load on the server?
/r/flask
https://redd.it/13frdsz
I noticed it took more time when I submitted a larger file with invalid file format, for the page to reload with errors. Does the server receive the full file? If it does not receive the file, then how does the server know the file type?
TL;DR: Does a large file with invalid file type submitted in a WTForms filefield put load on the server?
/r/flask
https://redd.it/13frdsz
Reddit
r/flask on Reddit: When using a filefield with WTForms, is the file fully uploaded to the server to validate file format?
Posted by u/remidentity - 1 vote and 1 comment
Foreign key option
I am making an app for a BJJ tournament. I have a form to catch competitors' registration like name, weight, and rank. After that, the admin will create however many groups for competition as needed. Each competitor can only be in 1 group.
Models.py
class Group1(models.Model):
grouplabel = models.CharField(maxlength=20, unique=True)
point = models.IntegerField(default=0)
class Competitors(models.Model):
flname = models.CharField(maxlength=255)
Weight = models.IntegerField(validators=[MinValueValidator(50), MaxValueValidator(300)])
rank = models.CharField(maxlength=255)
Group1 = models.ForeignKey(Group1, blank=True, null=True, ondelete=models.CASCADE, tofield='grouplabel')
[Admin.py](https://Admin.py)
​
class MemberAdmin(admin.ModelAdmin):
listdisplay = ("flname", "Weight", "rank", "Group1")
admin.site.unregister(Competitors)
admin.site.register(Competitors, MemberAdmin)
def str(self):
return f"{self.flname} {self.Weight}"
class MemberAdmin(admin.ModelAdmin):
listdisplay = ("grouplabel","point")
admin.site.unregister(Group1)
admin.site.register(Group1, MemberAdmin)
​
Here, we can
/r/djangolearning
[https://redd.it/13fun0n
I am making an app for a BJJ tournament. I have a form to catch competitors' registration like name, weight, and rank. After that, the admin will create however many groups for competition as needed. Each competitor can only be in 1 group.
Models.py
class Group1(models.Model):
grouplabel = models.CharField(maxlength=20, unique=True)
point = models.IntegerField(default=0)
class Competitors(models.Model):
flname = models.CharField(maxlength=255)
Weight = models.IntegerField(validators=[MinValueValidator(50), MaxValueValidator(300)])
rank = models.CharField(maxlength=255)
Group1 = models.ForeignKey(Group1, blank=True, null=True, ondelete=models.CASCADE, tofield='grouplabel')
[Admin.py](https://Admin.py)
​
class MemberAdmin(admin.ModelAdmin):
listdisplay = ("flname", "Weight", "rank", "Group1")
admin.site.unregister(Competitors)
admin.site.register(Competitors, MemberAdmin)
def str(self):
return f"{self.flname} {self.Weight}"
class MemberAdmin(admin.ModelAdmin):
listdisplay = ("grouplabel","point")
admin.site.unregister(Group1)
admin.site.register(Group1, MemberAdmin)
​
Here, we can
/r/djangolearning
[https://redd.it/13fun0n
Flask: Uploading pdfs to google drive using its API
for file in files:
filemetadata = {
'name' : securefilename(file.filename),
'parents' : folder_id
}
#f = io.BytesIO(file)
media = MediaFileUpload(file, mimetype = 'application/pdf')
drive.service.files().create(
body = filemetadata,
mediabody = media,
fields = 'id'
).execute()
So here's the part that I can't figure out. What is basically happening is that I have a form that takes in a list of pdf files (max 5 mb for each of those files) but what I can't figure out is how to upload those files to the google drive folder. I
/r/flask
https://redd.it/13gcndv
for file in files:
filemetadata = {
'name' : securefilename(file.filename),
'parents' : folder_id
}
#f = io.BytesIO(file)
media = MediaFileUpload(file, mimetype = 'application/pdf')
drive.service.files().create(
body = filemetadata,
mediabody = media,
fields = 'id'
).execute()
So here's the part that I can't figure out. What is basically happening is that I have a form that takes in a list of pdf files (max 5 mb for each of those files) but what I can't figure out is how to upload those files to the google drive folder. I
/r/flask
https://redd.it/13gcndv
Reddit
r/flask on Reddit: Flask: Uploading pdfs to google drive using its API
Posted by u/Seandara - 3 votes and 2 comments
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/13g1e22
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/13g1e22
Reddit
r/Python on Reddit: Saturday Daily Thread: Resource Request and Sharing! Daily Thread
Posted by u/Im__Joseph - 9 votes and 2 comments
Do You Use Singletons?
I work on a monolith that needs to maintain many connections (SQL ODBC, HTTP, Redis, etc...) and I find myself worrying about connection management often. The monolith also has much of its functionality in a gunicorn/uvicorn/starlette server.
I often find myself wondering if I should implement singleton connection management classes for many of these connections. I'm aware that they don't work across multiple gunicorn workers, but at least I know there's only one aiomysql pool per worker, for example. Does anyone use singletons for this purpose, or is there a better design pattern that I'm not using?
/r/Python
https://redd.it/13g4ml1
I work on a monolith that needs to maintain many connections (SQL ODBC, HTTP, Redis, etc...) and I find myself worrying about connection management often. The monolith also has much of its functionality in a gunicorn/uvicorn/starlette server.
I often find myself wondering if I should implement singleton connection management classes for many of these connections. I'm aware that they don't work across multiple gunicorn workers, but at least I know there's only one aiomysql pool per worker, for example. Does anyone use singletons for this purpose, or is there a better design pattern that I'm not using?
/r/Python
https://redd.it/13g4ml1
Reddit
r/Python on Reddit: Do You Use Singletons?
Posted by u/Mubs - 111 votes and 67 comments
Generate Django templates with JS
https://github.com/LazerRaptor/django-template-gen/
I've been working on a Rollup.js plugin on the last few weekends that would generate Django templates from JS modules. It utilizes Rollup hooks that give access to source code (as a string) and AST, which makes it possible to pick certain bits of code. In this case, I needed to get
This is just an example project so far. The end goal is to bring the DX of node.js frontend libraries to the Django's ecosystem. For me, the functionality of Alpine.js and HTMX is great, but the DX is the biggest problem. I can't help but create a mess using them. There are projects like django-components and slippers that help to some extent. But I believe there is more potential for DX improvements if we move all our frontend work in node.js environment.
I'd appreciate if you had a quick look at the project's readme and shared your thoughts.
/r/django
https://redd.it/13gj12x
https://github.com/LazerRaptor/django-template-gen/
I've been working on a Rollup.js plugin on the last few weekends that would generate Django templates from JS modules. It utilizes Rollup hooks that give access to source code (as a string) and AST, which makes it possible to pick certain bits of code. In this case, I needed to get
render() method's return value, which is hyperscript that can be transpiled into HTML. The plugin lives here.This is just an example project so far. The end goal is to bring the DX of node.js frontend libraries to the Django's ecosystem. For me, the functionality of Alpine.js and HTMX is great, but the DX is the biggest problem. I can't help but create a mess using them. There are projects like django-components and slippers that help to some extent. But I believe there is more potential for DX improvements if we move all our frontend work in node.js environment.
I'd appreciate if you had a quick look at the project's readme and shared your thoughts.
/r/django
https://redd.it/13gj12x
GitHub
GitHub - LazerRaptor/django-template-gen: Generate Django templates in a Node.js environment
Generate Django templates in a Node.js environment - GitHub - LazerRaptor/django-template-gen: Generate Django templates in a Node.js environment