I wrote this simple script to analyze python files.
### What my project does
It's a simple utility script which allows you to analyze your python file. It provides simple detailed insights into the structure and composition of Python code, including information about functions, classes, imports, variables, and function calls.
### Target Audience
Honestly, this is just a fun project
### Comparison
N/A
#### Link to the project
/r/Python
https://redd.it/1el7xyf
Are there patterns for receiveing emails within app?
I have no intention of sending emails on my own, I use SES for that, but sometimes it would be convenient if my app could receive emails, e.g. users could reply to messages by replying to email instead of going to app to write message, etc.
So, are there any ways to implement receiving emails using pure python in my flask app? Maybe some type of webhook solution?
I don't want to deal with Postfix or the likes, nor do i want to integrate with an external email provider, so with these reqiurements maybe the answer is no, not possible.
/r/flask
https://redd.it/1eknuqj
Tool: quickly find the strptime/strftime format code for your date
I appreciate the various strftime cheat sheets floating around online but I've been wanting a tool that'll do the datetime format string construction automatically for a given date/datetime.
So I made a tool to do this: https://pym.dev/strptime
It has a few not-so-obvious features as well. More details in this post, if you're curious.
/r/Python
https://redd.it/1ekv35s
I made a quick-start template for Flask apps called Create Flask App
Hey everyone!
I made this project called Create Flask App to help you quickly set up and scale your Flask applications. It comes with user authentication (register, login, logout), profile management, and a basic admin page, all styled with Bootstrap 5.3.3. By default, it uses SQLite3, but you can easily configure it to use your preferred database.
Check it out, give it a star if you like it, and let me know what features you'd love to see next and/or feel free to contribute. Your feedback and suggestions would be awesome!
I will keep working on it, adding new features and improvements.
👉 Create Flask App on GitHub
Thanks for checking it out!
/r/flask
https://redd.it/1ekjvap
PyAwaitable: An ideal way to define asynchronous logic in C extensions
I've put this idea through a number of discussions (namely, this one and this one) about adding capability to the C API directly to call asynchronous Python code, and I'm officially releasing my reference implementation as a library, per request from the core devs!
## What My Project Does
Put simply, PyAwaitable lets you write and run asynchronous Python functions, from pure C code!
## Target Audience
This project is intended towards those who care a lot about Python performance, or develop C extensions.
## Comparison
As of writing, there are no other libraries that do this. The answer for asynchronous C code has always been: you can't (without a lot of effort, at least -- too much effort for it to be effective).
Most people will defer async logic to a non-async function (think loop.run_until_complete
, and friends), and then call that from C.
## Installation
I've developed a stable version, which you can either install off PyPI, or vendor into your project off the releases page: https://github.com/ZeroIntensity/pyawaitable
Feedback, positive or negative, would be appreciated!
/r/Python
https://redd.it/1ekpk4c
Saleor vs Oscar Ecommerce
Hi,
I am currently assessing refactoring a custom lightweight marketplace app built with Nuxt to a proper backend (read Django) to address some of the core pain points usually faced with JS applications (incompatibility between packages, lack of included "batteries", time intensive development etc.)
Saleor and Oscar are the most popular options in the Django ecosystem and I was wondering if people had any experience using one or the other? And what was the overall guideline regarding their usage?
Cheers
/r/django
https://redd.it/1ekklgc
What Python skills are in demand?
Hello Everyone! As technology keeps evolving, so does the need for certain programming skills. If you're already working with Python or thinking about starting, what do you think are the most valuable Python skills in today's job market? Are there any specific libraries, frameworks, or areas where Python is becoming a must-know? Please let me know what's trending and crucial for Python developers to learn and master!
/r/Python
https://redd.it/1ekhfp4
Limitations of subprocess
?
Are there any limitations as to what `subprocess` can't do or tools that are known to be incompatible with subprocesses?
I am looking to build an IDE that uses subprocesses to launch code in different environments.
For example, I know it is possible for a subprocess to spawn subprocesses.
However, I don't want to get 100 hours into development only to realize something hypothetical like "oh sqlite connections don't support suprocesses" or "you can't spawn [multithreading/multiprocessing\] from subprocess"
/r/Python
https://redd.it/1ek3vxc
Scheduled task
I’ve got some basic flask apps under my belt. But nothing too advanced. I know my projects aren’t set up properly, since it’s based on the basic flask intro tutorial.
I’m planning on building a flask project for one of my clubs to run a giveaway next July. I’d like do pull names / contact info from an API, and every 30 minutes on the day of the giveaway select and text winners from entries submitted since the prior winner selection. I’ve never done anything with scheduled or background tasks.
/r/flask
https://redd.it/1ek6xnj
[P] Direct Preference Optimization (DPO) for LLM Alignment From Scratch [Jupyter Notebook]
https://github.com/rasbt/LLMs-from-scratch/blob/main/ch07/04_preference-tuning-with-dpo/dpo-from-scratch.ipynb
/r/MachineLearning
https://redd.it/1ejwg9n
Django Rest Framework vs Django Ninja for Api?
whats the difference between 2 and which one to choose for api development
/r/django
https://redd.it/1ejr7qj
[D] Calculating the Cost of a Google Deepmind Paper
https://152334h.github.io/blog/scaling-exponents/
/r/MachineLearning
https://redd.it/1ej5h4b
Sideways Shooter game in Python. Python Crash Course, 3nd Edition.
Hi,
I'm new to programming and decided to pick up Python as first language. I recently completed Python Crash Course by Eric Matthes, and I must say it was a fantastic book.
I had so much fun creating the Alien Invasion game that I ended up making four variations of it.
I'm now moving on to Dead Simple Python to develop my skills while doing some solo projects.
If anyone is interested, you can check out the games I made here:
https://github.com/E-Rinaudo/first\_solo\_projects/tree/main/solo\_projects/games
Happy coding!
/r/Python
https://redd.it/1ejbvpj
How to handle Blog data
Hey I've been following miguels tutorial and have a few questions:
What is the best way to handle blog data? I want to write multi page articles with gifs / images if possible. I have 2 ideas on how to handle this and wondering what is the generally accepted practice:
1. Create blog table with TEXT as field. Not sure how well it handles formatting like newline characters / whitespace etc. Requires me to then create a form / url and have to be logged into the website to write the articles. Probably easiest solution?
2. Create a directory with markdown files for my articles and have a blog table track the file location and meta data. This means I can write them in markdown somewhere else and don't need to make another form / url for writing them. Issue is how do i keep my db in sync with the blog, if the file names change, meta data changes, etc. Also how would i add new articles once the website it deployed? Copy paste somehow from my local machine to the server?
3. Another way?
Last question, how does rendering markdown work in the browser? Do i have any control over the
/r/flask
https://redd.it/1eiknlx
Is Learning Django REST Framework (DRF) Worth It?
I've recently started learning Django REST Framework (DRF), and I've noticed that many methods need to be overridden for even simple tasks. This made me wonder, why can't we just create APIs using Django itself? Is creating APIs using Django insecure or what?
I'd love to hear from the community about this. Is DRF worth the extra effort? What are the main advantages of DRF over Django for API development? Any insights or experiences would be greatly appreciated!
Thanks in advance!
/r/django
https://redd.it/1ejmz25
Inventory Management for an Antiques Company with Django and Shopify Integration
Hey everyone!
I'm thrilled to share my experience with my 5th Django project for a real client. This time, I worked with an antiques company to build a robust inventory management system integrated with Shopify.
The project revolved around using webhooks from Shopify to keep the inventory up-to-date and QR codes for quick verification of product locations in the warehouse. One of the key challenges was managing products without bin locations. Initially, products without a specified bin location caused inventory discrepancies. To address this, I adjusted the data queries to handle blank spaces and cleaned the data when importing from CSVs to ensure accurate registration of all products.
Another challenge was seamlessly integrating with Shopify's API and implementing QR code functionality. Shopify's API was quite flexible, which made the integration smoother. I used a Python library to generate and read QR codes, allowing for fast and accurate product verification. This significantly reduced human errors and saved a lot of time.
The app's interface was optimized for use on tablets, enabling employees to move freely around the warehouse while checking inventory. This mobility greatly enhanced the efficiency and accuracy of inventory management.
Working on this real project for a real client was incredibly rewarding. Each project
/r/django
https://redd.it/1ekxpcl
I am getting an error in forms.py specifically the function in functions.py. Put simply the login function form query for the username and email both return None. How do I fix the code?
I am getting an error that no matter how hard I try I can’t solve it. I have located what is causing the error. It is caused by the code in forms.py specifically the function in functions.py. For some reason the query’s are returning None even though in the /register route I added the username and email and password to the db. I am using the same email for the username form and email form before adding them to the db but I don’t think that should make a difference. How do I fix the code?
I think it was working before. Also I plan to pytest the code where the username form and email form are equal then adding them to the db but I decided to post this in case that doesn’t make a difference.
Also I was looking in dbeaver, a database manager, and the columns username and email exists. So I am very confused. I didn’t include all the function but like stated I included the function that is causing the error. Also in the /register route just assume for simplicity I redirected to the /login route instead of where I redirect.
auth/models.py
https://pastebin.com/K5nE4yVr
auth/routes.py
https://pastebin.com/j0fEg9Hy
auth/functions.py
https://pastebin.com/CnCkkLGT
auth/forms.py
https://pastebin.com/DLBr86uN
Here is the output.
https://imgur.com/a/Pdg7gEk
/r/flask
https://redd.it/1el5vba
Tuesday Daily Thread: Advanced questions
# Weekly Wednesday Thread: Advanced Questions 🐍
Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.
## How it Works:
1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.
## Guidelines:
* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.
## Recommended Resources:
* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.
## Example Questions:
1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the
/r/Python
https://redd.it/1el3al8
Node Demonstrator - tool to create graphs and show standard algorithms
What my project does
I've been working on a module (largely for myself to use in school) to demonstrate to students, and then for themselves to be able to explore, how graph algorithms work step by step.
It's got to a point where I'm happy enough to share with people, is anyone's interested... I've published it on PyPI here (and it's on GitHub, naturally) so feel free to check it out.
Target Audience
Honestly, this is just a toy project aimed at educational use by A-level teachers (UK), and students
Comparison
It was as much about me building the project and proving that I could use Tkinter (well, ultimately CustomTkinter) and particularly the Canvas to create a drag/drop area for the graph. Haven't really looked at alternatives.
/r/Python
https://redd.it/1ekyqvz
AI research in medicine R
I'm interested in AI in medicine and want to dive deeper into AI research in this field. Are there any platforms, researchers, or YouTubers you'd recommend who explore this topic in depth, especially those who discuss and analyze research papers?
/r/MachineLearning
https://redd.it/1ekjkw1
[D] AI Search: The Bitter-er Lesson
https://yellow-apartment-148.notion.site/AI-Search-The-Bitter-er-Lesson-44c11acd27294f4495c3de778cd09c8d
/r/MachineLearning
https://redd.it/1ekd6fx
Thoughts on Django Microservices Architecture
I have recently started building Django Projects which I need to connect to each other with a microservices like approach. I was wondering if there are any good references that I can take to model my projects.
Also since its microservices and will have multiple pods for a service, I would also like to understand how we handle the ratelimiting across multiple pods of a service - I am using django_ratelimit as of now
/r/django
https://redd.it/1ek1cis
Monday Daily Thread: Project ideas!
# Weekly Thread: Project Ideas 💡
Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.
## How it Works:
1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.
## Guidelines:
* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.
# Example Submissions:
## Project Idea: Chatbot
**Difficulty**: Intermediate
**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar
**Description**: Create a chatbot that can answer FAQs for a website.
**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)
# Project Idea: Weather Dashboard
**Difficulty**: Beginner
**Tech Stack**: HTML, CSS, JavaScript, API
**Description**: Build a dashboard that displays real-time weather information using a weather API.
**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)
## Project Idea: File Organizer
**Difficulty**: Beginner
**Tech Stack**: Python, File I/O
**Description**: Create a script that organizes files in a directory into sub-folders based on file type.
**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)
Let's help each other grow. Happy
/r/Python
https://redd.it/1ek9spq
Generating Docx file
Hello everyone,
I have a problem. I need to generate a DOCX file that includes some data plots and a table. I have tried all the available solutions I found online, but none of them have worked. Can you enlighten me with some ideas or suggest a new library?
Thank you.
/r/Python
https://redd.it/1ejzy2l
db.createall() - Does not create *.db file. Help please
So I have been following this course for a few days now, and I cant seem to replicate what his code is doing. It doesn't create the \*.db file on my end. I even copied his code directly from his github and tried running, still really does not create the db file. When I run my [main.py](http://main.py) file, it runs without any errors, just doesn't generate the db file. Any ideas? Here's the code.
**website/main.py:**
from website import createapp
app = createapp() # Initialize a flask application from init.py file
if name == 'main': # Run this only when run directly from this file
app.run(debug=True)
**website/init.py:**
from flask import Flask
from flasksqlalchemy import SQLAlchemy
from os import path
# Initialze the db object
db = SQLAlchemy()
DBNAME = 'database.db'
def createapp():
app = Flask(name)
/r/flask
https://redd.it/1ejxf8j
Why is no one using full-stack python for web development? Has no one heard of the FHBH stack ??
Hey guys, I recently came across some libraries that seem to be very interesting to work with for the purpose of creating websites, but I wanted to know why no one uses them, or why they are not so widespread. I haven't had time to develop a more advanced and dynamic project with these libraries yet, but I believe that together they can be extremely useful, powerful and versatile for websites of any purpose. Maybe because no one knows about them, or because there is no benefit in using them and there are better ways to do it, but in a quick project test that I did, the dynamics of working with them seemed very interesting to me.
The libraries that I found were these:
**FastAPI**
A microframework for creating APIs, which can easily be used to create powerful websites.
**HTPY**
HTPY is a library that I recently discovered that was developed by a company that needed a better way to develop their projects with Django and created this library. It encapsulates HTML tags in Python classes, so that all HTML code can be created directly from a Python file, making it possible to use all the power that a programming language offers to generate
/r/Python
https://redd.it/1ejympc
D Self-Promotion Thread
Please post your personal projects, startups, product placements, collaboration needs, blogs etc.
Please mention the payment and pricing requirements for products and services.
Please do not post link shorteners, link aggregator websites , or auto-subscribe links.
--
Any abuse of trust will lead to bans.
Encourage others who create new posts for questions to post here instead!
Thread will stay alive until next one so keep posting after the date in the title.
--
Meta: This is an experiment. If the community doesnt like this, we will cancel it. This is to encourage those in the community to promote their work by not spamming the main threads.
/r/MachineLearning
https://redd.it/1ejkdhj
I need a custom flask header
* must be flask
* must be custom and none of the defaults
* cannot wrap and not allowed to use request methods
* may not chain load off app route, route_map, or return per handle
* must be custom header
/r/flask
https://redd.it/1eiu8js
This Flask site automatically generates Flask code for you
https://bullship.dev
/r/flask
https://redd.it/1ejbhvu
Python Skills for AWS
So if you want to be a great cloud engineer, you need Python scripting skills, Linux skills and some networking knowledge....What do i do
/r/Python
https://redd.it/1ejplk8