/r/Python

Photograph via snooOG

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language.

If you have questions or are new to Python use r/LearnPython

News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python

Current Events

Upcoming Events

Full Events Calendar

Please read the rules

You can find the rules here.

If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.

Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.

Posts require flair. Please use the flair selector to choose your topic.

Posting code to this subreddit:

Add 4 extra spaces before each line of code

def fibonacci():
    a, b = 0, 1
    while True:
        yield a
        a, b = b, a + b

Online Resources

Online exercices

programming challenges

Asking Questions

Try Python in your browser

Docs

Libraries

Related subreddits

Python jobs

Newsletters

Screencasts

/r/Python

1,321,796 Subscribers

3

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:

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! 🌟

0 Comments
2025/02/05
00:00 UTC

45

Python 3.13.2 Released

https://www.python.org/downloads/release/python-3132/

Python 3.13 is the newest major release of the Python programming language, and it contains many new features and optimizations compared to Python 3.12. 3.13.2 is the latest maintenance release, containing almost 250 bugfixes, build improvements and documentation changes since 3.13.1.

It does not list precisely what bugs were fixed. Does anyone have a list?

4 Comments
2025/02/04
21:02 UTC

3

Smolmodels: a library that generates ML models based on natural language task descriptions

Source: https://github.com/plexe-ai/smolmodels

What My Project Does

smolmodels is an open-source Python library that generates ML models for specific tasks from natural language descriptions of the problem + minimal code. It combines graph search and LLM code generation to try to find and train as good a model as possible for the given problem.

Here’s a quick example:

import smolmodels as sm

# Step 1: define the model in terms of intent, schemas
model = sm.Model(
    intent="predict the probability of heart attack based on given features",
    input_schema={
        "age": int,
        "gender": int,
        "cp": int,
        ...
    },
    output_schema={"probability": float}
)

# Step 2: build the model
model.build(dataset=df, provider="openai/gpt-4o")

# Step 3: make predictions using the model
prediction = model.predict({
    "age": 61,
    "gender": 1,
    "cp": 3,
    ...
})

# Step 4: save the model for future use
sm.models.save_model(model, "heart_attack_model")

Target Audience

This is an early-stage open source project for the Python/SDE/ML community. It's not production-ready, but it's on PyPI and you can experiment with it.

Comparison

I'm not aware of any other tool that does this. If you want to use ML for a feature in your app, your alternatives are to either train an ML model yourself, fine-tune a pre-trained model, or leverage LLMs as a general-purpose solution. One of the main issues with using LLMs at scale, particularly in a latency-sensitive applications, is that huge LLMs are fundamentally slower and more expensive than smaller, task-specific models. This is what we’re trying to address with smolmodels.

The library is under the Apache 2.0 licence, so feel free to use it however you'd like (or contribute - we'd love that).

3 Comments
2025/02/04
19:06 UTC

3

pyi file generation for IDEs and linters based on Qt Designer ".ui" project files

Source: https://github.com/sausix/qtui2pyi

What My Project Does

This tool creates Python pyi files from Qt Designer ui files which finally hint IDEs and linters to correct types. This primarily allows IDEs to show you dropdowns and auto completion features on accessing QtWidgets and their properties.

Target Audience

Python Qt GUI developers who prefer loading Qt Designer ui files directly instead of compiling them into Python modules. Some reasons for that:

  • Ui files can be stored within Python resources, in Qt resource files or anywhere on a disk.
  • Changes in ui files are reflected directly after restarting the Qt application.
  • Compile tools add special functions like setupUi and similar.
  • Ui files allow dynamic or on demand loading or nesting for example multiple ui files into pages of a single TabWidget or other nesting widgets.

Comparison

Found no similar or working solution. mypy's stubgen is broken and just outputs Incomplete types: mypy #14673

Batteries included: Example Designer file and demo applications for PySide6 and PyQt6.

2 Comments
2025/02/04
19:35 UTC

137

Tach - A Python tool to enforce dependencies

Source: https://github.com/gauge-sh/tach

Python allows you to import and use anything, anywhere. Over time, this results in modules that were intended to be separate getting tightly coupled together, and domain boundaries breaking down.

We experienced this first-hand at a unicorn startup, where the entire engineering team paused development for over a year in an attempt to split up tightly coupled packages into independent microservices. This ultimately failed, and resulted in the CTO getting fired.

