/r/pythoncoding

Photograph via snooOG

/r/Pythoncoding is a subreddit for advanced Python content. Developers can share articles and news about the Python ecosystem, deep dives into Python intricacies, or showcase advanced projects they are working on.

Notice:

This sub is currently being cleaned up. Please help by reporting unsuitable content!


Info:

/r/PythonCoding a subreddit for advanced Python content. Python developers can share articles and discuss things relevant to the Python programming language, while avoiding chaff like tutorials, courses, books, and blog spam.

In turn, this subreddit has a strict moderation policy for submissions.

For general or beginner content, see /r/Python or /r/LearnPython instead.

If you have an issue with the moderation policy, please send us a message


Do Post:
  • Talks
  • Presentations
  • Conferences
  • Articles
  • Research
  • Discussion of PEPs
  • Noteworthy projects
  • Interesting uses of Python

Don't post:

  • Basic tutorials
  • Basic projects
  • Requests for help understanding code
  • Requests for learning resources
  • Asking for feedback on pieces of code
  • Jokes and memes
  • Articles unrelated to Python
  • Anything you sell

Full rules: Here


Other Python subreddits:

/r/django
/r/learnpython
/r/madeinpython
/r/python
/r/pythontips

Other related subreddits:

/r/adventofcode
/r/dailyprogrammer

/r/pythoncoding

36,338 Subscribers

5

Steganography tool + algo in python

0 Comments
2024/11/23
21:33 UTC

4

/r/PythonCoding monthly "What are you working on?" thread

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.

2 Comments
2024/11/04
00:00 UTC

1

/r/PythonCoding monthly "What are you working on?" thread

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.

2 Comments
2024/10/04
00:00 UTC

1

I created FieldList: An alternative to List of Dicts for CSV-style data - Feedback welcome

0 Comments
2024/09/29
17:23 UTC

8

SurfSense - Personal AI Assistant for Internet Surfers.

What my project does:

Whenever I'm researching or studying anything, I tend to save a ton of content. It could be a cool article link, a fact someone mentioned in my chats or a blog post about it. But organizing all this content and then effectively researching or learning from it is a difficult task. That’s where SurfSense comes in. SurfSense acts like a personal brain for any content you consume, allowing you to easily revisit, organize, and effectively research and learn from your saved content.

Check it out at https://github.com/MODSetter/SurfSense

Why I am posting here:

Well my project have 3 things where extension and frontend is made in JS but core backend is made in python with LangChain and FastAPI.

If any good python devs could go through my backend and suggest some tips to improve it would be great.

And if u know any good resources about WebSockets implementation with FastAPI do mention in comments.

Target Audience:

Researchers, Students or Anyone who consume a lot of content

0 Comments
2024/09/25
22:17 UTC

0

CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

0 Comments
2024/09/23
06:07 UTC

3

Learn how to build the GUI for A Crytpo Tracking Application in Python - Tkinter

0 Comments
2024/09/21
14:30 UTC

3

Maelstrom 0.12.0: Isolate your tests, and run them fast.

We’re excited to announce Maelstrom 0.12.0, a test runner for Python that can run tests locally or on a cluster. Our new UI features real-time information about running tests, output from the build, and a new progress bar.

Maelstrom is a suite of test runners, built on top of a general-purpose clustered job engine. Maelstrom packages your tests into micro-containers, then distributes them to be run on an arbitrarily large cluster of test-runners, or locally on your machine using a custom-built, super-fast container runtime.

https://github.com/maelstrom-software/maelstrom

0 Comments
2024/09/17
16:47 UTC

4

/r/PythonCoding monthly "What are you working on?" thread

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.

7 Comments
2024/09/04
00:00 UTC

3

Why not just get your plots in numpy?!

0 Comments
2024/09/03
18:52 UTC

6

PiDAR - a DIY 360° 3D Scanner

0 Comments
2024/09/02
14:41 UTC

2

I Created the Definitive AUTOMATIC Shiny Hunter for Pokémon BDSP

Hey everyone! I am Dinones! I coded a Python program using object detection that lets my computer hunt for shiny Pokémon on my physical Nintendo Switch while I sleep. So far, I’ve automatically caught shiny Pokémon like Giratina, Dialga or Azelf, Rotom, Drifloon, all three starters, and more in Pokémon BDSP. Curious to see how it works? Check it out! The program is available for everyone! Obviously, for free; I'm just a student who likes to program this stuff in his free time :)

The games run on a Nintendo Switch (not emulated, a real one). The program gets the output images using a capture card, then, it process them to detect whether the pokemon is shiny or not (OpenCV). Finally, it emulates the joycons using bluetooth (NXBT) and control the Nintendo. Also works on a Raspberry Pi!

I don't make money with this, I just feel my project can be interesting for lot of people.

📽️ Youtube: https://www.youtube.com/watch?v=84czUOAvNyk
🤖 Github: https://github.com/Dinones/Nintendo-Switch-Pokemon-Shiny-Hunter

0 Comments
2024/08/19
01:04 UTC

1

SurfSense A Knowledge Graph Brain for your Web Browsing Sessions

Well when I’m browsing the internet, I tend to save a ton of content—but remembering when and what you saved? Total brain freeze! ❄️ That’s where SurfSense comes in. SurfSense is like a Knowledge Graph 🧠 Brain 🧠 for anything you see on the World Wide Web. Now, you’ll never forget any browsing session. Easily capture your web browsing session and desired webpage content using an easy-to-use Chrome extension. Then, ask your personal knowledge base anything about your saved content., and voilà—instant recall! 🧑‍💻🌐

The whole backend is made in FastAPI & Langchain in Python.

Do give it a try : https://github.com/MODSetter/SurfSense

and lmk what is your feedback/suggestions.

