We built a blockchain that lets you write smart contracts in NATIVE Python.
# What My Project Does
Hey everyone! We’ve been working on **Xian**, a blockchain where **you can write smart contracts natively in Python** instead of Solidity or Rust. This means Python developers can build decentralized applications (dApps) without learning new languages or dealing with complex virtual machines. I just wrote a post showing [how to write and test a smart contract in Python](https://in.mt/how-to-write-and-test-a-smart-contract-in-python-on-the-xian-blockchain) on Xian. If you’ve ever been curious about blockchain but didn’t want to dive into Solidity, this might be for you.
# Target Audiences
* Python developers interested in Web3 or blockchain but don’t want to learn Solidity.
* People curious about how blockchain works under the hood.
* Developers looking for **an easier way to write smart contracts** without switching to a new language.
# Comparison (How It’s Different)
* **Solidity/Rust vs Python:** Unlike Ethereum, where you must write contracts in Solidity, Xian lets you write them in **pure Python** and deploy them **without extra conversion layers**.
* **Faster Prototyping:** Since Python is widely used, Xian makes it easier to prototype and deploy blockchain applications.
* **Simpler Developer Experience:** No need for specialized compilers or bytecode conversion—just **write Python, deploy, and execute**.
# Links
* **Guide:** [How to Write and Test a Smart Contract
/r/Python
https://redd.it/1iscge8
# What My Project Does
Hey everyone! We’ve been working on **Xian**, a blockchain where **you can write smart contracts natively in Python** instead of Solidity or Rust. This means Python developers can build decentralized applications (dApps) without learning new languages or dealing with complex virtual machines. I just wrote a post showing [how to write and test a smart contract in Python](https://in.mt/how-to-write-and-test-a-smart-contract-in-python-on-the-xian-blockchain) on Xian. If you’ve ever been curious about blockchain but didn’t want to dive into Solidity, this might be for you.
# Target Audiences
* Python developers interested in Web3 or blockchain but don’t want to learn Solidity.
* People curious about how blockchain works under the hood.
* Developers looking for **an easier way to write smart contracts** without switching to a new language.
# Comparison (How It’s Different)
* **Solidity/Rust vs Python:** Unlike Ethereum, where you must write contracts in Solidity, Xian lets you write them in **pure Python** and deploy them **without extra conversion layers**.
* **Faster Prototyping:** Since Python is widely used, Xian makes it easier to prototype and deploy blockchain applications.
* **Simpler Developer Experience:** No need for specialized compilers or bytecode conversion—just **write Python, deploy, and execute**.
# Links
* **Guide:** [How to Write and Test a Smart Contract
/r/Python
https://redd.it/1iscge8
A drum machine and 16-step sequencer
# Background
I am posting a series of Python scripts that demonstrate using Supriya, a Python API for SuperCollider, in a dedicated subreddit. Supriya makes it possible to create synthesizers, sequencers, drum machines, and music, of course, using Python.
All demos are posted here: r/supriya\_python.
The code for all demos can be found in this GitHub repo.
These demos assume knowledge of the Python programming language. They do not teach how to program in Python. Therefore, an intermediate level of experience with Python is required.
# The demo
In the latest demo, I show how to create a drum machine with a 16-step sequencer. Much of the post is dedicated to discussing the various design-related decisions that must be made when creating a step sequencer. Please give the demo script a try and let me know what you think.
/r/Python
https://redd.it/1iscyp4
# Background
I am posting a series of Python scripts that demonstrate using Supriya, a Python API for SuperCollider, in a dedicated subreddit. Supriya makes it possible to create synthesizers, sequencers, drum machines, and music, of course, using Python.
All demos are posted here: r/supriya\_python.
The code for all demos can be found in this GitHub repo.
These demos assume knowledge of the Python programming language. They do not teach how to program in Python. Therefore, an intermediate level of experience with Python is required.
# The demo
In the latest demo, I show how to create a drum machine with a 16-step sequencer. Much of the post is dedicated to discussing the various design-related decisions that must be made when creating a step sequencer. Please give the demo script a try and let me know what you think.
/r/Python
https://redd.it/1iscyp4
Reddit
r/supriya_python
A place to learn and share information about Supriya, the Python API for SuperCollider.
Greenlets in a post GIL world
I've been following the release of the optional disable GIL feature of Python 3.13 and wonder if it'll make any sense to use plain Python threads for CPU bound tasks?
I have a flask app on gunicorn with 1 CPU intensive task that sometimes squeezes out I/O traffic from the application. I used a greenlet for the CPU task but even so, adding yields all over the place complicated the code and still created holes where the greenlet simply didn't let go of the silicon.
I finally just launched a multiprocess for the task and while everyone is happy I had to make some architectural changes in the application to make data churned out in the CPU intensive process available to the base flask app.
So if I can instead turn off yet GIL and launch this CPU task as a thread will it work better than a greenlet that might not yield under certain load patterns?
/r/Python
https://redd.it/1is6amk
I've been following the release of the optional disable GIL feature of Python 3.13 and wonder if it'll make any sense to use plain Python threads for CPU bound tasks?
I have a flask app on gunicorn with 1 CPU intensive task that sometimes squeezes out I/O traffic from the application. I used a greenlet for the CPU task but even so, adding yields all over the place complicated the code and still created holes where the greenlet simply didn't let go of the silicon.
I finally just launched a multiprocess for the task and while everyone is happy I had to make some architectural changes in the application to make data churned out in the CPU intensive process available to the base flask app.
So if I can instead turn off yet GIL and launch this CPU task as a thread will it work better than a greenlet that might not yield under certain load patterns?
/r/Python
https://redd.it/1is6amk
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Efficient Python Programming: A Guide to Threads and Multiprocessing
🚀 Want to speed up your Python code? This video dives into threads vs. multiprocessing, explaining when to use each for maximum efficiency. Learn how to handle CPU-bound and I/O-bound tasks, avoid common pitfalls like the GIL, and boost performance with parallelism. Whether you're optimizing scripts or building scalable apps, this guide has you covered!
🔗 Watch here: https://www.youtube.com/watch?v=BfwQs1sEW7I&t=485s
💬 Got questions or tips? Drop them in the comments!
/r/Python
https://redd.it/1irl4ap
🚀 Want to speed up your Python code? This video dives into threads vs. multiprocessing, explaining when to use each for maximum efficiency. Learn how to handle CPU-bound and I/O-bound tasks, avoid common pitfalls like the GIL, and boost performance with parallelism. Whether you're optimizing scripts or building scalable apps, this guide has you covered!
🔗 Watch here: https://www.youtube.com/watch?v=BfwQs1sEW7I&t=485s
💬 Got questions or tips? Drop them in the comments!
/r/Python
https://redd.it/1irl4ap
YouTube
Efficient Python Programming: A Guide to Threads and Multiprocessing
Python
Concurrency
Threads
Multiprocessing
Parallel Programming
Python Tutorial
Performance Optimization
Multithreading
Python 3
Async Programming
Coding Tips
Software Development
Data Processing
Python Concurrency
Parallelism
Programming
Python Development…
Concurrency
Threads
Multiprocessing
Parallel Programming
Python Tutorial
Performance Optimization
Multithreading
Python 3
Async Programming
Coding Tips
Software Development
Data Processing
Python Concurrency
Parallelism
Programming
Python Development…
Django + Caddy in Docker Compose?
Does anyone have an example of a production ready docker compose for django with caddy as a reverse proxy ? an example of a compose file and a caddyfile would be so helpful :D
/r/django
https://redd.it/1isexe4
Does anyone have an example of a production ready docker compose for django with caddy as a reverse proxy ? an example of a compose file and a caddyfile would be so helpful :D
/r/django
https://redd.it/1isexe4
Reddit
From the django community on Reddit
Explore this post and more from the django community
Startup
Hello. I’m building a web app using Django to offer telehealth services in my country. Any tips that could help will be greatly appreciated.
In the meantime, I’m hoping to get help with the FrontEnd since I’ve only learnt backend with a little css and JavaScript.
/r/django
https://redd.it/1isnz2w
Hello. I’m building a web app using Django to offer telehealth services in my country. Any tips that could help will be greatly appreciated.
In the meantime, I’m hoping to get help with the FrontEnd since I’ve only learnt backend with a little css and JavaScript.
/r/django
https://redd.it/1isnz2w
Reddit
From the django community on Reddit
Explore this post and more from the django community
Django deploy on DigitalOcean App launcher
Hi I am i am having problems, when I try to launch my app on DigitalOcean.
I keep getting Cookie “\_\_cf\_bm” has been rejected for invalid domain.
When I try to launch my app.
This this is my settings:
SESSION\_COOKIE\_DOMAIN\_DYNAMIC = \['oyster-app-xj275.ondigitalocean.app', '\*'\]
MIDDLEWARE = \[
"django.middleware.security.SecurityMiddleware",
'whitenoise.middleware.WhiteNoiseMiddleware',
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
'cookie\_consent.middleware.CleanCookiesMiddleware'
\]
ALLOWED_HOSTS = ['XXXXX.ondigitalocean.app', '*']
And it does not render anything.
I dont understand if why it is not working.... It works fine locally....
/r/django
https://redd.it/1ism2ne
Hi I am i am having problems, when I try to launch my app on DigitalOcean.
I keep getting Cookie “\_\_cf\_bm” has been rejected for invalid domain.
When I try to launch my app.
This this is my settings:
SESSION\_COOKIE\_DOMAIN\_DYNAMIC = \['oyster-app-xj275.ondigitalocean.app', '\*'\]
MIDDLEWARE = \[
"django.middleware.security.SecurityMiddleware",
'whitenoise.middleware.WhiteNoiseMiddleware',
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
'cookie\_consent.middleware.CleanCookiesMiddleware'
\]
ALLOWED_HOSTS = ['XXXXX.ondigitalocean.app', '*']
And it does not render anything.
I dont understand if why it is not working.... It works fine locally....
/r/django
https://redd.it/1ism2ne
Reddit
From the django community on Reddit
Explore this post and more from the django community
MicroPie 0.9.9.3 Released
This week I released version 0.9.9.3 of my (optionally) single file ASGI "ultra-micro" framework, MicroPie.
This release introduces many new things since the last time I announced a release on here about 4 weeks ago... We now have the ability to implement custom session backends like
MicroPie's Key Features
- 🔄 Routing: Automatic mapping of URLs to functions with support for dynamic and query parameters.
- 🔒 Sessions: Simple, plugable, session management using cookies.
- 🎨 Templates: Jinja2, if installed, for rendering dynamic HTML pages.
- ⚙️ Middleware: Support for custom request middleware enabling functions like rate limiting, authentication, logging, and more.
- ✨ ASGI-Powered: Built w/ asynchronous support for modern web servers like Uvicorn and Daphne, enabling high concurrency.
- 🛠️ Lightweight Design: Minimal dependencies for faster development and deployment.
- ⚡ Blazing Fast: Checkout the benchmarks.
This is an alpha release. Please file issues/requests as you encounter them! Thank you!
/r/Python
https://redd.it/1iso1bl
This week I released version 0.9.9.3 of my (optionally) single file ASGI "ultra-micro" framework, MicroPie.
This release introduces many new things since the last time I announced a release on here about 4 weeks ago... We now have the ability to implement custom session backends like
aioredis and motor using the SessionBackend class. We also have introduced middleware so you can hook into incoming requests. Check out the source code, a ton of examples and documentation on GitHub.MicroPie's Key Features
- 🔄 Routing: Automatic mapping of URLs to functions with support for dynamic and query parameters.
- 🔒 Sessions: Simple, plugable, session management using cookies.
- 🎨 Templates: Jinja2, if installed, for rendering dynamic HTML pages.
- ⚙️ Middleware: Support for custom request middleware enabling functions like rate limiting, authentication, logging, and more.
- ✨ ASGI-Powered: Built w/ asynchronous support for modern web servers like Uvicorn and Daphne, enabling high concurrency.
- 🛠️ Lightweight Design: Minimal dependencies for faster development and deployment.
- ⚡ Blazing Fast: Checkout the benchmarks.
This is an alpha release. Please file issues/requests as you encounter them! Thank you!
/r/Python
https://redd.it/1iso1bl
GitHub
GitHub - patx/micropie: MicroPie is an ultra-micro ASGI Python web framework that gets out of your way.
MicroPie is an ultra-micro ASGI Python web framework that gets out of your way. - patx/micropie
Urgent help
Im trying to make a website using Flask. This website has a linked database with SQLlite. Im trying to make an attendance feature with the for the website. The website will be used to record people attending a club. Ideally I would like the user to be able to see a list of checkboxes and just be able to tick who has attended the meeting. Im struggling to work out how to get my user data (store in my database) into my html file to make the attendance register. Any help would be greatly appreciated
/r/flask
https://redd.it/1isks26
Im trying to make a website using Flask. This website has a linked database with SQLlite. Im trying to make an attendance feature with the for the website. The website will be used to record people attending a club. Ideally I would like the user to be able to see a list of checkboxes and just be able to tick who has attended the meeting. Im struggling to work out how to get my user data (store in my database) into my html file to make the attendance register. Any help would be greatly appreciated
/r/flask
https://redd.it/1isks26
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Issue with Deploying Heavy Flask App on AWS Lightsail Containers
Hi everyone,
I’ve built a Flask-based web app for backtesting and optimising trading strategies using ML. It’s quite CPU- and memory-intensive, as it loads large datasets, runs calculations, and outputs results.
My Docker setup looks like this:
🔹 App container (Flask)
🔹 Redis container (for caching & Celery tasks)
🔹 Celery container (for background task execution)
🔹 Nginx container (reverse proxy)
The app runs fine on a standard server, but I’ve struggled to deploy it using AWS Lightsail containers. The main issue is that the containers randomly shut down, and logs don’t provide any useful error messages. Even when I scale up resources (CPU/RAM), the issue persists.
I’d love to hear from anyone who has experienced similar issues or has suggestions on:
1. Debugging container shutdowns on Lightsail (how to get better logs?)
2. Optimising Docker deployments for memory-heavy apps
3. Alternative hosting solutions if Lightsail isn’t a good fit
Any insights would be super helpful! Thanks in advance. 🚀
Tech Stack: Python | Flask | Celery | Redis | Docker | Lightsail
/r/flask
https://redd.it/1isccnk
Hi everyone,
I’ve built a Flask-based web app for backtesting and optimising trading strategies using ML. It’s quite CPU- and memory-intensive, as it loads large datasets, runs calculations, and outputs results.
My Docker setup looks like this:
🔹 App container (Flask)
🔹 Redis container (for caching & Celery tasks)
🔹 Celery container (for background task execution)
🔹 Nginx container (reverse proxy)
The app runs fine on a standard server, but I’ve struggled to deploy it using AWS Lightsail containers. The main issue is that the containers randomly shut down, and logs don’t provide any useful error messages. Even when I scale up resources (CPU/RAM), the issue persists.
I’d love to hear from anyone who has experienced similar issues or has suggestions on:
1. Debugging container shutdowns on Lightsail (how to get better logs?)
2. Optimising Docker deployments for memory-heavy apps
3. Alternative hosting solutions if Lightsail isn’t a good fit
Any insights would be super helpful! Thanks in advance. 🚀
Tech Stack: Python | Flask | Celery | Redis | Docker | Lightsail
/r/flask
https://redd.it/1isccnk
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Wednesday Daily Thread: Beginner questions
# Weekly Thread: Beginner Questions 🐍
Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.
## How it Works:
1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.
## Guidelines:
This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).
## Recommended Resources:
If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
## Example Questions:
1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?
Let's help each other learn Python! 🌟
/r/Python
https://redd.it/1isrcry
# Weekly Thread: Beginner Questions 🐍
Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.
## How it Works:
1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.
## Guidelines:
This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).
## Recommended Resources:
If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
## Example Questions:
1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?
Let's help each other learn Python! 🌟
/r/Python
https://redd.it/1isrcry
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
Is UV package manager taking over?
Hi!
I am a devops engineer and notice developers talking about uv package manager. I used it today for the first time and loved it. It seems like everyone is talking to agrees. Does anyone have and cons for us package manager?
/r/Python
https://redd.it/1isv37n
Hi!
I am a devops engineer and notice developers talking about uv package manager. I used it today for the first time and loved it. It seems like everyone is talking to agrees. Does anyone have and cons for us package manager?
/r/Python
https://redd.it/1isv37n
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
New version FastAPI Guard + Redis - A FastAPI extension to secure your APIs
Original post
I'm happy to tell you I've just released a new version (1.0.0) of FastAPI Guard - this time with Redis Integration and some other upgrades :)
Take a look at the docs & repo:
Documentation: rennf93.github.io/fastapi-guard/
GitHub repo: github.com/rennf93/fastapi-guard
# Important note
The new version allows you to persist ip bans, rate limits, and more, across workers of a single application and/or other applications. Now you can have a single source of truth thanks to this integration of Redis into FastAPI Guard.
If you've already came across or read the previous post, you might want to skip the following text as it's mostly the same.
---
What is it?
FastAPI Guard is a security middleware for FastAPI that provides:
- Redis Integration (new!)
- IP whitelisting/blacklisting
- Rate limiting & automatic IP banning
- Penetration attempt detection
- Cloud provider IP blocking
- IP geolocation via IPInfo.io
- Custom security logging
- CORS configuration helpers
It's licensed under MIT and integrates seamlessly with FastAPI applications.
Comparison to alternatives:
-
-
-
-
Key differentiators:
- Combines multiple security layers in single middleware
- Automatic IP banning based on suspicious activity
- Built-in cloud
/r/Python
https://redd.it/1isqf8y
Original post
I'm happy to tell you I've just released a new version (1.0.0) of FastAPI Guard - this time with Redis Integration and some other upgrades :)
Take a look at the docs & repo:
Documentation: rennf93.github.io/fastapi-guard/
GitHub repo: github.com/rennf93/fastapi-guard
# Important note
The new version allows you to persist ip bans, rate limits, and more, across workers of a single application and/or other applications. Now you can have a single source of truth thanks to this integration of Redis into FastAPI Guard.
If you've already came across or read the previous post, you might want to skip the following text as it's mostly the same.
---
What is it?
FastAPI Guard is a security middleware for FastAPI that provides:
- Redis Integration (new!)
- IP whitelisting/blacklisting
- Rate limiting & automatic IP banning
- Penetration attempt detection
- Cloud provider IP blocking
- IP geolocation via IPInfo.io
- Custom security logging
- CORS configuration helpers
It's licensed under MIT and integrates seamlessly with FastAPI applications.
Comparison to alternatives:
-
fastapi-security: Focuses more on authentication, while FastAPI Guard provides broader network-layer protection-
slowapi: Handles rate limiting but lacks IP analysis/geolocation features-
fastapi-limiter: Pure rate limiting without security features-
fastapi-auth: Authentication-focused without IP managementKey differentiators:
- Combines multiple security layers in single middleware
- Automatic IP banning based on suspicious activity
- Built-in cloud
/r/Python
https://redd.it/1isqf8y
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
open source code for translating Chinese in the image into Korean?
I found the function to remove text from an image through a web search. With the lama cleaner, you can use the image inpainting function reliably and quickly, but I'm asking because I want to add additional features. You can translate text and type the text directly, or you can automatically cover the image with a translated text just like the texture of the background. And I wish I could edit the text myself. Please give me some sources or address that I can recommend.
# 🔍 Image Text Editing and Translation Query
I discovered an image text removal function through web searching ✨. While the Lama Cleaner's image inpainting function works reliably and quickly, I'm looking to add some additional features 🛠️:
1. 🌐 Text translation capabilities:
📝 Direct text input functionality
🎨 Automatic background-matching text overlay with translations
2. ✏️ Custom text editing features:
🔧 Ability to manually edit and customize text
🎯 Personal text modification options
I would appreciate recommendations for relevant resources or references that could help implement these features 📚.
/r/flask
https://redd.it/1iswknk
I found the function to remove text from an image through a web search. With the lama cleaner, you can use the image inpainting function reliably and quickly, but I'm asking because I want to add additional features. You can translate text and type the text directly, or you can automatically cover the image with a translated text just like the texture of the background. And I wish I could edit the text myself. Please give me some sources or address that I can recommend.
# 🔍 Image Text Editing and Translation Query
I discovered an image text removal function through web searching ✨. While the Lama Cleaner's image inpainting function works reliably and quickly, I'm looking to add some additional features 🛠️:
1. 🌐 Text translation capabilities:
📝 Direct text input functionality
🎨 Automatic background-matching text overlay with translations
2. ✏️ Custom text editing features:
🔧 Ability to manually edit and customize text
🎯 Personal text modification options
I would appreciate recommendations for relevant resources or references that could help implement these features 📚.
/r/flask
https://redd.it/1iswknk
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Have you needed to reach for Django?
I’m pretty new to web development with Python and got started with Flask. I like working with it a lot; its lack of how opinionated it is and less moving parts makes spinning something up really easy for the simple things I’ve built with it, though I could see how less structure may even be seen as a downside depending on how you look at it.
But recently I’m seeing signs pointing me to build websites with Django. Updates get released more frequently, more people use it, there’s good ORM/database support, authentication, a robust admin console… but that’s kind of it. In some building with it how opinionated it is especially compared to Flask has bogged me down in terms of productivity. Admittedly these are fairly simple projects I’ve built so far. I’m finding myself working against it and learning how to use it rather than actually using it. On the other hand building with Flask seems to be more productive since I find building and learning in-parallel to be much easier than in Django.
Right now I’m trying to build something similar to Craigslist but with a twist as mostly a learning exercise but also to see if it can take
/r/flask
https://redd.it/1ir4toh
I’m pretty new to web development with Python and got started with Flask. I like working with it a lot; its lack of how opinionated it is and less moving parts makes spinning something up really easy for the simple things I’ve built with it, though I could see how less structure may even be seen as a downside depending on how you look at it.
But recently I’m seeing signs pointing me to build websites with Django. Updates get released more frequently, more people use it, there’s good ORM/database support, authentication, a robust admin console… but that’s kind of it. In some building with it how opinionated it is especially compared to Flask has bogged me down in terms of productivity. Admittedly these are fairly simple projects I’ve built so far. I’m finding myself working against it and learning how to use it rather than actually using it. On the other hand building with Flask seems to be more productive since I find building and learning in-parallel to be much easier than in Django.
Right now I’m trying to build something similar to Craigslist but with a twist as mostly a learning exercise but also to see if it can take
/r/flask
https://redd.it/1ir4toh
Reddit
[deleted by user] : r/flask
91K subscribers in the flask community. Flask is a Python micro-framework for web development. Flask is easy to get started with and a great way to build websites and web applications.
programming buddy
anybody wanna collab on projects and things of that nature? i literally dont know anybody who codes in real life its just me.
/r/Python
https://redd.it/1isw93f
anybody wanna collab on projects and things of that nature? i literally dont know anybody who codes in real life its just me.
/r/Python
https://redd.it/1isw93f
Reddit
From the Python community on Reddit: programming buddy
Posted by AMIRIASPIRATIONS48 - 8 votes and 14 comments
R The Curse of Depth in LLMs: Why Are Deep Layers Less Effective?
Recent research is shedding light on an unexpected problem in modern large language models, the deeper layers aren’t pulling their weight.
A recent paper, "The Curse of Depth in Large Language Models", highlights a critical issue:
\- Deep layers in LLMs contribute significantly less to learning than earlier ones.
\- Many of these layers can be pruned without serious performance loss, raising questions about training efficiency.
\- The culprit? Pre-Layer Normalization (Pre-LN), which causes output variance to explode in deeper layers, making them act almost like identity functions.
\- A simple fix? LayerNorm Scaling, which controls this variance and improves training efficiency.
This has major implications for LLM architecture, training efficiency, and scaling laws. If half the layers in models like LLaMA, Mistral, and DeepSeek aren’t contributing effectively, how much computational waste are we dealing with?
Key questions for discussion:
1️) Should we be rethinking deep-layer training strategies to improve efficiency?
2️) Does this impact the assumption that deeper = better in transformer architectures?
3️) Could insights from this paper help with LLM compression, fine-tuning, or distillation techniques?
Paper link: arXiv preprint: 2502.05795v1
Let’s discuss—what are your thoughts on the Curse of Depth?
/r/MachineLearning
https://redd.it/1isu1nn
Recent research is shedding light on an unexpected problem in modern large language models, the deeper layers aren’t pulling their weight.
A recent paper, "The Curse of Depth in Large Language Models", highlights a critical issue:
\- Deep layers in LLMs contribute significantly less to learning than earlier ones.
\- Many of these layers can be pruned without serious performance loss, raising questions about training efficiency.
\- The culprit? Pre-Layer Normalization (Pre-LN), which causes output variance to explode in deeper layers, making them act almost like identity functions.
\- A simple fix? LayerNorm Scaling, which controls this variance and improves training efficiency.
This has major implications for LLM architecture, training efficiency, and scaling laws. If half the layers in models like LLaMA, Mistral, and DeepSeek aren’t contributing effectively, how much computational waste are we dealing with?
Key questions for discussion:
1️) Should we be rethinking deep-layer training strategies to improve efficiency?
2️) Does this impact the assumption that deeper = better in transformer architectures?
3️) Could insights from this paper help with LLM compression, fine-tuning, or distillation techniques?
Paper link: arXiv preprint: 2502.05795v1
Let’s discuss—what are your thoughts on the Curse of Depth?
/r/MachineLearning
https://redd.it/1isu1nn
arXiv.org
The Curse of Depth in Large Language Models
In this paper, we introduce the Curse of Depth, a concept that highlights, explains, and addresses the recent observation in modern Large Language Models (LLMs) where nearly half of the layers are...
React-native Expo Fetch, Network request failed. On android Flask Api
# Problem
I have a React Native Expo application where I successfully call my Node.js API using my local IP. The API works both in the emulator and on my physical Android device. However, when I try to call my Flask API, I get a Network Request Failed error.
I am running my Flask app on my local machine (
# Flask API (Python)
Here’s my Flask app, which is a simple speech transcription API. It receives an audio file in base64 format, decodes it, and transcribes it using
from flask import Flask, request, jsonify
import base64
import tempfile
import speechrecognition as sr
from pydub import AudioSegment
from io import BytesIO
from flaskcors import CORS
import logging
app = Flask(name)
CORS(app, resources={r"/": {"origins": ""}}) # Allow all CORS requests
logging.basicConfig(level=logging.DEBUG)
def transcribeaudio(audiobase64):
try:
/r/flask
https://redd.it/1it221j
# Problem
I have a React Native Expo application where I successfully call my Node.js API using my local IP. The API works both in the emulator and on my physical Android device. However, when I try to call my Flask API, I get a Network Request Failed error.
I am running my Flask app on my local machine (
http://192.168.x.x:5000), and my physical Android device is connected to the same WiFi network.# Flask API (Python)
Here’s my Flask app, which is a simple speech transcription API. It receives an audio file in base64 format, decodes it, and transcribes it using
speech_recognition.from flask import Flask, request, jsonify
import base64
import tempfile
import speechrecognition as sr
from pydub import AudioSegment
from io import BytesIO
from flaskcors import CORS
import logging
app = Flask(name)
CORS(app, resources={r"/": {"origins": ""}}) # Allow all CORS requests
logging.basicConfig(level=logging.DEBUG)
def transcribeaudio(audiobase64):
try:
/r/flask
https://redd.it/1it221j
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
logging.getLevelName(): Are you serious?
I was looking for a function that would return the numerical value of a loglevel given as text. But I found only the reverse function per the documentation:
>logging.getLevelName(level) Returns the textual or numeric representation of logging level level.
That's exactly the reverse of what I need. But wait, there's more:
>The level parameter also accepts a string representation of the level such as ‘INFO’. In such cases, this functions returns the corresponding numeric value of the level.
So a function that maps integers to strings, with a name that clearly implies that it returns strings, also can map strings to integers if you pass in a string. A function whose return type depends on the input type, neat!
OK, so what happens when you pass in a value that has no number / name associated with it? Surely the function will return zero or raise a KeyError. But no:
>If no matching numeric or string value is passed in, the string ‘Level %s’ % level is returned.
Fantastic! If I pass a string into a function called "get..Name()" it will return an integer on success and a string on failure!
But somebody, at some point, a sane person noticed that this is a mess:
>Changed in version 3.4:
/r/Python
https://redd.it/1it29oi
I was looking for a function that would return the numerical value of a loglevel given as text. But I found only the reverse function per the documentation:
>logging.getLevelName(level) Returns the textual or numeric representation of logging level level.
That's exactly the reverse of what I need. But wait, there's more:
>The level parameter also accepts a string representation of the level such as ‘INFO’. In such cases, this functions returns the corresponding numeric value of the level.
So a function that maps integers to strings, with a name that clearly implies that it returns strings, also can map strings to integers if you pass in a string. A function whose return type depends on the input type, neat!
OK, so what happens when you pass in a value that has no number / name associated with it? Surely the function will return zero or raise a KeyError. But no:
>If no matching numeric or string value is passed in, the string ‘Level %s’ % level is returned.
Fantastic! If I pass a string into a function called "get..Name()" it will return an integer on success and a string on failure!
But somebody, at some point, a sane person noticed that this is a mess:
>Changed in version 3.4:
/r/Python
https://redd.it/1it29oi
Python documentation
logging — Logging facility for Python
Source code: Lib/logging/__init__.py Important: This page contains the API reference information. For tutorial information and discussion of more advanced topics, see Basic Tutorial, Advanced Tutor...
What’s a Django Package That Doesn’t Exist Yet, But You Wish It Did?
Hey fellow Django devs,
I’ve been thinking a lot about how powerful Django is, but sometimes there’s something missing that could make our lives a whole lot easier.
So I wanted to ask:
What’s a Django package you wish existed, but doesn’t yet?
It could be anything—something that solves a common problem or just makes development smoother. No matter how big or small, if you could create the perfect Django package to fill a gap in the ecosystem, what would it be?
/r/django
https://redd.it/1it4z6o
Hey fellow Django devs,
I’ve been thinking a lot about how powerful Django is, but sometimes there’s something missing that could make our lives a whole lot easier.
So I wanted to ask:
What’s a Django package you wish existed, but doesn’t yet?
It could be anything—something that solves a common problem or just makes development smoother. No matter how big or small, if you could create the perfect Django package to fill a gap in the ecosystem, what would it be?
/r/django
https://redd.it/1it4z6o
Reddit
From the django community on Reddit
Explore this post and more from the django community