This problem occurs because:

  • It's much easier to add to an existing package rather than create a new one
  • Junior devs have a limited understanding of the existing architecture
  • External pressure leading to shortcuts and overlooking best practices

Attempts we've seen to fix this problem always came up short. A patchwork of solutions would attempt to solve this from different angles, such as developer education, CODEOWNERs, standard guides, refactors, and more. However, none of these addressed the root cause.

What My Project Does

With Tach, you can:

  1. Declare your modules (tach mod)
  2. Automatically declare dependencies (tach sync)
  3. Enforce those dependencies (tach check)
  4. Visualize those dependencies (tach show and tach report)

You can also enforce a public interface for each module, and deprecate dependencies over time.

Target Audience

Developers working on large Python monoliths

Comparison

  • import linter - similar but more specifically focused on import rules
  • build systems - bazel, pants, buck, etc. More powerful but much more heavy and waaaay more slow

I'd love if you try it out on your project and let me know if you find it useful!

55 Comments
2025/02/04
16:07 UTC

0

I Built a Bot to Fake My GitHub Activity and Land a $500K Job -- My Weekend Shenanigans

Motivation : I'm broke. I desperately need that $500k job. If you remember, there was that super viral tweet about someone landing a $500k job without an interview—just because they had a fully green GitHub commit history. That got me thinking.

Now, I’m a lazy guy, but I want that kind of money. Naturally, I checked the comments, and a bunch of people said, "Oh, you can just do this with a script." But guess what? No one actually shared one. That was disappointing.

So, I did what any self-respecting engineer would do—I built it myself. And because I’m such a generous person (debatable), I open-sourced it for everyone. Meet: The GitHub Auto-Committer

What does this project do?
This bot automatically commits to a private GitHub repo to keep your contribution graph fully green. It:

  1. Creates a private repo.
  2. Commits a sample Readme file.
  3. Runs a scheduled script (think of it like a cron job) every day at 12 AM JST to push a new commit.

And boom—your GitHub profile now looks like you code 24/7.

How does it work?

  1. You provide a GitHub Classic Token (with read/write access).
  2. I store it in a database (encrypted, of course).
  3. My script uses GitHub APIs to create the repo and commit on your behalf.

Is it safe to provide me with your token?
Yes and no. Let’s be real—you shouldn’t trust a random stranger on the internet. But here’s what I do:

  1. Your token is encrypted before storage.
  2. Even I cannot see your token directly.
  3. Though technically I know the encryption key and I could decrypt it - but believe me, I wont do so.

Bottom line: If you don’t trust me, fork the repo and run it yourself. That’s the beauty of open source.

Target Audience:

  1. Anyone who wants to look cool.
  2. Anyone who wants recruiters to think they code non-stop.
  3. Anyone who’s lazy but wants to appear productive.

Comparison with other tools:
I don’t know of any other tools like this. Maybe people have written scripts, but did they actually share them? Nope.

Relevant Links

Github URL : The Github Auto Committer Bot

Deployed Application URL : The Lazy Man Github

PS : I know not my best work in terms of coding practices but I will refactor it slowly. Meanwhile do check it out and let me know your feedback on this.

Edit : I just want to add one thing—I’m well aware that doing this won’t land anyone a job. For me, it’s purely a fun project. So, I’d kindly ask those reading this not to take it too seriously.

11 Comments
2025/02/04
12:16 UTC

1

Integrating Python’s Folium into Node.js – A Startup’s Experiment

Hi everyone,

We're a startup that's developing a library called Javonet, designed to help integrate different programming languages seamlessly. Recently, we experimented with integrating Python’s Folium into a Node.js project. Traditionally, Folium has been used in Python-only projects, but our goal is to break down language barriers and enable developers to leverage the best tools from multiple ecosystems so we thought that it might be quite interesting to try and implement it.

I wrote an article that walks through our experience, the challenges we encountered, and some of the benefits of this cross-language approach: Create Stunning Maps in Node.js by Integrating Python’s Folium with Javonet.

I’d love to hear if anyone else has tried similar integrations or if you have ideas on how to further bridge the gap between languages. Your feedback is really valuable as we continue developing our library!

7 Comments
2025/02/04
08:56 UTC

