Agent-Based Modeling library Mesa releases version 3.1
Hi everyone! After our huge Mesa 3.0 release, we're proud to announce Mesa 3.1 less than a month later. It contains some major spatial improvements and groundwork for new control and data collection features.
- https://github.com/projectmesa/mesa/releases/tag/v3.1.0
### What's Agent-Based Modeling?
Ever wondered how bird flocks organize themselves? Or how traffic jams form? Agent-based modeling (ABM) lets you simulate these complex systems by defining simple rules for individual "agents" (birds, cars, people, etc.) and then watching how they interact. Instead of writing equations to describe the whole system, you model each agent's behavior and let patterns emerge naturally through their interactions. It's particularly powerful for studying systems where individual decisions and interactions drive collective behavior.
### What's Mesa?
Mesa is Python's leading framework for agent-based modeling, providing a comprehensive toolkit for creating, analyzing, and visualizing agent-based models. It combines Python's scientific stack (NumPy, pandas, Matplotlib) with specialized tools for handling spatial relationships, agent scheduling, and data collection. Whether you're studying epidemic spread, market dynamics, or ecological systems, Mesa provides the building blocks to create sophisticated simulations while keeping your code clean and maintainable.
### What's new in Mesa 3.1?
This release adds experimental support for Observables and Computed, enabling a more reactive and responsive programming model for agent-based simulations.
/r/Python
https://redd.it/1h6pwdn
Hi everyone! After our huge Mesa 3.0 release, we're proud to announce Mesa 3.1 less than a month later. It contains some major spatial improvements and groundwork for new control and data collection features.
- https://github.com/projectmesa/mesa/releases/tag/v3.1.0
### What's Agent-Based Modeling?
Ever wondered how bird flocks organize themselves? Or how traffic jams form? Agent-based modeling (ABM) lets you simulate these complex systems by defining simple rules for individual "agents" (birds, cars, people, etc.) and then watching how they interact. Instead of writing equations to describe the whole system, you model each agent's behavior and let patterns emerge naturally through their interactions. It's particularly powerful for studying systems where individual decisions and interactions drive collective behavior.
### What's Mesa?
Mesa is Python's leading framework for agent-based modeling, providing a comprehensive toolkit for creating, analyzing, and visualizing agent-based models. It combines Python's scientific stack (NumPy, pandas, Matplotlib) with specialized tools for handling spatial relationships, agent scheduling, and data collection. Whether you're studying epidemic spread, market dynamics, or ecological systems, Mesa provides the building blocks to create sophisticated simulations while keeping your code clean and maintainable.
### What's new in Mesa 3.1?
This release adds experimental support for Observables and Computed, enabling a more reactive and responsive programming model for agent-based simulations.
/r/Python
https://redd.it/1h6pwdn
Reddit
From the Python community on Reddit: Mesa 3.0: A major update to Python's Agent-Based Modeling library 🎉
Explore this post and more from the Python community
Where can I deploy my flask app and sql alchemy for free
I have a flask app using sql alchemy. I tried to deploy the app on vercel but I soon found out that it does not have native support for sql alchemy which was frustrating.
So where can I deploy my app for free that has automatic support for sql alchemy?
/r/flask
https://redd.it/1h6qwpn
I have a flask app using sql alchemy. I tried to deploy the app on vercel but I soon found out that it does not have native support for sql alchemy which was frustrating.
So where can I deploy my app for free that has automatic support for sql alchemy?
/r/flask
https://redd.it/1h6qwpn
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Django security releases issued: 5.1.4, 5.0.10, and 4.2.17
https://www.djangoproject.com/weblog/2024/dec/04/security-releases/
/r/django
https://redd.it/1h6kjbt
https://www.djangoproject.com/weblog/2024/dec/04/security-releases/
/r/django
https://redd.it/1h6kjbt
Django Project
Django security releases issued: 5.1.4, 5.0.10, and 4.2.17
Posted by Sarah Boyce on Dec. 4, 2024
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1h6vb5l
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1h6vb5l
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Nefertiti for Sphinx
Hi there,
A new Sphinx theme is available, it is called Nefertiti, and it is highly customizable: it comes with several font bundles and new fonts can be added easily (to avoid accessing 3rd party font sites, like Google Fonts). It supports filtering of the index (in the left side column), which allows to find index entries that we might remember from a previous visit but can't remember in what level they are. It has support for light/dark color schemes, and when given, images switch between color-schemes too (this last feature is based on sphinx-colorschemed-images). Nefertiti provides several colorsets, and there is an extra option to make the header color neutral, so that the primary color adapts to the light/dark color scheme. You can see these color customizations directly in the docs of Nefertiti for Sphinx. Another feature are header links, they are visible in the docs. They are customizable too. Header links can be displayed next to the project's name or in a second row in the header, below the project's name (see examples in this page). They can contain dropdown menus too. All that is customizable.
If you take a look and see something not working, please, create an
/r/Python
https://redd.it/1h6hq7i
Hi there,
A new Sphinx theme is available, it is called Nefertiti, and it is highly customizable: it comes with several font bundles and new fonts can be added easily (to avoid accessing 3rd party font sites, like Google Fonts). It supports filtering of the index (in the left side column), which allows to find index entries that we might remember from a previous visit but can't remember in what level they are. It has support for light/dark color schemes, and when given, images switch between color-schemes too (this last feature is based on sphinx-colorschemed-images). Nefertiti provides several colorsets, and there is an extra option to make the header color neutral, so that the primary color adapts to the light/dark color scheme. You can see these color customizations directly in the docs of Nefertiti for Sphinx. Another feature are header links, they are visible in the docs. They are customizable too. Header links can be displayed next to the project's name or in a second row in the header, below the project's name (see examples in this page). They can contain dropdown menus too. All that is customizable.
If you take a look and see something not working, please, create an
/r/Python
https://redd.it/1h6hq7i
GitHub
GitHub - danirus/sphinx-colorschemed-images: A Sphinx extension to add support for colorschemed images.
A Sphinx extension to add support for colorschemed images. - danirus/sphinx-colorschemed-images
Perplexity Pro 1 Year Vouchers (activate then pay)
Get a 1-Year Perplexity Pro Voucher for just $25 (regular price $200) through my service provider.
This includes access to advanced models like:
* Claude 3.5 Sonnet, Claude 3.5 Haiku (Opus Removed), Grok-2
* GPT-4o, o1 Mini for Reasoning & Llama 3.1
* Image generators: Flux.1, DALL-E 3, Playground v3 Stable Diffusion XL
Works globally as long as you don't have an active Pro subnoscription.
# How It Works:
1. Join the 👉[Discord](https://discord.gg/h2HUMpKxhn) of 240+ Members
2. Pay via PayPal for buyer protection.
3. I'll send you a link to redeem.
[Vouch from Buyers](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv38zi), [Feedback 2](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv3g3d), [Feedback 3](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gu0bkm), [Feedback 4](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g510cq), [Feedback 5](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g6ilkh)
/r/Python
https://redd.it/1h70a77
Get a 1-Year Perplexity Pro Voucher for just $25 (regular price $200) through my service provider.
This includes access to advanced models like:
* Claude 3.5 Sonnet, Claude 3.5 Haiku (Opus Removed), Grok-2
* GPT-4o, o1 Mini for Reasoning & Llama 3.1
* Image generators: Flux.1, DALL-E 3, Playground v3 Stable Diffusion XL
Works globally as long as you don't have an active Pro subnoscription.
# How It Works:
1. Join the 👉[Discord](https://discord.gg/h2HUMpKxhn) of 240+ Members
2. Pay via PayPal for buyer protection.
3. I'll send you a link to redeem.
[Vouch from Buyers](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv38zi), [Feedback 2](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv3g3d), [Feedback 3](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gu0bkm), [Feedback 4](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g510cq), [Feedback 5](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g6ilkh)
/r/Python
https://redd.it/1h70a77
Discord
Join the GPT Code Shop™ Discord Server!
Welcome to GPT Code Shop! This server is your one-stop shop for Perplexity, LinkedIn & many other premium digital items. | 1011 members
What should I do next?
I want to ask you about what should I do now I want to learn backend using Python. I know python basics concepts as well some advance concepts like decorators and also OOP concepts inheritance and polymorphism I also know about basics of Django like I can create a simple to do application. I know about forms, models, urls, views and templates. But I recently I came to know that Django is used for making APIs. Now my question is what should be the next step how to learn about APIs please share any resources you know about.
/r/djangolearning
https://redd.it/1h6h8ro
I want to ask you about what should I do now I want to learn backend using Python. I know python basics concepts as well some advance concepts like decorators and also OOP concepts inheritance and polymorphism I also know about basics of Django like I can create a simple to do application. I know about forms, models, urls, views and templates. But I recently I came to know that Django is used for making APIs. Now my question is what should be the next step how to learn about APIs please share any resources you know about.
/r/djangolearning
https://redd.it/1h6h8ro
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Perplexity Pro 1 Year Vouchers (activate then pay)
Get a 1-Year Perplexity Pro Voucher for just $25 (regular price $200) through my service provider.
This includes access to advanced models like:
* Claude 3.5 Sonnet, Claude 3.5 Haiku (Opus Removed), Grok-2
* GPT-4o, o1 Mini for Reasoning & Llama 3.1
* Image generators: Flux.1, DALL-E 3, Playground v3 Stable Diffusion XL
Works globally as long as you don't have an active Pro subnoscription.
# How It Works:
1. Join the 👉[Discord](https://discord.gg/h2HUMpKxhn) of 240+ Members
2. Pay via PayPal for buyer protection.
3. I'll send you a link to redeem.
[Vouch from Buyers](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv38zi), [Feedback 2](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv3g3d), [Feedback 3](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gu0bkm), [Feedback 4](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g510cq), [Feedback 5](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g6ilkh)
/r/flask
https://redd.it/1h74glb
Get a 1-Year Perplexity Pro Voucher for just $25 (regular price $200) through my service provider.
This includes access to advanced models like:
* Claude 3.5 Sonnet, Claude 3.5 Haiku (Opus Removed), Grok-2
* GPT-4o, o1 Mini for Reasoning & Llama 3.1
* Image generators: Flux.1, DALL-E 3, Playground v3 Stable Diffusion XL
Works globally as long as you don't have an active Pro subnoscription.
# How It Works:
1. Join the 👉[Discord](https://discord.gg/h2HUMpKxhn) of 240+ Members
2. Pay via PayPal for buyer protection.
3. I'll send you a link to redeem.
[Vouch from Buyers](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv38zi), [Feedback 2](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv3g3d), [Feedback 3](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gu0bkm), [Feedback 4](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g510cq), [Feedback 5](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g6ilkh)
/r/flask
https://redd.it/1h74glb
Discord
Join the GPT Code Shop™ Discord Server!
Welcome to GPT Code Shop! This server is your one-stop shop for Perplexity, LinkedIn & many other premium digital items. | 1011 members
What Libraries do you use for Censorship?
For example, for input open to the public such as comments, ratings, reviews etc...
What libraries, packages, and services do y'all use ? How effective were they? Any drawbacks?
/r/django
https://redd.it/1h709f8
For example, for input open to the public such as comments, ratings, reviews etc...
What libraries, packages, and services do y'all use ? How effective were they? Any drawbacks?
/r/django
https://redd.it/1h709f8
Reddit
From the django community on Reddit
Explore this post and more from the django community
💥 Tech Talks Weekly #40: newly uploaded videos from PyCon AU 2024
Hello again r/Python. I'm sharing an excerpt from the latest issue of Tech Talks Weekly with the newest PyCon AU 2024 talks, ordered by the view count for your convenience. Let me know what you think!
1. **""Switching to MongoDB: The challenges of translating database schemas" - Katie Bell (Pycon AU 2024)"** ⸱ +600 views ⸱ 28 Nov 2024 ⸱ 00h 29m 00s
2. **""How we used Python to try and save lives" - Anthony Baxter (Pycon AU 2024)"** ⸱ +300 views ⸱ 01 Dec 2024 ⸱ 00h 30m 56s
3. **""Time and Time Again" - Yaakov (Pycon AU 2024)"** ⸱ +300 views ⸱ 30 Nov 2024 ⸱ 00h 28m 10s
4. **""Student showcase" - Education Track (Pycon AU 2024)"** ⸱ +300 views ⸱ 29 Nov 2024 ⸱ 01h 40m 15s
5. **"Failsafes and Safety Fails: How to crash a train and other lessons for software engineers"** ⸱ +200 views ⸱ 29 Nov 2024 ⸱ 00h 31m 03s
6. **"Space Django: Migrating and Redesigning a Database while Hunting for Satellites."** ⸱ +200 views ⸱ 28 Nov 2024 ⸱ 00h 31m 16s
7. **"Where am I? What am I doing? Mobile App development in Python"** ⸱ +200 views ⸱ 30 Nov 2024 ⸱ 00h 29m 38s
8. **"How to
/r/Python
[https://redd.it/1h75wv7
Hello again r/Python. I'm sharing an excerpt from the latest issue of Tech Talks Weekly with the newest PyCon AU 2024 talks, ordered by the view count for your convenience. Let me know what you think!
1. **""Switching to MongoDB: The challenges of translating database schemas" - Katie Bell (Pycon AU 2024)"** ⸱ +600 views ⸱ 28 Nov 2024 ⸱ 00h 29m 00s
2. **""How we used Python to try and save lives" - Anthony Baxter (Pycon AU 2024)"** ⸱ +300 views ⸱ 01 Dec 2024 ⸱ 00h 30m 56s
3. **""Time and Time Again" - Yaakov (Pycon AU 2024)"** ⸱ +300 views ⸱ 30 Nov 2024 ⸱ 00h 28m 10s
4. **""Student showcase" - Education Track (Pycon AU 2024)"** ⸱ +300 views ⸱ 29 Nov 2024 ⸱ 01h 40m 15s
5. **"Failsafes and Safety Fails: How to crash a train and other lessons for software engineers"** ⸱ +200 views ⸱ 29 Nov 2024 ⸱ 00h 31m 03s
6. **"Space Django: Migrating and Redesigning a Database while Hunting for Satellites."** ⸱ +200 views ⸱ 28 Nov 2024 ⸱ 00h 31m 16s
7. **"Where am I? What am I doing? Mobile App development in Python"** ⸱ +200 views ⸱ 30 Nov 2024 ⸱ 00h 29m 38s
8. **"How to
/r/Python
[https://redd.it/1h75wv7
YouTube
"Switching to MongoDB: The challenges of translating database schemas" - Katie Bell (Pycon AU 2024)
(Katie Bell) So you’ve decided you want to use MongoDB!
https://pretalx.com/pycon-au-2024/talk/LGSHE8/
python, pycon, australia, programming, conference, technical, developers, panel, sessions, libraries, frameworks, community, sysadmins, students, education…
https://pretalx.com/pycon-au-2024/talk/LGSHE8/
python, pycon, australia, programming, conference, technical, developers, panel, sessions, libraries, frameworks, community, sysadmins, students, education…
How to run Flask app behind Traefik in subpath (domain.com/myapp)
Hi all,
How to run Flask app behind Traefik on subpath /myapp
I tried adding APPLICATION_ROOT=/myapp but it did not work.
/r/flask
https://redd.it/1h6x6ao
Hi all,
How to run Flask app behind Traefik on subpath /myapp
I tried adding APPLICATION_ROOT=/myapp but it did not work.
/r/flask
https://redd.it/1h6x6ao
(failed)net::ERRBLOCKEDBYORB
net::ERR\BLOCKED_BY_ORB(failed)
I am using django and fetching media files data from aws s3.
I am getting this failed network error for almost all video files(mp4, mov) but not for images in chrome when i reload page multiple time but not in mozilla firefox. but sometime(at first reload mostly) i dont get this error.
Does anbody know why this error is coming. Thanks in advance.
||
||
||
/r/django
https://redd.it/1h773yz
net::ERR\BLOCKED_BY_ORB(failed)
I am using django and fetching media files data from aws s3.
I am getting this failed network error for almost all video files(mp4, mov) but not for images in chrome when i reload page multiple time but not in mozilla firefox. but sometime(at first reload mostly) i dont get this error.
Does anbody know why this error is coming. Thanks in advance.
||
||
||
/r/django
https://redd.it/1h773yz
Reddit
From the django community on Reddit
Explore this post and more from the django community
Python binary which runs everwhere
I wanted to share some insights about an interesting project called [python-build-standalone](https://github.com/indygreg/python-build-standalone) that I've been exploring.
# What is python-build-standalone?
The **python-build-standalone** project produces fully usable Python installations that include most extension modules from the standard library. The key feature here is that it minimizes runtime dependencies.
# Why Use It?
1. **Portability**: The distributions are designed to work on any system for the targeted architecture, making it easier to deploy Python applications in diverse environments.
2. **Customizability**: Users can include build artifacts and rich metadata, which allows for downstream repackaging. This means you can create a custom Python distribution tailored to specific needs—great for embedding Python in larger binaries.
3. **Sister Project - PyOxy**: For those interested in enhancing their Python interpreter with Rust code, there's a related project called PyOxy that builds on these standalone distributions to create single-file executables.
# Getting Started
If you’re interested in trying out python-build-standalone, you can find the documentation [here](https://gregoryszorc.com/docs/python-build-standalone/main/). The documentation provides detailed instructions on how to build your own standalone Python distributions and includes examples of how to customize your builds.
# Use Cases
This tool is particularly beneficial for:
* Developers who need to distribute applications without requiring users to install Python or additional libraries.
* Projects that aim for a minimal footprint on user systems.
*
/r/Python
https://redd.it/1h78av5
I wanted to share some insights about an interesting project called [python-build-standalone](https://github.com/indygreg/python-build-standalone) that I've been exploring.
# What is python-build-standalone?
The **python-build-standalone** project produces fully usable Python installations that include most extension modules from the standard library. The key feature here is that it minimizes runtime dependencies.
# Why Use It?
1. **Portability**: The distributions are designed to work on any system for the targeted architecture, making it easier to deploy Python applications in diverse environments.
2. **Customizability**: Users can include build artifacts and rich metadata, which allows for downstream repackaging. This means you can create a custom Python distribution tailored to specific needs—great for embedding Python in larger binaries.
3. **Sister Project - PyOxy**: For those interested in enhancing their Python interpreter with Rust code, there's a related project called PyOxy that builds on these standalone distributions to create single-file executables.
# Getting Started
If you’re interested in trying out python-build-standalone, you can find the documentation [here](https://gregoryszorc.com/docs/python-build-standalone/main/). The documentation provides detailed instructions on how to build your own standalone Python distributions and includes examples of how to customize your builds.
# Use Cases
This tool is particularly beneficial for:
* Developers who need to distribute applications without requiring users to install Python or additional libraries.
* Projects that aim for a minimal footprint on user systems.
*
/r/Python
https://redd.it/1h78av5
GitHub
GitHub - astral-sh/python-build-standalone: Produce redistributable builds of Python
Produce redistributable builds of Python. Contribute to astral-sh/python-build-standalone development by creating an account on GitHub.
valkey support
Hi All, I'm thinking of moving from Redis to valkey (for a range of reasons: a) it has better thruput performance, b) it's cheaper on AWS)
Does anyone have any experience of this in Django? How seriously can I take the 'drop-in' replacement of valkey compared to redis?
/r/django
https://redd.it/1h7ash1
Hi All, I'm thinking of moving from Redis to valkey (for a range of reasons: a) it has better thruput performance, b) it's cheaper on AWS)
Does anyone have any experience of this in Django? How seriously can I take the 'drop-in' replacement of valkey compared to redis?
/r/django
https://redd.it/1h7ash1
Reddit
From the django community on Reddit
Explore this post and more from the django community
DRF + React Cookie issue
I'm trying to authenticate with DRF so the user has to be logged in to hit the API endpoints I've set up, however I'm having logistical issues with it not accurately saving the cookie I guess?
CORS_ALLOWED_ORIGINS = [
'http://localhost:3000', # If your WordPress is running on port 3000
'http://127.0.0.1:3000', # For local development
'http://127.0.0.1:8000', # For local development]
CORS_ALLOW_CREDENTIALS = True
CSRF_TRUSTED_ORIGINS = ['https://*.fly.dev','http://localhost:3000','localhost','localhost:3000'] # <-- Updated!
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False # Set True for HTTPS
CSRF_COOKIE_HTTPONLY = False # Allows JavaScript access (needed if fetching manually)
CSRF_COOKIE_SAMESITE = 'None' # Adjust for your cross-origin setup
CSRF_COOKIE_DOMAIN = None # Matches the current domain (e.g., 127.0.0.1 or localhost)
SESSION_COOKIE_SECURE = False # Set True for HTTPS
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax' # Adjust as needed for cross-origin setups
Those are my settings in settings.py.
Here is my serializer:
class UserLogin(APIView):
permission_classes = (permissions.AllowAny,)
authentication_classes = (SessionAuthentication,)
def post(self, request):
data = request.data
# Validate data using a serializer
serializer = UserLoginSerializer(data=data)
if serializer.is_valid(raise_exception=True):
email = serializer.validated_data.get('email')
password = serializer.validated_data.get('password')
# Authenticate the user
user = authenticate(request, email=email, password=password)
if user is not None:
login(request, user)
return Response(
{
"message": "Login successful",
"user": {
"username": user.username,
/r/django
https://redd.it/1h7kvbb
I'm trying to authenticate with DRF so the user has to be logged in to hit the API endpoints I've set up, however I'm having logistical issues with it not accurately saving the cookie I guess?
CORS_ALLOWED_ORIGINS = [
'http://localhost:3000', # If your WordPress is running on port 3000
'http://127.0.0.1:3000', # For local development
'http://127.0.0.1:8000', # For local development]
CORS_ALLOW_CREDENTIALS = True
CSRF_TRUSTED_ORIGINS = ['https://*.fly.dev','http://localhost:3000','localhost','localhost:3000'] # <-- Updated!
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False # Set True for HTTPS
CSRF_COOKIE_HTTPONLY = False # Allows JavaScript access (needed if fetching manually)
CSRF_COOKIE_SAMESITE = 'None' # Adjust for your cross-origin setup
CSRF_COOKIE_DOMAIN = None # Matches the current domain (e.g., 127.0.0.1 or localhost)
SESSION_COOKIE_SECURE = False # Set True for HTTPS
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax' # Adjust as needed for cross-origin setups
Those are my settings in settings.py.
Here is my serializer:
class UserLogin(APIView):
permission_classes = (permissions.AllowAny,)
authentication_classes = (SessionAuthentication,)
def post(self, request):
data = request.data
# Validate data using a serializer
serializer = UserLoginSerializer(data=data)
if serializer.is_valid(raise_exception=True):
email = serializer.validated_data.get('email')
password = serializer.validated_data.get('password')
# Authenticate the user
user = authenticate(request, email=email, password=password)
if user is not None:
login(request, user)
return Response(
{
"message": "Login successful",
"user": {
"username": user.username,
/r/django
https://redd.it/1h7kvbb
Reddit
From the django community on Reddit
Explore this post and more from the django community
Friday Daily Thread: r/Python Meta and Free-Talk Fridays
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1h7nue4
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1h7nue4
Redditinc
Reddit Rules
Reddit Rules - Reddit
How Can Flask Help in Data-Related Roles?
Hi everyone,
I'm starting an internship in about three months as an Analytics Engineer. My mentor mentioned I'll be using Flask during the internship. I want to train and be fully prepared before I begin.
I have a few questions:
1. How does Flask help in data-related roles like mine?
2. What kind of resources should I explore to get better at Flask?
3. What types of projects should I try to build with Flask to improve my skills?
4. Do you have any ideas on where I can find project datasets or examples? I’ve checked Kaggle, but it doesn’t seem to have anything Flask-specific.
Thanks in advance for your suggestions and advice!
/r/flask
https://redd.it/1h5p7b9
Hi everyone,
I'm starting an internship in about three months as an Analytics Engineer. My mentor mentioned I'll be using Flask during the internship. I want to train and be fully prepared before I begin.
I have a few questions:
1. How does Flask help in data-related roles like mine?
2. What kind of resources should I explore to get better at Flask?
3. What types of projects should I try to build with Flask to improve my skills?
4. Do you have any ideas on where I can find project datasets or examples? I’ve checked Kaggle, but it doesn’t seem to have anything Flask-specific.
Thanks in advance for your suggestions and advice!
/r/flask
https://redd.it/1h5p7b9
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
JupyterLab 4.3 and Notebook 7.3 are available!
https://blog.jupyter.org/jupyterlab-4-3-and-notebook-7-3-are-available-eaaa7227d61b
/r/IPython
https://redd.it/1h7qu16
https://blog.jupyter.org/jupyterlab-4-3-and-notebook-7-3-are-available-eaaa7227d61b
/r/IPython
https://redd.it/1h7qu16
Medium
JupyterLab 4.3 and Notebook 7.3 are available!
JupyterLab 4.3.0 and Notebook 7.3.0 have been released! These new minor releases include many enhancements and bug fixes.
How we made Celery tasks bulletproof
Hey folks,
I just published a deep dive into how we handle task resilience at GitGuardian, where our Celery tasks scan GitHub PRs for secrets. Wanted to share some key learnings that might help others dealing with similar challenges.
**Key takeaways:**
1. Don’t just blindly retry tasks. Each type of failure (transient, resource limits, race conditions, code bugs ) needs its own handling strategy.
2. Crucial patterns we implemented:
- Ensure tasks are idempotent (may not be straightforward,
- Used `autoretry_for` with specific exceptions + backoff
- Implemented `acks_late` for process interruption protection
- Created separate queues for resource-heavy tasks
**Watch out for:**
1. Never set task_retry_on_worker_lost=True (can cause infinite retries)
2. With Redis, ensure tasks complete within visibility_timeout
3. Different behavior between prefork vs thread/gevent models for OOM handling
---
For those interested in the technical details: https://blog.gitguardian.com/celery-tasks-retries-errors/
What resilience patterns have you found effective in your Celery deployments? Any war stories about tasks going wrong in production?
/r/Python
https://redd.it/1h7xr6s
Hey folks,
I just published a deep dive into how we handle task resilience at GitGuardian, where our Celery tasks scan GitHub PRs for secrets. Wanted to share some key learnings that might help others dealing with similar challenges.
**Key takeaways:**
1. Don’t just blindly retry tasks. Each type of failure (transient, resource limits, race conditions, code bugs ) needs its own handling strategy.
2. Crucial patterns we implemented:
- Ensure tasks are idempotent (may not be straightforward,
- Used `autoretry_for` with specific exceptions + backoff
- Implemented `acks_late` for process interruption protection
- Created separate queues for resource-heavy tasks
**Watch out for:**
1. Never set task_retry_on_worker_lost=True (can cause infinite retries)
2. With Redis, ensure tasks complete within visibility_timeout
3. Different behavior between prefork vs thread/gevent models for OOM handling
---
For those interested in the technical details: https://blog.gitguardian.com/celery-tasks-retries-errors/
What resilience patterns have you found effective in your Celery deployments? Any war stories about tasks going wrong in production?
/r/Python
https://redd.it/1h7xr6s
GitGuardian Blog - Take Control of Your Secrets Security
A Deep Dive into Celery Task Resilience, Beyond Basic Retries
How to make your Celery tasks more resilient with best practices to prevent workflow interruptions and handle various failure scenarios.
pytest-fixture-forms - A new plugin to simplify testing parameter variations
Hey Python testing enthusiasts! I'm excited to share a pytest plugin I've been working on that makes testing different parameter variations much cleaner and more maintainable.
# What my project does
If you've ever found yourself writing lots of parametrized tests for different API inputs, credentials, or configuration combinations, you know it can get messy quickly. This plugin lets you organize these variations as fixture methods in a class, making your tests more structured and easier to maintain.
Here's a quick example:
class UserCredentials(FixtureForms):
@pytest.fixture
def valid_user(self):
return {"username": "john_doe", "password": "secure123"}
@pytest.fixture
def invalid_password(self):
return {"username": "john_doe", "password": "wrong"}
def test_login(user_credentials):
response = login_service.authenticate(**user_credentials.value)
if user_credentials.form == "valid_user":
assert response.status_code == 200
/r/Python
https://redd.it/1h7ztqd
Hey Python testing enthusiasts! I'm excited to share a pytest plugin I've been working on that makes testing different parameter variations much cleaner and more maintainable.
# What my project does
If you've ever found yourself writing lots of parametrized tests for different API inputs, credentials, or configuration combinations, you know it can get messy quickly. This plugin lets you organize these variations as fixture methods in a class, making your tests more structured and easier to maintain.
Here's a quick example:
class UserCredentials(FixtureForms):
@pytest.fixture
def valid_user(self):
return {"username": "john_doe", "password": "secure123"}
@pytest.fixture
def invalid_password(self):
return {"username": "john_doe", "password": "wrong"}
def test_login(user_credentials):
response = login_service.authenticate(**user_credentials.value)
if user_credentials.form == "valid_user":
assert response.status_code == 200
/r/Python
https://redd.it/1h7ztqd
Reddit
From the Python community on Reddit: pytest-fixture-forms - A new plugin to simplify testing parameter variations
Explore this post and more from the Python community
VCAT: Video Transcriber and Translator
# Have you ever wanted to share videos to your non bilingual friends? 🌎
Fear not because I (Claude) have made a noscript that does exactly that!
## What My Project Does ⚡
Type in a video URL along with the target language and the program will:
A) Download the media from the URL (Uses youtube-dlp so most websites are compatible)
B) Transcribe it (srt file output)
C) Translate it (srt file output)
D) Add subnoscripts using ffmpeg
All fully automated of course!
🔍 https://github.com/tikene/video-caption-and-translate - You can see some sample translations on my repo to get an idea of how the output video looks
## Target Audience 👥
If you have any friends who, for example, aren't fluent with English, you may have ran into some frustration when trying to share movies, videos or shows that you like. That's what motivated me to make this noscript, making it so you can easily share your interests and build human connections regardless of the language barrier (It's all about making the world a better place 💁♀️)
## Comparison 🔄
The projects I could find relating to this subject either:
- Don't accept URLs
- Don't work with long videos
- Don't add the subnoscripts directly to the video
-
/r/Python
https://redd.it/1h85e6v
# Have you ever wanted to share videos to your non bilingual friends? 🌎
Fear not because I (Claude) have made a noscript that does exactly that!
## What My Project Does ⚡
Type in a video URL along with the target language and the program will:
A) Download the media from the URL (Uses youtube-dlp so most websites are compatible)
B) Transcribe it (srt file output)
C) Translate it (srt file output)
D) Add subnoscripts using ffmpeg
All fully automated of course!
🔍 https://github.com/tikene/video-caption-and-translate - You can see some sample translations on my repo to get an idea of how the output video looks
## Target Audience 👥
If you have any friends who, for example, aren't fluent with English, you may have ran into some frustration when trying to share movies, videos or shows that you like. That's what motivated me to make this noscript, making it so you can easily share your interests and build human connections regardless of the language barrier (It's all about making the world a better place 💁♀️)
## Comparison 🔄
The projects I could find relating to this subject either:
- Don't accept URLs
- Don't work with long videos
- Don't add the subnoscripts directly to the video
-
/r/Python
https://redd.it/1h85e6v
GitHub
GitHub - tikene/video-caption-and-translate: Video URL transcriber and translator using AI. Download from Youtube and translate…
Video URL transcriber and translator using AI. Download from Youtube and translate automatically by adding subnoscripts to the video - tikene/video-caption-and-translate