3 Comments
2024/08/15
01:24 UTC

8

Comments from my professor

I have been coding for a long time in Python, but I recently started college to get my bachelor's. My teacher made these comments, and I am not sure how to improve. While I did not get a bad grade, he deducted points, and dont want to make the same mistake.

Cmmments from my teacher:

Your code is clear and easy to understand—great job!

  • Consider adding more comments to explain complex parts of your code.
  • The readability of your code is good, but could be improved with more spacing and indentation

Questions:

How can I add more indentations with Python, as it needs to be indented in a certain way?

What comments can I make about the code, specifically the "complex " parts, as this is a basic example and not complex?

My code: 
class BudgetCalculator:
    def __init__(self):
        self.monthly_income = 0
        self.fixed_expenses = 0
        self.variable_expenses = []

    def gather_user_data(self):
        try:
            self.monthly_income = float(input("Enter your monthly income: "))
            self.fixed_expenses = float(input("Enter your fixed monthly expenses (e.g., rent, utilities): "))
            
            while True:
                var_expense = input("Enter a variable expense (or type 'done' to finish): ")
                if var_expense.lower() == 'done':
                    break
                expense = float(var_expense)
                if expense < 0:
                    print("Expense cannot be negative, please re-enter.")
                else:
                    self.variable_expenses.append(expense)
        except ValueError:
            print("Invalid input. Please enter numeric values.")

    def calculate_total_variable_expenses(self):
        return sum(self.variable_expenses)

    def calculate_remaining_budget(self):
        total_variable_expenses = self.calculate_total_variable_expenses()
        if self.fixed_expenses < 0 or total_variable_expenses < 0:
            raise ValueError("Expenses cannot be negative.")
        if self.monthly_income < (self.fixed_expenses + total_variable_expenses):
            raise ValueError("Expenses exceed income.")
        remaining_budget = self.monthly_income - (self.fixed_expenses + total_variable_expenses)
        return remaining_budget

    def display_result(self):
        try:
            remaining_budget = self.calculate_remaining_budget()
            print(f"Your remaining budget for the month is: ${remaining_budget:.2f}")
        except ValueError as e:
            print(e)

def main():
    budget_calculator = BudgetCalculator()
    budget_calculator.gather_user_data()
    budget_calculator.display_result()

if __name__ == "__main__":
    main()
11 Comments
2024/08/13
04:34 UTC

5

/r/PythonCoding monthly "What are you working on?" thread

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.

1 Comment
2024/08/04
00:00 UTC

6

Building code editor that puts an emphasis on learning. Would be great to hear your thoughts and ideas on how I could build it to better suit your use cases - I don't want to blindly add features that nobody needs.

You can find it at Stava.io, looking forward to the feedback! :)

1 Comment
2024/07/31
14:06 UTC

6

Maelstrom 0.11.0 – Clustered Test Runner, Now with Improved UI and Golang Support

0 Comments
2024/07/30
18:43 UTC

7

Coming from Java, I am confused about whether Python has real threads or not.

I have read about the Global Interpreter Lock (GIL) and understand that it is a lock per interpreter in Python, which is historical. However, I still see thread packages in Python. Why are they there if the GIL exists? What's the point?

So, what is the verdict here?

Thanks

7 Comments
2024/07/19
16:46 UTC

2

Shelly blu door and window sensor

I have a Shelly blu door and window sensor connected through a Shelly plus 2 PM. I’m trying to find a way to get the status open/closed using python or home assistant.

0 Comments
2024/07/12
00:57 UTC

5

Maelstrom: Maelstrom – A Hermetic, Clustered Test Runner for Python and Rust

0 Comments
2024/07/09
20:13 UTC

5

I created Manga Downloader using manga dex API

I completed my first python project which allow people to download manga from terminal using manga dex API this was my project with API

https://github.com/I3WX/manga-downloader.git

if you experienced program can look at the code and point out mistakes and give me suggest how to improve it
and any manga reader if you use it Plz I will love to get you feedback

2 Comments
2024/07/08
10:33 UTC

2

Django AI Assistant - Open-source Lib Launch

Hey folks, we’ve just launched an open-source library called Django AI Assistant, and we’d love your feedback!

What It Does:

  • Function/Tool Calling: Simplifies complex AI implementations with easy-to-use Python classes
  • Retrieval-Augmented Generation: Enhance AI functionalities efficiently.
  • Full Django Integration: AI can access databases, check permissions, send emails, manage media files, and call external APIs effortlessly.

How You Can Help:

  1. Try It: https://github.com/vintasoftware/django-ai-assistant/
  2. ▶️ Watch the Demo
  3. 📖 Read the Docs
  4. Test It & Break Things: Integrate it, experiment, and see what works (and what doesn’t).
  5. Give Feedback: Drop your thoughts here or on our GitHub issues page.

Your input will help us make this lib better for everyone. Thanks!

0 Comments
2024/07/05
21:05 UTC

0

Python AI Coder celebrates Independents Day, by coding fireworks display, in 3 minutes

1 Comment
2024/07/04
22:16 UTC

5

/r/PythonCoding monthly "What are you working on?" thread

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.

2 Comments
2024/07/04
00:00 UTC

3

Tutorial: Create a 3D Viewer for Numpy Arrays with Three.js in 5 Minutes

0 Comments
2024/06/28
14:30 UTC

6

Pycafe is a new Python sandbox. Here's an example using networkX with threejs

You can directly edit the example in this sandbox:
https://py.cafe/kolibril13/networkX-threejs

Next to the editor, there's also a terminal log and an interactive viewport with a threejs visualization.
Note that this all runs with Pyodide, so all Python code will be executed locally in the browser on your machine.

0 Comments
2024/06/26
15:26 UTC

Back To Top