7

I made an LLM/ AI app to make image editing stupidly simple—check out EasyEdit

Last week, I got tired of how clunky even basic image editing can be, so I built a little app called EasyEdit to fix that. It’s lightweight, open-source, and just makes things... easy. No bloat, no unnecessary steps—just open, edit, done.

Why I Built It and Comparison:

✅ Local Processing – No need to upload images to random online services. Process everything on your machine.
✅ Sick of Slow, Overcomplicated Editors – Just needed something fast and simple.
✅ Customizable – Wanted something I could tweak and improve over time.
✅ Useful for Other Developers – Figured others might find it handy too!

Video : YouTube

Github : Github

Try it out : Streamlit App

Unique Features and what My Project Does

Natural Language Image Processing – Just tell the app what you want, and intelligent AI agents translate your request into precise OpenCV/NumPy operations.
Version Control for Edits – Think Git for image editing – undo/redo and track all changes.
Interactive Interface – Real-time previews, side-by-side comparisons, and click-to-get precise coordinates for editing.
Multiple Export Formats – Download processed images in PNG, JPG, or PDF formats.

Supported Operations:

✅ Image Editing: Resize, blur, draw shapes, add text, and more.
✅ Image Analysis: Extract dimensions, pixel values, and other properties.
✅ Custom Operations: If OpenCV doesn’t support something (e.g., crop has no built-in function), you can define your own!

Obviously, the better the LLM model, the better the results—but it can still generate single-line OpenCV/NumPy functions for edits like crop, resize, draw circle, add text, etc.

Target audience:

* If you want an open-source app for quick resolution changes, cropping, annotating, and more, this is for you!

* It’s open-source, so if you wanna try it out (or help make it better), check out the repo: GitHub

2 Comments
2025/02/04
05:36 UTC

20

Introducing ElixirDB - Simplified SQLAlchemy Engine management - with extras.

Hello,

I'm building libraries (the previous one was similar to this) to get criticism to improve my code and logic because even as a professional developer, I've never had a senior engineer/dev. I took in some feedback from the previous library to make something potentially useful this time.

This is a pre-release, so there are some things I'm ironing out. Let me know what you guys think. Always looking for criticism.

Github: https://github.com/hotnsoursoup/elixirdb

Pypi: https://pypi.org/project/elixirdb/

What My Project Does: ElixirDB simplifies interaction with SQLAlchemy, providing streamlined database operations, enhanced configuration management, and improved developer experience.

Target Audience:
Anyone that wants to stand up a quick database connection or may want the flexibility of switching engines from a central class. Perhaps you don't like the way sqlalchemy binds engines.

Comparison: Not sure, I couldn't really find anything out there. I did try googling quite a bit and even asked 3 different AI models to find me one, but it didn't come up with anything. I'd love for any references.

Key Features (Reduced, more on github/pypi)

  • Automatic loading: Define an elixir.yaml file in your project, and it will be automatically loaded into the ElixirDB instance.
  • Pydantic Integration: Define and validate database configurations using Pydantic models
  • Multi-Engine Support: Seamlessly manage multiple database engines through a central class object.
  • Multi-dialect Support: Support for MySQL/MariaDB, postgresql, Oracle, and MSSQL.
  • Engine Types: Supports direct, session and scoped_session
  • Handler Framework: A flexible handler framework empowers customized processing of parameters, result_objects, and central error control - mirroring middleware functionality.
  • Stored Procedure Support: Execute stored procedures with ease, with automatically generated statements based on dialect.

Basic Usage

from elixirdb import ElixirDB


try:
    connection = ElixirDB(engine_key="mysql")
except FileNotFoundError:
    print("No elixir.yaml file found.")

Sample yaml configuration for EngineManager

app:
    defaults: # All engines adopt these as a base.
        engine_options:
            echo: False
            pool_size: 20
            max_overflow: 10
            pool_recycle: 3600
engines:
    dbkey1:
        dialect: mysql
        url: mysql+pymysql://user:password@localhost:3306/db1
        default: true # Default engine if engine_key is not provided.
        execution_options:
            autocommit: True
            isolation_level: READ_COMMITTED
            preserve_rowcount: True
    loggingdb:
        dialect: postgres
        url_params:
            drivername: psycopg2
            host: localhost
            port: 5432
            user: postgres
            password: password
            query:
                schema: public
        engine_options:
            echo: True
            pool_timeout: 30
            hide_parameters: True
    customerdb:
        dialect: oracle
        url: oracle+cx_oracle://user:password@localhost:1521/orcl
