What should and shouldn't I store in sessions?
Hi all, I'm looking to get an understanding on the data I should use sessions for. I get the basics (user details, tokens, settings, etc.), but extending that out to bigger objects I'm not so sure of.
Here's my use-case: a user goes to a web app, performs a search which returns a pandas dataframe, performs actions which tailor the dataframe, exports the data and closes the session. I have multiple users performing different searches so the dataframe must be unique to each session. Up until now, I've been writing the dataframe to their session. This has worked, but I'm looking to remove dataframe handling from the front-end entirely. My thinking was that instead of sending over the df I should instead have them hold a class object in the session, where the class deals with all of the df operations without passing it back and forth to the frontend.
But this seems very problematic to me. I'm definitely now holding more data in the session while also giving the session more powers since it technically has access to all of the class methods. I believe I should handle this with a mongodb backend which just returns and deals with IDs, but
/r/flask
https://redd.it/1k26z2b
Hi all, I'm looking to get an understanding on the data I should use sessions for. I get the basics (user details, tokens, settings, etc.), but extending that out to bigger objects I'm not so sure of.
Here's my use-case: a user goes to a web app, performs a search which returns a pandas dataframe, performs actions which tailor the dataframe, exports the data and closes the session. I have multiple users performing different searches so the dataframe must be unique to each session. Up until now, I've been writing the dataframe to their session. This has worked, but I'm looking to remove dataframe handling from the front-end entirely. My thinking was that instead of sending over the df I should instead have them hold a class object in the session, where the class deals with all of the df operations without passing it back and forth to the frontend.
But this seems very problematic to me. I'm definitely now holding more data in the session while also giving the session more powers since it technically has access to all of the class methods. I believe I should handle this with a mongodb backend which just returns and deals with IDs, but
/r/flask
https://redd.it/1k26z2b
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
arXiv moving from Cornell servers to Google Cloud
https://info.arxiv.org/hiring/index.html
/r/MachineLearning
https://redd.it/1k22p74
https://info.arxiv.org/hiring/index.html
/r/MachineLearning
https://redd.it/1k22p74
Reddit
From the MachineLearning community on Reddit: arXiv moving from Cornell servers to Google Cloud
Posted by sh_tomer - 22 votes and 0 comments
Asynchronous initialization logic
I wonder what are your strategies for async initialization logic. Let's say, that we have a class called `Klass`, which needs a resource called `resource` which can be obtained with an asynchronous coroutine `get_resource`. Strategies I can think of:
# Alternative classmethod
```
class Klass:
def __init__(self, resource):
self.resource = resource
@classmethod
async def initialize(cls):
resource = await get_resource()
return cls(resource)
```
This looks pretty straightforward, but it lacks any established convention.
# Builder/factory patters
Like above - the `__init__` method requires the already loaded resource, but we move the asynchronous logic outside the class.
# Async context manager
```
class Klass:
async def __aenter__(self):
self.resource = await get_resource()
async def __aexit__(self, exc_type, exc_info, tb):
pass
```
Here we use an established way to initialize our class. However it might be unwieldy to write `async with` logic every time. On the other hand even if this class has no cleanup logic `yet` it is no open to cleanup logic in the future without changing its usage patterns.
# Start the logic in `__init__`
```
class Klass:
def __init__(self):
self.resource_loaded = Event()
asyncio.create_task(self._get_resource())
/r/Python
https://redd.it/1k1y782
I wonder what are your strategies for async initialization logic. Let's say, that we have a class called `Klass`, which needs a resource called `resource` which can be obtained with an asynchronous coroutine `get_resource`. Strategies I can think of:
# Alternative classmethod
```
class Klass:
def __init__(self, resource):
self.resource = resource
@classmethod
async def initialize(cls):
resource = await get_resource()
return cls(resource)
```
This looks pretty straightforward, but it lacks any established convention.
# Builder/factory patters
Like above - the `__init__` method requires the already loaded resource, but we move the asynchronous logic outside the class.
# Async context manager
```
class Klass:
async def __aenter__(self):
self.resource = await get_resource()
async def __aexit__(self, exc_type, exc_info, tb):
pass
```
Here we use an established way to initialize our class. However it might be unwieldy to write `async with` logic every time. On the other hand even if this class has no cleanup logic `yet` it is no open to cleanup logic in the future without changing its usage patterns.
# Start the logic in `__init__`
```
class Klass:
def __init__(self):
self.resource_loaded = Event()
asyncio.create_task(self._get_resource())
/r/Python
https://redd.it/1k1y782
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Every Python Decorator Explained
Hi there, I just wanted to know more about Python and I had this crazy idea about knowing every built-in decorator and some of those who come from built-in libraries.. Hope you learn sth new. Any feedback is welcomed. The source has the intention of sharing learning.
Here's the explanation
/r/Python
https://redd.it/1k2ervp
Hi there, I just wanted to know more about Python and I had this crazy idea about knowing every built-in decorator and some of those who come from built-in libraries.. Hope you learn sth new. Any feedback is welcomed. The source has the intention of sharing learning.
Here's the explanation
/r/Python
https://redd.it/1k2ervp
YouTube
Every Python Decorator Explained in 9 minutes
Every Built-in Python Decorator Explained in 9 minutes (If not, the title would be too long for SEO haha).
🌐 Python decorators in just 9 minutes! This fast-paced yet beginner-friendly tutorial will break down how decorators work, why they are useful, and…
🌐 Python decorators in just 9 minutes! This fast-paced yet beginner-friendly tutorial will break down how decorators work, why they are useful, and…
Yahi a log parser and dataviz software
# What My Project Does
yahi is a library to agregate easily logs based on regexp. It is also available on pypi.
It is delivered with scripts for parsing the Commong Log Format (default for Nginx and apache), and generating a all in one web page dataviz embedding all the views, asset, and libs.
Demo is here
# Target Audience
Since the result of the log parsing is one web page requiring no assets and fetching no resources from internet, it is perfect for sysadmins that don't want to deploy YAGNI (logstash, grafana, influx, graphite ...) complex infrastructures to share the statistics.
# Comparison
The obvious comparison is with awstats that is generating fully static web pages.
Here javascript is required, however, a single file serves all views and does not require more than the file itself for its dependencies (libs included)
/r/Python
https://redd.it/1k2bwtq
# What My Project Does
yahi is a library to agregate easily logs based on regexp. It is also available on pypi.
It is delivered with scripts for parsing the Commong Log Format (default for Nginx and apache), and generating a all in one web page dataviz embedding all the views, asset, and libs.
Demo is here
# Target Audience
Since the result of the log parsing is one web page requiring no assets and fetching no resources from internet, it is perfect for sysadmins that don't want to deploy YAGNI (logstash, grafana, influx, graphite ...) complex infrastructures to share the statistics.
# Comparison
The obvious comparison is with awstats that is generating fully static web pages.
Here javascript is required, however, a single file serves all views and does not require more than the file itself for its dependencies (libs included)
/r/Python
https://redd.it/1k2bwtq
GitHub
GitHub - jul/yahi: log parsing the easy way
log parsing the easy way . Contribute to jul/yahi development by creating an account on GitHub.
Maps with Django⁽³⁾: GeoDjango, Pillow & GPS
https://www.paulox.net/2025/04/11/maps-with-django-part-3-geodjango-pillow-and-gps/
/r/djangolearning
https://redd.it/1jys0ma
https://www.paulox.net/2025/04/11/maps-with-django-part-3-geodjango-pillow-and-gps/
/r/djangolearning
https://redd.it/1jys0ma
Paolo Melchiorre
Maps with Django⁽³⁾: GeoDjango, Pillow & GPS
A quick-start guide to create a web map with images, using the Python-based Django web framework, leveraging its GeoDjango module, and Pillow, the Python imaging library, to extract GPS information from images.
I found a way to implement actual clean architecture (pure python business logic) with Django and TDD
https://redd.it/1k25o54
@pythondaily
https://redd.it/1k25o54
@pythondaily
Reddit
From the django community on Reddit: I found a way to implement actual clean architecture (pure python business logic) with Django…
Explore this post and more from the django community
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1k2jc12
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1k2jc12
Amazon
Fluent Python: Clear, Concise, and Effective Programming
Fluent Python: Clear, Concise, and Effective Programming [Ramalho, Luciano] on Amazon.com. *FREE* shipping on qualifying offers. Fluent Python: Clear, Concise, and Effective Programming
I finished Automate The Boring Stuff, what now ?
I finished (or almost finished) this introductory book, I love it (thanks u/AlSweigart), now what is the logical step for deeper understanding of python ? my goal is to get a decent knowledge I can use in AI projects, thanks in advance.
/r/Python
https://redd.it/1k2vgx9
I finished (or almost finished) this introductory book, I love it (thanks u/AlSweigart), now what is the logical step for deeper understanding of python ? my goal is to get a decent knowledge I can use in AI projects, thanks in advance.
/r/Python
https://redd.it/1k2vgx9
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
A simple app that lets you visualise and analyse pip packages installed on your system
I wanted to share a little tool I've been working on called ViperView. It's a desktop application that helps you visualize and manage your Python package installations in a clean, user-friendly interface.
Key Features:
* Lists all installed pip packages with version, size, and location
* Interactive bar chart showing the top 20 largest packages
* Real-time search/filtering
* Export package data to CSV
* Dark theme with a modern PyQt5 interface
it's just a simple GUI that makes it easy to understand your Python environment's disk usage.
Check it out on [GitHub: https://github.com/ExoFi-Labs/ViperView](https://github.com/ExoFi-Labs/ViperView)
Would love to hear your feedback and suggestions for improvements!
/r/Python
https://redd.it/1k2w14y
I wanted to share a little tool I've been working on called ViperView. It's a desktop application that helps you visualize and manage your Python package installations in a clean, user-friendly interface.
Key Features:
* Lists all installed pip packages with version, size, and location
* Interactive bar chart showing the top 20 largest packages
* Real-time search/filtering
* Export package data to CSV
* Dark theme with a modern PyQt5 interface
it's just a simple GUI that makes it easy to understand your Python environment's disk usage.
Check it out on [GitHub: https://github.com/ExoFi-Labs/ViperView](https://github.com/ExoFi-Labs/ViperView)
Would love to hear your feedback and suggestions for improvements!
/r/Python
https://redd.it/1k2w14y
GitHub
GitHub - ExoFi-Labs/ViperView
Contribute to ExoFi-Labs/ViperView development by creating an account on GitHub.
Startle: Instantly start a CLI from a function, functions, or a class
Hi! I have been working on **Startle**, which lets you transform a function, functions or a (data)class into a command-line entry point. It is heavily inspired by Fire and Typer, but I wanted to address some pain points I have personally experienced as a user of both projects, and approach some things differently.
* [Github](https://github.com/oir/startle/)
* [Docs](https://oir.github.io/startle/)
# What My Project Does
* Transform a function into a command-line entry point. This is done by inspecting the given function and defining the command-line arguments and options based on the function arguments (with their type hints and default values) and the docstring.
* Transform a *list* of functions into an entry point. In this case, functions are made available as commands with their own arguments and options in your CLI.
* Use a class (possibly a dataclass) to define an entry point, where command line arguments are automatically parsed into your config object (instead of invoking a function).
# Target Audience
Devs building command line interfaces, who want to translate existing functions or config classes into argparsers automatically.
I consider the project to be alpha and unstable, despite having a usable MVP for parsing with functions and classes, until it gets some active use for a while and API is
/r/Python
https://redd.it/1k2kxgv
Hi! I have been working on **Startle**, which lets you transform a function, functions or a (data)class into a command-line entry point. It is heavily inspired by Fire and Typer, but I wanted to address some pain points I have personally experienced as a user of both projects, and approach some things differently.
* [Github](https://github.com/oir/startle/)
* [Docs](https://oir.github.io/startle/)
# What My Project Does
* Transform a function into a command-line entry point. This is done by inspecting the given function and defining the command-line arguments and options based on the function arguments (with their type hints and default values) and the docstring.
* Transform a *list* of functions into an entry point. In this case, functions are made available as commands with their own arguments and options in your CLI.
* Use a class (possibly a dataclass) to define an entry point, where command line arguments are automatically parsed into your config object (instead of invoking a function).
# Target Audience
Devs building command line interfaces, who want to translate existing functions or config classes into argparsers automatically.
I consider the project to be alpha and unstable, despite having a usable MVP for parsing with functions and classes, until it gets some active use for a while and API is
/r/Python
https://redd.it/1k2kxgv
GitHub
GitHub - oir/startle: Instantly start a CLI from a function, functions, or a class
Instantly start a CLI from a function, functions, or a class - oir/startle
Is Django better for monolithic or microservices if I want low latency and high performance?
I'm using Django (multi tenant) for my current project and trying to decide whether to keep it monolithic or split it into microservices. My main goals are reducing latency, improving performance, and ensuring scalability as the app grows.
Django is great for rapid development, but I’m not sure if it’s the best fit for a high-performance architecture in the long run.
Has anyone here achieved low-latency performance with Django in either setup? What worked best for you — monolith or microservices?
/r/django
https://redd.it/1k2y12q
I'm using Django (multi tenant) for my current project and trying to decide whether to keep it monolithic or split it into microservices. My main goals are reducing latency, improving performance, and ensuring scalability as the app grows.
Django is great for rapid development, but I’m not sure if it’s the best fit for a high-performance architecture in the long run.
Has anyone here achieved low-latency performance with Django in either setup? What worked best for you — monolith or microservices?
/r/django
https://redd.it/1k2y12q
Reddit
From the django community on Reddit
Explore this post and more from the django community
Is Django better for monolithic or microservices if I want low latency and high performance?
I'm using Django for my current project (multi tenant) and trying to decide whether to keep it monolithic or split it into microservices. My main goals are reducing latency, improving performance, and ensuring scalability as the app grows.
Django is great for rapid development, but I’m not sure if it’s the best fit for a high-performance architecture in the long run.
Has anyone here achieved low-latency performance with Django in either setup? What worked best for you — monolith or microservices?
/r/Python
https://redd.it/1k2y3l8
I'm using Django for my current project (multi tenant) and trying to decide whether to keep it monolithic or split it into microservices. My main goals are reducing latency, improving performance, and ensuring scalability as the app grows.
Django is great for rapid development, but I’m not sure if it’s the best fit for a high-performance architecture in the long run.
Has anyone here achieved low-latency performance with Django in either setup? What worked best for you — monolith or microservices?
/r/Python
https://redd.it/1k2y3l8
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Just Launched My First Django Website – Feedback & Suggestions
Hey everyone,
I just launched my first website for my business: https://graysontowncar.com/. It’s built with Django, and I’m constantly working to improve it.
Right now, users can:
Make reservations through the site,
Choose to pay upfront or save their card on file to pay later (secured through Stripe),
Receive automatic email confirmations after booking.
On the backend, I can view, edit, and manage reservations through the Django admin dashboard. So far, everything driver-related is still manual. I don’t have a separate app or dashboard for drivers yet.
My next big goals:
Implement driver assignment for reservations,
Let drivers filter and view their upcoming pickups by date,
Build a dispatcher dashboard to help manage all of this in a more automated way.
If you know of any open source projects with similar features users assignments, dispatch systems, etc., I’d really appreciate any recommendations. I’m also open to any feedback on the site itself or the code (GitHub repo: https://github.com/AbdallaXO/grayson-towncar.
Thanks!
/r/django
https://redd.it/1k37fro
Hey everyone,
I just launched my first website for my business: https://graysontowncar.com/. It’s built with Django, and I’m constantly working to improve it.
Right now, users can:
Make reservations through the site,
Choose to pay upfront or save their card on file to pay later (secured through Stripe),
Receive automatic email confirmations after booking.
On the backend, I can view, edit, and manage reservations through the Django admin dashboard. So far, everything driver-related is still manual. I don’t have a separate app or dashboard for drivers yet.
My next big goals:
Implement driver assignment for reservations,
Let drivers filter and view their upcoming pickups by date,
Build a dispatcher dashboard to help manage all of this in a more automated way.
If you know of any open source projects with similar features users assignments, dispatch systems, etc., I’d really appreciate any recommendations. I’m also open to any feedback on the site itself or the code (GitHub repo: https://github.com/AbdallaXO/grayson-towncar.
Thanks!
/r/django
https://redd.it/1k37fro
Graysontowncar
Orlando Airport Transportation | Grayson Towncar - Disney, Cruises & More
Grayson Towncar offers premium transportation from Orlando Airport to Disney, Universal, and Port Canaveral. Safe, reliable, and family-friendly rides.
Should there be a convention for documenting whether method mutates object?
I believe that it would be a good thing if some conventions were established to indicate in documentation whether a method mutates the object. It would be nice if it were something easy to add to docstrings, and would be easily visible in the resulting docs without being verbose or distracting.
While one could organize the documention in something like Sphinx to list methods separately, that doesn't help for those seeing the method docs within an IDE, which is typically more useful.
Naming convensions as we see in
There will be a high correleation between return type of
If I better understood the doctring processing and how flags can be added to restructedText, I might be able to offer a more concrete proposal as a starting point for discussion. But I don't so I can't.
/r/Python
https://redd.it/1k34dtv
I believe that it would be a good thing if some conventions were established to indicate in documentation whether a method mutates the object. It would be nice if it were something easy to add to docstrings, and would be easily visible in the resulting docs without being verbose or distracting.
While one could organize the documention in something like Sphinx to list methods separately, that doesn't help for those seeing the method docs within an IDE, which is typically more useful.
Naming convensions as we see in
sort v sorted and reverse v reversed based on verb v participle/adjective is not something we can expect people to follow except where they have pairs of method.There will be a high correleation between return type of
None and mutation, and perhaps that will have to suffice. But I think it is worth discussing whether we can do better.If I better understood the doctring processing and how flags can be added to restructedText, I might be able to offer a more concrete proposal as a starting point for discussion. But I don't so I can't.
/r/Python
https://redd.it/1k34dtv
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Sunday Daily Thread: What's everyone working on this week?
# Weekly Thread: What's Everyone Working On This Week? 🛠️
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
/r/Python
https://redd.it/1k39vt8
# Weekly Thread: What's Everyone Working On This Week? 🛠️
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
/r/Python
https://redd.it/1k39vt8
Reddit
From the Python community on Reddit
Explore this post and more from the Python community