8 Comments
2025/02/04
01:42 UTC

3

Difference between Introduction to Algorithms CLSR & Fluent Python?

I'm trying to upskill my proficiency in Python to get better & skillful at coding, be able to solve more difficult Leetcode problems and be able to crack interviews. Other than very basic syntax of Python, I am not an expert in the language.

I have seen people suggest these 2 books. May I know what these 2 offer, and which one will better suit my intent, if I could only choose one of them? I am planning on taking CS50 then go with either of these books to build on top.

4 Comments
2025/02/04
01:41 UTC

80

pytest-mock : Mocking in pytest - Test & Code

https://testandcode.com/episodes/pytest-mock

pytest-mock is currently the #3 pytest plugin.

  • Why the pytest-mock plugin is awesome
  • What is mocking, patching, and monkey patching
  • What, if any, is the difference between mock, fake, spy, stub.
  • Why we might need these in testing
  • Some history of mock in Python and how mock became unittest.mock
  • Using mocker.patch, mocker.spy, and mocker.stub
  • Why pytest-mock is awesome and why you might want to use it over straight unittest.mock
4 Comments
2025/02/04
00:42 UTC

5

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 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 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 performance implications of using native Python data structures vs NumPy arrays for large-scale data?
  9. Best practices for securing a Flask (or similar) REST API with OAuth 2.0?
  10. What are the best practices for using Python in a microservices architecture? (..and more generally, should I even use microservices?)

Let's deepen our Python knowledge together. Happy coding! 🌟

0 Comments
2025/02/04
00:00 UTC

0

Scraping TikTok using Python (Selenium, web driver)

https://blog.apify.com/tiktok-scraper-python/

Just found a tutorial scraping TikTok data using Python's Selenium library (before the ban kicks in, I guess)

0 Comments
2025/02/03
23:59 UTC

3

gifpgn: Chess GIF generator with engine analysis

This is my first published python package, so any tips or critiques are very much welcome.

https://github.com/prozn/gifpgn/

What My Project Does

  • Create GIFs with an analysis graph and annotation glyphs, headers with player names, captured pieces and clock, and move/check arrows.
  • Features that need engine analysis require that the PGN contains [%eval ...] comments for each move - so the package also offers:
  • Run analysis on chess PGNs using stockfish (or other UCI engine), and return the PGN decorated with [%eval ...] comments.
  • Four piece themes, and customisable square colors (with 6 preset themes)

See demo GIFs in the github readme.

Target Audience

  • Python developers
  • Production ready (I think!)

Comparison

Other projects such as chess_gif and pgn2gif do not offer:

  • Engine analysis and the features that come along with it

  • Move arrows to easily see moves and checks

  • Decorations such as headers

I hope some of you find this useful or interesting.

0 Comments
2025/02/03
23:50 UTC

9

Fast JSON merging library

We have a service that merges JSON configuration fragments and it was spending most of its time in reduce(jsonmerge.merge, list_of_json_objects) so we let claude-3.5-sonnet rewrite that in Rust and package it as a Python module (don't worry, it was code reviewed by Rust programmers!) which is many times faster.

https://pypi.org/project/json-multi-merge/

https://github.com/Media-Platforms/json-multi-merge

What My Project Does

  • Recursive Object Merging: Deep merge nested JSON objects
  • Array Replacement: Second object's arrays take precedence
  • Key Modifiers:
    • key! - Replace value instead of merging
    • key-- - Remove this key from the result
  • Type Conflict Resolution: Last object's type wins
  • Null Handling: Treat null as a regular value
  • High Performance: Rust backend for efficient deep merges

Target Audience

Anyone who wants to merge JSON objects fast.

Comparison

It's not as flexible as jsonmerge but it does let you control how values are merged by putting ! or -- after their keys.

4 Comments
2025/02/03
22:21 UTC

40

🚀 html-to-markdown 1.2: Modern HTML to Markdown Converter for Python

Hi Pythnoista's!

I'm excited to share with you html-to-markdown.

This library started as a fork of markdownify - I used it when I wrote a webscaper and was frustrated with its lack of typing. I started off by adding a py.typed file, but found myself rewriting the entire library to add typing and more extensive tests, switching from its class based approach to a lighter, functional codebase.

Target Audience

  • Python developers working with HTML content conversion.
  • Web scrapers needing clean Markdown output.
  • Documentation tooling maintainers.
  • Anyone migrating content from HTML to Markdown-based systems.

Alternatives & Origins

This library is a fork of markdownify, an excellent HTML to Markdown converter that laid the groundwork for this project. While markdownify remains a solid choice, this fork takes a different approach:

html-to-markdown vs markdownify:

  • Full type safety with MyPy strict mode
  • Functional API vs class-based architecture
  • Modern Python 3.9+ support
  • Strict semver versioning
  • More extensive test coverage including integration tests
  • Allows configuration of BeautifulSoup

Other alternatives:

  • html2text: Popular but last updated 2020.
  • tomark: Minimal features, no typing support.
  • md-convert: Limited configuration options.
  • Beautiful Soup's get_text(): Basic text extraction only.

Quick Example

from html_to_markdown import convert_to_markdown

markdown = convert_to_markdown('<b>Hello</b> <a href="https://reddit.com">Reddit</a>')
# Output: '**Hello** [Reddit](https://reddit.com)'

Installation

pip install html-to-markdown

Check out the GitHub repository for more details and examples. If you find this useful, a ⭐ would be greatly appreciated!

The library is MIT-licensed and open to contributions. Let me know if you have any questions or feedback!

2 Comments
2025/02/03
16:57 UTC

0

Minimal AI browser agent example for everyone

You will build an AI Agent - Browser Price Matching Tool that uses browser automation and some clever skills to adjust your product prices based on real-time web searches data.

What will you do?

The tool takes your current product prices (think CSV) and finds similar products online (targeting Amazon for demo purposes). It then compares prices, allowing you to adjust your prices competitively. The magic happens in a multi-step pipeline:

  1. Generate Clean Search Queries: Uses a learned skill to convert messy product names (like "Apple iPhone14!<" or "Dyson! V11!!// VacuumCleaner") into clean, Google-like search queries.
  2. Browser Data Extraction: Launches asynchronous browser agents (leveraging Playwright) to search for those queries on Amazon, retrieves the relevant data, and scrapes the page text.
  3. Parse & Structure Results: Another custom skill parses the browser output to output structured info: product name, price, and a short description.
  4. Enrich Your Data: Finally, the tool combines everything to enrich your original data with live market insights!

Full code link: Full code

File Rundown

  • learn_skill.py Learns how to generate polished search queries from your product names with GPT-4o-mini. It outputs a JSON file: make_query.json.
  • learn_skill_select_best_product.py Trains another skill to parse web-scraped data and select the best matching product details. Outputs select_product.json.
  • make_query.json The skill definition file for generating search queries (produced by learn_skill.py).
  • select_product.json The skill definition file for extracting product details from scraped results (produced by learn_skill_select_best_product.py).
  • product_price_matching.py The main pipeline script that orchestrates the entire process—from loading product data, running browser agents, to enriching your CSV.

Setup & Installation

  1. Install Dependencies: pip install python-dotenv openai langchain_openai flashlearn requests pytest-playwright
  2. Install Playwright Browsers: playwright install
  3. Configure OpenAI API: Create a .env file in your project directory with:OPENAI_API_KEY="sk-your_api_key_here"

Running the Tool

  1. Train the Query Skill: Run learn_skill.py to generate make_query.json.
  2. Train the Product Extraction Skill: Run learn_skill_select_best_product.py to generate select_product.json.
  3. Execute the Pipeline: Kick off the whole process by running product_price_matching.py. The script will load your product data (sample data is included for demo, but easy to swap with your CSV), generate search queries, run browser agents asynchronously, scrape and parse the data, then output the enriched product listings.

Target Audience

You built this project to automate price matching—a huge pain point for anyone running an e-commerce business. The idea was to minimize the manual labor of checking competitor prices while integrating up-to-date market insights. Plus, it was a fun way to combine automation,skill training, and browser automation!

Customization

  • Tweak the concurrency in product_price_matching.py to manage browser agent load.
  • Replace the sample product list with your own CSV for a real-world scenario.
  • Extend the skills if you need more data points or different parsing logic.
  • Ajudst skill definitions as needed

Comparison

With existing approaches you need to manually write parsing loginc and data transformation logic - here ai does it for you.

If you like the tutorial - leave a star github

4 Comments
2025/02/03
15:42 UTC

0

Numpy.random.normal

Hi. The question is: what calculation method is implemented in numpy.random.normal? I have a problem to describe it manualy. First part is a gaussian algoritm (probably), but what is next to draw numbers? Or maybe i am wrong and there is sth another algoritm?

7 Comments
2025/02/03
13:43 UTC

0

Run Python code from ChatGPT, Claude, DeepSeek, or any site with a right-click

Hey folks! 👋

I wanted to share the project I've been hacking on.

Python Code Runner is a free Chrome extension which lets you run Python instantly in your browser, with zero environment setup.

What My Project Does

  • Right-click Python code anywhere on the web to run it.
  • Save reusable code snippets
  • Upload/download files
  • Schedule automated runs
  • Supports popular libraries like requests, pandas, NumPy, BeautifulSoup

Target Audience

No & low-coders, web scrapers, data scientists, Python learners, LLM users

Comparison

  • Replit: unlimited development time, no sign up, use AI for free with ANY LLM
  • PythonAnywhere: simpler UX, no sign up, unlimited Python execution
  • AWS, GCP etc.: host and schedule a Python script in 2 clicks, not 20

Technical Details

6 Comments
2025/02/03
13:42 UTC

49

Found this cool Python WFP library that makes network filtering super easy in Windows!

Found this cool Python WFP library that makes network filtering super easy

Just discovered PyWFP while looking for a way to handle Windows Filtering Platform in Python. It's pretty neat - lets you create network filters with really simple syntax, similar to Windivert if anyone's familiar with that.

Quick example of what you can do:

from pywfp import PyWFP
pywfp = PyWFP()
filter_string = "outbound and tcp and remoteaddr == 192.168.1.3 and tcp.dstport == 8123"

with pywfp.session():
    pywfp.add_filter(filter_string, filter_name="My Filter")

The syntax is really straightforward - you can filter by:

* TCP/UDP/ICMP

* IP ranges

* Specific ports

* Inbound/outbound traffic

Been playing with it for a bit and it works great if you need to programmatically manage Windows network filters. Thought others might find it useful!

Link: Github

7 Comments
2025/02/03
11:29 UTC

45

Text to Video Model Implementation Step by Step

What My Project Does

I've been working on a text-to-video model from scratch using PyTorch and wanted to share it with the community! This project is designed for those interested in diffusion models.

Target audience

For students and researchers exploring generative AI.

Comparison

While not aiming for state of the art results, this serves as a great way to understand the fundamentals of text-to-video models.

GitHub

Code, documentation, and example can all be found on GitHub:

https://github.com/FareedKhan-dev/text2video-from-scratch

4 Comments
2025/02/03
03:56 UTC

13

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" 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

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

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

Let's help each other grow. Happy coding! 🌟

0 Comments
2025/02/03
00:00 UTC

11

Tour of Python v0.01

Hey everyone! In the spirit of release early, release often, I wanted to post to Reddit and Hacker News (for the first time ever!) about an idea of mine. Okay, so it's not a very original idea. It is however a missing gap in the Python ecosystem for learning and introduction to the language.

Check out the Tour of Go if you're not familiar with this concept already. The general idea is an in-browser interactive learning playground. (An in-browser REPL, if you will).

It needs more slides, it needs bugfixes and improvements overall, but the basic concept is here. The sandbox was implemented using code from healeycodes.com and ChatGPT did much of the other initial heavy lifting for me (I am a backend engineer by trade, my front-end skills are extremely rusty.)

The code is here: https://github.com/jadedragon942/tour_of_python/

The website is here: www.tourofpython.net

Disclaimer: it is nothing too fancy.

My long-term lofty goal is to build this and hand it off to python.org if possible/feasible.

Contributors/volunteers/feedback/opinions are of course welcome!

4 Comments
2025/02/02
23:04 UTC

10

Open Source Customizable Timer: KEGOMODORO! ⏳

Hey everyone! I’ve developed KEGOMODORO, an open-source productivity tool designed to enhance time management! It's a customizable Pomodoro and Stopwatch timer that anyone can personalize and extend to suit their needs.

🔹 What My Project Does:

KEGOMODORO allows users to manage their time effectively with Pomodoro and Stopwatch modes. It features an easy-to-use interface, supports quick note-taking, logs your work hours, and even shows a graph to track your productivity over time. It also comes with a Behelit Mode, inspired by Berserk, for a fun, thematic countdown timer.

🔹 Target Audience:

  • Anyone looking to improve their productivity and manage their time more effectively.
  • Ideal for students, freelancers, and remote workers who need to structure their work sessions.
  • Great for open-source enthusiasts who want to contribute, modify, or build upon the project.

🔹 Comparison:

KEGOMODORO differs from traditional Pomodoro timers in that it is highly customizable. You can change themes to fit your personal style, and the app offers a unique Berserk-themed Behelit Mode that is a fun twist on productivity tools. Additionally, its lightweight design makes it easier to use without extra dependencies, unlike many Pomodoro apps that can be bulky or require complex setups. Plus, it’s built in Python, so it’s simple to modify and extend, especially for Python developers!

💡 Key Features:

  • Pomodoro & Stopwatch Mode
  • Always on Top Window Support
  • ✅ Quick note-taking and logging of work hours
  • Work Hour Graph to visualize your productivity 📊
  • 🎭 Behelit Mode (Berserk-themed timer) – The timer of blood and appreciation!
  • 🐍 Developed using Python – Simple, lightweight, and easy to modify.

🎨 Customization:

KEGOMODORO allows you to easily create custom themes to suit your style. The main goal of the app is flexibility and personalization—below are just a few examples of how it can be customized.

💻 Completely Open Source!

Feel free to fork, modify, and contribute to the project! I built it in Python to make it accessible for anyone to understand and tweak as needed.

🔗 GitHub: https://github.com/Kagankakao/KEGOMODORO

If you're looking for a fun and efficient way to improve your time management and productivity, check it out! 🚀🔥 Fork it and contribute if you're interested!

2 Comments
2025/02/02
18:57 UTC

0

Need new Python interpreter & compiler

I normally use trinket.io to embed Python 3 codes into my website but I recently discovered that it has a 60-second time limit for running code. Do you have any other online options similar to Trinket?

This is my code

3 Comments
2025/02/02
11:56 UTC

254

FastAPI Deconstructed: Anatomy of a Modern ASGI Framework

Recently I had the opportunity to talk about the FastAPI under the hood at PyCon APAC 2024. The title of the talk was “FastAPI Deconstructed: Anatomy of a Modern ASGI Framework”. Then, I thought why not have a written version of the talk. And, I have decided to write. Something like a blog post. So, here it is.

https://rafiqul.dev/blog/fastapi-deconstructed-anatomy-of-modern-asgi-framework

11 Comments
2025/02/02
09:59 UTC

78

Recently Wrote a Blog Post About Python Without the GIL – Here’s What I Found! 🚀

Python 3.13 introduces an experimental option to disable the Global Interpreter Lock (GIL), something the community has been discussing for years.

I wanted to see how much of a difference it actually makes, so I explored and ran benchmarks on CPU-intensive workloads, including:

  • Docker Setup: Creating a GIL-disabled Python environment
  • Prime Number Calculation: A pure computational task
  • Loan Risk Scoring Benchmark: A real-world financial workload using Pandas

🔍 Key takeaways from my benchmarks:

  • Multi-threading with No-GIL can be up to 2x faster for CPU-bound tasks.
  • Single-threaded performance can be slower due to reliance on the GIL and still experimental mode of the build.
  • Some libraries still assume the GIL exists, requiring manual tweaks.

📖 I wrote a full blog post with my findings and detailed benchmarks: https://simonontech.hashnode.dev/exploring-python-313-hands-on-with-the-gil-disablement

What do you think? Will No-GIL Python change how we use Python for CPU-intensive and parallel tasks?

28 Comments
2025/02/02
08:39 UTC

26

PedroReports-An Open Source LLM Powered Automated Data Analysis Report Generator Tool

Hey devs! Sharing my first project - an AI-powered PDF Report Generator! 🐍📊

GitHub:

Please checkout GitHub Repo for Tutorial Video https://github.com/bobinsingh/PedroReports-LLM-Powered-Report-Tool

I recently switched my career from life sciences to coding, and I wanted to create something useful after learning. So I built a tool that generates professional data analysis PDF reports from any tabular dataset. You just need to input what you want to analyze, and it does the job for you. Thought you might find it interesting!

What My Project Does:

  • Takes your dataset and analysis requirements as input in the form of questions
  • Uses Gemini API to generate graphs and relevant stats to answer your questions
  • Generates a professional PDF with proper formatting
  • Handles TOC, styling, and page numbers automatically

Target Audience:

  • Data Analysts, BI reporters
  • Data Science beginners who want quick data insights
  • Researchers who are not friendly with coding

Comparison

  • There are a lot of BI tools out there but not sure if they generate PDF reports or not.

Tech Stack:

  • Python + ReportLab for PDF generation
  • React + Vite for frontend and development server
  • LangChain + Gemini API for analysis
  • Pandas/Numpy/Matplotlib for data processing

The workflow is simple: feed it your data, and it handles everything from visualization to creating a fully formatted report with AI-generated descriptions. No more manual report writing! 🎉

Check it out on Github! Happy to answer any questions.

3 Comments
2025/02/02
06:16 UTC

2

Introducing FFE - The easy way to share encrypted files with friends.

Hey everyone!

I wanted to share a Python program I made fairly recently.

What My Project Does?

FFE is a TUI (Command Line) Tool to make it easier to share files with your friends without anyone else seeing them. Some features currently present are:

  • Easy to Use TUI
  • A GitHub Repo with a wiki (In Progress)
  • Fully Open-Source Code
  • A fully GUI Installer

Target Audience

The target audience for FFE is.. anyone. FFE is built so it's easy to use, so everyone, even your grandma, can use it.

The only requirement is a Windows PC with Windows 7 or newer, and the huge amount of storage space that is ~70 MB (if you install the Visual C++ Redist, which isn't required on Windows 10 and above).

Comparison

FFE is different to other encryption programs, because instead of just using a password to encrypt files, it uses a Key File that you send to anyone that should be able to access your files, and then you just send each other files as many times as you want!

Oh yeah, and FFE is completely open-source, so you can look at all the code directly on GitHub.

Visit the GitHub if you want to download it, or if you would like to contribute.

github.com/AVXAdvanced/FFE

Built with Python 3.13+

Have fun encrypting!

14 Comments
2025/02/02
04:36 UTC

14

Pinkmess - A minimal Python CLI for markdown notes with AI-powered metadata

Hey folks! 👋

I wanted to share a personal tool I built for my note-taking workflow that might be interesting for terminal enthusiasts and markdown lovers. It's called Pinkmess, and it's a CLI tool that helps manage collections of markdown notes with some neat AI features.

What My Project Does?

Pinkmess is a command-line tool that helps manage collections of markdown notes with AI capabilities. It:

  • Manages collections of markdown files
  • Automatically generates summaries and tags using LLMs
  • Provides a simple CLI interface for note creation and editing
  • Works with standard markdown + YAML frontmatter
  • Keeps everything as plain text files

Target Audience

This is explicitly a personal tool I built for my own note-taking workflow and for experimenting with AI-powered note organization. It's **not** intended for production use, but rather for:

  • Terminal/vim enthusiasts who prefer CLI tools
  • Python developers who want to build their own note-taking tools
  • People interested in AI-augmented note organization
  • Users who prioritize plain text and programmatic access

Comparison

Unlike full-featured PKM systems (Obsidian, Logseq, etc.), Pinkmess:

  • Is completely terminal-based (no GUI)
  • Focuses on being minimal and programmable
  • Uses Python native architecture (easy to extend)
  • Integrates AI features by default
  • Keeps a much smaller feature set

Quick example:

Install it from PyPI:

$ pip install pinkmess

Create and edit a note

$ pinkmess note create

$ pinkmess note edit

Generate AI metadata:

$ pinkmess note generate-metadata --key summary

$ pinkmess note generate-metadata --key tags

GitHub: https://github.com/leodiegues/pinkmess

Built with Python 3.10+ and Pydantic.

Looking forward to your feedback! 🌸

Happy note-taking! 🌸

5 Comments
2025/02/02
00:10 UTC

Back To Top