/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,298,755 Subscribers

1

Need advice on Python-based web hosting and development

I’m transitioning away from Squarespace to build my photography website due to its limitations (e.g., forcibly downscaling photos, tedious gallery creation, and lack of bulk editing web pages using regex).

Above all, I’d like to automate my workflow of creating web pages containing photos with Python.

1.	Create a folder structure for new photo albums on my web server (e.g., /photos/2024/12/02/album-name).
2.	Upload web-size and full-resolution images via FTP or similar.
3.	Generate HTML for albums using a template (i.e. web previews linking to full-res images).
4.	Publish with a simple URL slug (e.g., /20241202-album-name).

I know this can be done with just static HTML web pages in a folder that I can create myself using Python. But mostly I'm looking for advice on a hosting platform or web builder that gives me:

•	Access to the file system or API for programmatic uploads.
•	The ability to deploy and update HTML/CSS/JS easily.

What hosting service or builder would you recommend that works well with this approach?

1 Comment
2024/12/02
21:33 UTC

4

PerpetualBooster outperforms AutoGluon on AutoML benchmark

  • What My Project Does
    • PerpetualBooster is a gradient boosting machine (GBM) algorithm which doesn't need hyperparameter optimization unlike other GBM algorithms. Similar to AutoML libraries, it has a budget parameter. Increasing the budget parameter increases the predictive power of the algorithm and gives better results on unseen data.
  • Target Audience (e.g., Is it meant for production, just a toy project, etc.)
    • It is meant for production.
  • Comparison (A brief comparison explaining how it differs from existing alternatives.)

PerpetualBooster is a GBM but behaves like AutoML so it is benchmarked also against AutoGluon (v1.2, best quality preset), the current leader in AutoML benchmark. Top 10 datasets with the most number of rows are selected from OpenML datasets. The results are summarized in the following table for regression tasks:

OpenML TaskPerpetual Training DurationPerpetual Inference DurationPerpetual RMSEAutoGluon Training DurationAutoGluon Inference DurationAutoGluon RMSE
Airlines_DepDelay_10M51811.329.052030.928.8
bates_regr_100342115.11.084OOMOOMOOM
BNG(libras_move)19564.22.51192297.62.53
BNG(satellite_image)3341.60.73133710.00.721
COMET_MC441.00.0615475.00.0662
friedman12754.21.0472785.11.487
poker380.60.256411.20.722
subset_higgs86810.60.42087024.50.421
BNG(autoHorse)1071.119.01073.220.5
BNG(pbc)480.6836.5510.2957.1
average4653.9-46419.7-

PerpetualBooster outperformed AutoGluon on 8 out of 10 datasets, training equally fast and inferring 5x faster. The results can be reproduced using the automlbenchmark fork here.

Github: https://github.com/perpetual-ml/perpetual

0 Comments
2024/12/02
19:15 UTC

5

Iris Templates: A Modern Python Templating Engine Inspired by Laravel Blade

What My Project Does

As a Python developer, I’ve always admired the elegance and power of Laravel’s Blade templating engine. Its intuitive syntax, flexible directives, and reusable components make crafting dynamic web pages seamless. Yet, when working on Python projects, I found myself longing for a templating system that offered the same simplicity and versatility. Existing solutions often felt clunky, overly complex, or just didn’t fit the bill for creating dynamic, reusable HTML structures.

That’s when Iris Templates was born—a lightweight, modern Python template engine inspired by Laravel Blade, tailored for Python developers who want speed, flexibility, and an intuitive way to build dynamic HTML.

🧐 Why I Developed Iris Templates (Comparison)

When developing Python web applications, I noticed a gap in templating solutions:

  • Jinja2 is great but can feel verbose for straightforward tasks.
  • Django templates are tied closely to the Django framework.
  • Many templating engines lack the modularity and extendability I needed for larger projects.

Iris Templates was created to bridge this gap. It's:

  • Framework-agnostic: Use it with FastAPI, Flask, or even standalone scripts.
  • Developer-friendly: Intuitive syntax inspired by Blade for faster development.
  • Lightweight but Powerful: Built for efficiency without sacrificing flexibility.

🌟 Key Features of Iris Templates

  1. "extends" and "section" for Layout Inheritance; Create a base layout and extend it effortlessly.
  2. "include" for Reusability.
  3. Customizable Directives. (if, else, endif, switch..)
  4. Safe Context Evaluation; Iris Templates includes a built-in safe evaluation mechanism to prevent malicious code execution in templates.
  5. Framework-Independent; Whether you’re using FastAPI, Flask, or a custom Python framework, Iris fits in seamlessly.

🤔 What Makes Iris Templates Different?

Unlike other Python templating engines:

  • Inspired by Blade: Iris takes the best ideas from Blade and adapts them to Python.
  • No Boilerplate: Write clean, readable templates without extra overhead.
  • Focus on Modularity: Emphasizes layout inheritance, reusable components, and maintainable structures.

It’s designed to feel natural and intuitive, reducing the cognitive load of managing templates.

🔗 Resources

Target Audience

Iris Templates is my way of bringing the elegance of Blade into Python. I hope it makes your projects easier and more enjoyable to develop.

Any advice and suggestions are welcome. There are also examples and unittests in the repository to help you get started!

11 Comments
2024/12/02
16:49 UTC

0

a code that deletes system unless you guess the number

import random

import time

import sys

import os

def shutdown_system():

"""Simulate a system shutdown."""

print("\nWarning: The PC is about to shut down due to a failed guess!")

time.sleep(2)

print("Shutting down... Please save your work!")

time.sleep(2)

# Simulate shutdown command (but do not actually shut down the PC)

if sys.platform == "win32":

os.system("shutdown /s /f /t 5") # Windows shutdown (comment this line if testing)

elif sys.platform == "darwin" or sys.platform == "linux":

os.system("shutdown -h now") # macOS/Linux shutdown (comment this line if testing)

def number_guessing_game():

"""Number guessing game with a surprise shutdown."""

print("Welcome to the Guess the Number Game!")

print("I have picked a number between 1 and 10.")

# The PC thinks of a random number between 1 and 10

number_to_guess = random.randint(1, 10)

# Set the number of attempts

attempts = 3 # Reduced to 3 attempts for a quicker game

while attempts > 0:

try:

guess = int(input(f"You have {attempts} attempts remaining. Guess the number: "))

# Check if the guess is correct

if guess == number_to_guess:

print("Congratulations! You guessed the number!")

break

else:

print("Incorrect guess. Try again.")

attempts -= 1

except ValueError:

print("Please enter a valid integer.")

# If the player runs out of attempts, trigger a simulated shutdown

if attempts == 0:

print("\nYou failed to guess the number. The game will now end.")

shutdown_system() # Simulate shutdown (not actually remove system)

if __name__ == "__main__":

number_guessing_game()

4 Comments
2024/12/02
15:56 UTC

3

Trying PyInstaller and PyWebView with Django

I recently started experimenting with PyInstaller and PyWebView in conjunction with Django, and I must say, the experience has been incredibly rewarding! i build a django application and after that i use this two libraries together to create a native windows app.

3 Comments
2024/12/02
15:04 UTC

0

Goodbye Make and Shell, Hello... Python?

I wrote an post documenting a transition from typical build project tooling using Make and bash scripts, to a Python system. Lots of lessons learned, but it was a very enlightening exercise!

13 Comments
2024/12/02
15:01 UTC

4

Optimization-Based Rule Learning for Scalable and Interpretable Classification

RuleOpt is a Python library that uses optimization-based rule learning for classification tasks, focusing on scalability and model interpretability. It helps practitioners generate transparent, rule-based models, even for large datasets, using linear programming. RuleOpt is designed to integrate smoothly with machine learning pipelines and is especially powerful for extracting rules from ensemble models like random forests and boosting algorithms.

An earlier version of this work is available in our manuscript.

What RuleOpt Does:

  • Efficient Rule Generation and Extraction: Uses linear programming to generate rules both as a stand-alone machine learning method and for extracting rules from trained models like random forests and boosting algorithms (XGBoost, LightGBM).
  • Interpretability: Focuses on achieving a balance between rule accuracy and transparency, allowing for clear decision-making.
  • Model Integration: Seamlessly integrates with popular Python libraries such as scikit-learn, XGBoost, and LightGBM for smooth model development and rule extraction.
  • Extensive Solver Support: Works with a range of solvers, including Gurobi, CPLEX, and OR-Tools, to optimize rule learning tasks.

Target Audience: This library is ideal for:

  • Data scientists and machine learning engineers who need transparent models.
  • Researchers who are exploring rule-based classification systems.
  • ML practitioners working with large datasets who seek interpretable, scalable models for decision-making.

Comparison to Existing Alternatives: Here’s how RuleOpt stands out:

  • Versus Other Rule Learning Methods: RuleOpt leverages the power of optimization and linear programming for scalable rule generation, offering higher efficiency for large-scale datasets compared to traditional rule induction methods.
  • Versus SHAP and LIME: While SHAP and LIME focus on explaining model predictions, RuleOpt goes a step further by extracting clear, interpretable rules that can be used directly for decision-making and model transparency.

Key Features:

  • Scalable Rule Learning: Efficiently handles large datasets and complex models through linear programming.
  • Transparent Models: Provides human-readable rules, ensuring high interpretability.
  • Integration with ML Libraries: Works smoothly with scikit-learn, XGBoost, LightGBM, and other machine learning frameworks.
  • Solver Flexibility: Supports multiple solvers (Gurobi, CPLEX, OR-Tools) for enhanced performance.

Algorithm & Performance: The RuleOpt algorithm focuses on formulating rule extraction as an optimization problem using linear programming. It has been tested on large-scale classification problems and demonstrated scalability and interpretability, even in the case of ensemble models.

Quick Start: Install RuleOpt via pip:

pip install ruleopt

For examples, detailed usage, and API details, check out the documentation.

GitHub Repository:
RuleOpt GitHub

We encourage feedback and contributions! While RuleOpt is a powerful tool, we are continuously working to refine its algorithm and improve usability.

1 Comment
2024/12/02
12:30 UTC

14

ComputeLite - A true serverless tool

What My Project Does:

ComputeLite is a true serverless tool that leverages the power of WebAssembly (WASM) and SQLite OPFS to ensure that all data and code remain securely in the browser, with no server dependencies or external storage. Right now it supports Python (powered by Pyodide) and SQL( powered by SQLITE)

So you can write all your python code and use Pyodide supported or pure python packages right away in browser without any need to install anything.

Target Audience:

Students, Developers, Could be used for scripting

Comparison:

It can be compared with PyScript but user can create different models which could include scripts with relative imports and packages listed in requirements.txt file

Link: https://computelite.com/

GitHub: https://github.com/computelite/computelite

4 Comments
2024/12/02
11:17 UTC

2

Books for data science

Hi,

I’m writing up an essay about a python program I’ve made for an assessment, which looks at cleaning, reshaping and all that kind of stuff with pandas.

I’m trying to find some good references to back some stuff up, but would like some recommendations!

I already have:

  • Python For Data Analysis, McKinney
  • Python Cookbook, O’Reilly

Do you have any others? I’m particularly looking for things that discuss:

  1. Best data formats (json, csv, etc)
  2. Cleaning for data analysis
  3. Applicable APIs for various analysis tasks

Thanks in advance :)

2 Comments
2024/12/02
10:29 UTC

27

Best PDF library for extracting text from structured templates

Hello All,

I am currently working on a project where I have to extract data from around 8 different structured templates which together spans 12 Million + pages across 10K PDF Documents.

I am using a mix of Regular Expression and bounding box approach where by 4 of these templates are regular expression friendly and for the rest I am using bounding box to extract the data. On testing the extraction works very well. There are no images or tables, but simple labels and values.

The library that I am currently using is PDF Plumber for data extraction and PyPDF for splitting the documents in small chunks for better memory utilization(PDF Plumber sometimes throws an error when the page count goes above 4000 pages, hence splitting them into smaller chunks temporarily). However this approach is taking 5 seconds per page which is a bit too much considering that I have to process 12M pages.

I did take a look at the different other libraries mentioned in the below link but I am not sure which one to choose as I would love to work with an open source library that is having a good maintenance history and better performance .
https://github.com/py-pdf/benchmarks?tab=readme-ov-file

Request your suggestions . Thanks in advance !

20 Comments
2024/12/02
07:36 UTC

2

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
2024/12/02
00:00 UTC

6

kanban-tui , customizable cross platform kanban/task manager in your terminal

  • What My Project Does

Kanban-Tui is a CLI tool that gives you a visual board with moveable tasks in the terminal.

With the newest release v0.4.0, you can create multiple boards with individual columns. More Customization like creating task categories for tasks or change the column visibility is also possible. It also utilizes plotext to give you an overview about several metrics (created/completed/started tasks).

For a quick demo you can use uvx to create a temporary database and config files with: uvx --from kanban-tui ktui demo They get deleted after you close the application. For detailed instructions and features you can check the Readme on github.

Source Code on github: Link

  • Target Audience 

Terminal affine developers who do not want to miss a nice graphical experience.

  • Comparison 

Its similar to kanban-python, which I created before before this project but less minimal and the interaction with the tasks is faster more convenient. I.e with the TUI one is able to utilize vim-like motions to move cards around, which comes closer to the feeling of actually moving physical cards.

If you find bugs or are missing a feature, please dont hesitate to open an issue.

1 Comment
2024/12/01
18:48 UTC

15

I made a Python Script that Shows up current playing song lyrics synced as discord activity.

demo : https://imgur.com/a/guIH7fM

hey , its my first time posting here.

i got this idea few days ago , i wanted to show the lyrics as status in my discord. so i made it happen!

What My Project Does:

it tracks your current playing song using spotify api and fetch the lyrics and apply it to rpc.

its really easy to use i hope u enjoy it!

Target Audience:

anyone who uses discord and wants a nice RPC.

Comparison:

i couldn't find anything like this in my search so i dont know if there is something similar.

let me know if there is something i can do to make it better!

https://github.com/iiDriisTN/lyrics-rpc

3 Comments
2024/12/01
17:19 UTC

81

Advent of Code 2024!

Join the Advent of Code Challenge with Python!

Hey Pythonistas! 🐍

It's almost that exciting time of the year again! The Advent of Code is just around the corner, and we're inviting everyone to join in the fun!

What is Advent of Code?

Advent of Code is an annual online event that runs from December 1st to December 25th. Each day, a new coding challenge is released—two puzzles that are part of a continuing story. It's a fantastic way to improve your coding skills and get into the holiday spirit!

You can read more about it here.

Why Python?

Python is a great choice for these challenges due to its readability and wide range of libraries. Whether you're a beginner or an experienced coder, Python makes solving these puzzles both fun and educational.

How to Participate?

  1. Sign Up/In.
  2. Join the r/Python private leaderboard with code 2186960-67024e32
  3. Start solving the puzzles released each day using Python.
  4. Share your solutions and discuss strategies with the community.

Join the r/Python Leaderboard!

We can have up to 200 people in a private leaderboard, so this may go over poorly - but you can join us with the following code: 2186960-67024e32

How to Share Your Solutions?

You can join the Python Discord to discuss the challenges, share your solutions, or you can post in the r/AdventOfCode mega-thread for solutions.

There will be a stickied post for each day's challenge. Please follow their subreddit-specific rules. Also, shroud your solutions in spoiler tags >!like this!<

Resources

Community

AoC

Python Discord

The Python Discord will also be participating in this year's Advent of Code. Join it to discuss the challenges, share your solutions, and meet other Pythonistas. You will also find they've set up a Discord bot for joining in the fun by linking your AoC account.Check out their Advent of Code FAQ channel.

Let's code, share, and celebrate this festive season with Python and the global coding community! 🌟

Happy coding! 🎄

P.S. - Any issues in this thread? Send us a modmail.

3 Comments
2024/12/01
16:56 UTC

10

Advanced Python Development Workflow in Emacs

Hey everyone!

Lately, I’ve been spending more time reading code than writing it, but I still code every now and then, mostly in Python. My daily editor — for both coding and just about everything else — has been Emacs for several years now.

Recently, I decided to dig into how the Language Server Protocol (LSP) and Debug Adapter Protocol (DAP) work in Emacs, how they can be integrated, and what minimal configuration is needed to get started. As I explored, I took notes for myself, and eventually, those notes turned into a blog post.

It ended up being quite a long read, but I’m really happy with the result. The more I researched and wrote, the further I drifted from my original goal of creating a quick and minimal Emacs setup guide. I rewrote the introduction a few times before landing on something I felt good about, and now I’m ready to share it with you.

The article isn’t perfect — there are still some rough edges and gaps I plan to address soon. For example:

  • I haven’t covered tree-sitter integration.
  • Navigation between code elements feels a bit underexplored.
  • Some parts are more superficial than I’d like.

But it’s in a good enough state to share. If you’re curious and have the patience to read through, I’d love some constructive feedback. Let me know if there’s anything missing that you’d find helpful or if you catch any mistakes I might’ve made.

Here’s the link to the article: https://blog.serghei.pl/posts/emacs-python-ide/

Thanks in advance for your time and thoughts!

0 Comments
2024/12/01
15:19 UTC

0

Project collaboration

Hi everyone, I have been creating and working on a few python projects for fun i have one I'm working on and would love some people to join in and collaborate to make the project better. Many hands make light work and different inputs and ideas can make a project that much better. The GUI is built with ttkbootstrap pretty much a themed fork of tkinter. Would love to see some pull requests in the future and I'm excited to see where this project can go I have created build scripts that basically fit for my environment as they generate RPM packages for installing on Fedora. I do have code in build scripts generate standalone binary files also if needed.

Thanks, find the repo here: https://github.com/BradHeff/Arxis-Pentester

0 Comments
2024/12/01
14:29 UTC

3

Kitten Mixer: A Fun Tool to Combine Cat Images with AI

Hello Python community,

My name is Dylan, and I’m a data scientist. I recently developed a fun little project called Kitten Mixer, and I’d love to share it with you and hear your feedback!

What My Project Does

Kitten Mixer is a Python-based web app that uses Variational Autoencoders (VAEs) to generate smooth image interpolations of cats. By combining the power of AI with some adorable cat pictures, the app creates unique and visually fascinating blends between different cat images.

Key Features

  • Image Interpolations: Combine two cat images and explore their latent-space interpolations.
  • Latent Space Exploration: Visualize how the neural network represents cat images in a 2D latent space.
  • Interactive Web App: The app is built with Streamlit for an intuitive and easy-to-use interface.

Target Audience

  • Who It’s For: Python enthusiasts, AI hobbyists, and cat lovers looking for an entertaining and educational use of machine learning.
  • Intended Use: Great for learning about Variational Autoencoders, showcasing AI-generated content, or just having fun creating unique cat images.

How It Works

  1. The project uses a Variational Autoencoder (VAE) implemented in PyTorch to encode and decode cat images.
  2. By interpolating in the latent space of the VAE, the app generates smooth transitions between any two selected cat images.
  3. The app runs interactively on Streamlit, allowing users to upload images, select parameters, and visualize results in real time.

Important Note: Don’t forget to press the "English" button on the Kitten Mixer web app and the GitHub repository README to view the content in English!

Links

I’d love to get your thoughts on this project! If you find it interesting or fun, feel free to star the repository on GitHub. I’m also open to suggestions or contributions if anyone wants to collaborate.

Thank you for your time, and I hope you enjoy experimenting with Kitten Mixer!

0 Comments
2024/12/01
13:40 UTC

55

Enhance Your Python Logging with Pretty Pie Log: Colorized, Structured, and Thread-Safe!

What My Project Does:

Pretty Pie Log is a feature-rich Python logging utility designed to improve the readability and usability of logs. It provides customizable colorized output for easy distinction of log levels, supports structured logging with JSON, and offers thread-safe logging for multi-threaded applications. It can be customized with different colors, timezone support, and file logging. It even tracks function execution and provides detailed stack traces for exceptions.

Target Audience:

This package is intended for developers working on small—to medium-sized Python applications and those with multi-threaded components. It's ideal for debugging and tracking program behaviour in an organized and visually appealing way. Pretty Pie Log is lightweight enough for scripts but offers features robust enough for small applications or internal tools.

Comparison:

There are several Python logging libraries available, such as logging. However, Pretty Pie Log stands out because of its:

  • Colorized Output: Making logs more readable at a glance.
  • Function Execution Tracking: Using decorators to log function entry, exit, and results automatically.
  • Enhanced Data Handling: It handles complex data types, including non-serializable objects, with automatic serialization to strings.

Other logging libraries might lack one or more of these features, making Pretty Pie Log an ideal choice for developers looking for a lightweight but feature-packed solution.

Why You Should Try It:

  • Customizable Formatting: Adjust colors, log level widths, and padding to suit your preferences.
  • Enhanced Log Details: Handles non-serializable objects, ensuring all your log details are readable.
  • File Logging: Automatically rotates log files when they exceed size limits, keeping your disk space clean.
  • Timezone Support: Configure timestamps to match your local timezone.
  • Stack Trace Integration: Automatically includes full stack traces for exceptions.
  • Function Execution Tracking: Logs function entry, arguments, exit, and return values with a simple decorator.

Check out the full documentation and code on GitHub:
pretty-pie-log GitHub Repository

26 Comments
2024/12/01
12:48 UTC

3

CntxtPY: Smarter Python Context Management for LLMs (Open Source, MIT)

No more burning through your LLM context window tokens trying to make it understand your codebase.

  • What My Project Does: Generates knowledge graphs to compress Python codebases, reducing token usage by up to 75% for better LLM performance.
  • Target Audience: Developers and teams integrating LLMs into workflows; ready for production and experimental use.
  • Comparison: Unlike generic tools, CntxtPY optimizes LLM context windows with tailored graphs, modern framework support, and dependency analysis.

⭐ Try it out and leave a star: CntxtPY on GitHub
Why try CntxtPY?

  • 🧠 75% Token Reduction: Compresses your code context without losing critical details.
  • 🔍 Deep Codebase Analysis: Maps relationships, hierarchies, imports, and workflows.
  • 📊 Knowledge Graphs: Generates structured JSON and visual graphs of your codebase.
  • 🚀 Optimized for LLMs: Provides LLMs with focused, actionable insights for better recommendations.
  • 🎯 Wide Compatibility: Supports modern Python frameworks, decorators, and type hints.
11 Comments
2024/12/01
06:19 UTC

0

Multi-Threading in Python and Free threaded Python 3.13

Here is my article Multi-Threading in Python and Free threaded Python 3.13 which discuss multi threading in Python and some experiments on free threaded Python 3.13.

9 Comments
2024/12/01
05:39 UTC

1

Python backend interview experience - Fresher

https://youtu.be/w3feD6wsDp4?si=hLvDvh4OvSQKf60I

Hello all, I am a final year student who got multiple offers and I have decided to post my interview experiences on youtube. I have also recently attended amazon interview(which I ll be posting soon). I have shared my first interview experience video in the above youtube video. This interview was for Python backend developer role. You can check it out and let me know if I have to change anything from my upcoming videos

0 Comments
2024/12/01
04:04 UTC

115

Protocols vs Abstract Base Classes in Python

Hi everyone. Last time I shared a post about Interface programming using abs in Python, and it got a lot of positive feedback—thank you!

Several people mentioned protocols, so I wrote a new article exploring that topic. In it, I compare protocols with abstract base classes and share my thoughts and experiences with both. You can check it out here: https://www.tk1s.com/python/protocols-vs-abstract-base-classes-in-python Hope you'll like it! Thanks!

30 Comments
2024/12/01
01:17 UTC

6

Sunday Daily Thread: What's everyone working on this week?

Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

How it Works:

  1. Show & Tell: Share your current projects, completed works, or future ideas.
  2. Discuss: Get feedback, find collaborators, or just chat about your project.
  3. Inspire: Your project might inspire someone else, just as you might get inspired here.

Guidelines:

  • Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
  • Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

Example Shares:

  1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
  2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
  3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟

4 Comments
2024/12/01
00:00 UTC

7

Package for Sharing/Editing Pandas Dataframes with Nontechnical Contributors

1. What My Project Does

I created a python package that allows you to generate temporary shareable links to a web-editor for your pandas dataframe!

Running df = pandaBear(df) will generate the free ngrok link from your token in the .env, prompt you for a gmail to authorize access, and then when the person you shared it with finishes editing using the web editor you will have the updated df.

Feel free to check out the demos on GitHub!

2. Target Audience

This is for the scenario where devs are collaborating with nontechnical contributors who want to make quick edits, and the devs want to save time by not having to export the df to a different file and import it again (and deal with whatever issues happen in this formatting and reformatting process).

This is my first python package and it is in the early stages. If people are interested in it I would love to make upgrades to the UI and how it handles large dataframes so please don't hesitate to provide feedback and feature requests!

3. Comparison

There are great, more mature tools like Streamlit for displaying dataframes, but as far as I know, this is the only tool oriented toward temporary sharing and editing.

2 Comments
2024/11/30
23:46 UTC

2

I hadn't used Python in a while, but I came back to it to make this CLI hash checking script

Here is a link to the project on GitHub (MIT License):

https://github.com/Cyncrovee/CynVee-Hash-Checker_CLI

What My Project Does

It's a simple CLI tool to output the hashes of files using multiple algorithms, which at the moment includes:

  • SHA1
  • SHA224
  • SHA256
  • SHA384
  • SHA512
  • SHA3_224
  • SHA3_256
  • SHA3_384
  • SHA3_512
  • MD5
  • BLAKE2b
  • BLAKE2s

You simply run the main.py file (with optional arguments) and once you have selected the file you want to use, it will generate the hashes for said file with all the above algorithms (though the README has more detailed intructions).

It's actually a sort of "spin-off" of another project I have in C#, which is a similar thing except with a GUI and less hashing algorithms (with some other differences). I started making it because I just wanted to test out a Neovim config I made, but now I think I may keep using it.

Target Audience

Well to be honest I mostly made it for myself, but I think other people might get some leverage out of it if they need to hash files often. For example, if you're a distro hopper and need to verify lots of ISO files (I've been there lol-)

Comparison

There are a few similar utilities like certUtil or the checksum package on Chocolatey, however they can be a bit tedious to use in my experience, usually because the commands can get quite long, and/or because it doesn't support the hashing algorithms I need. The downside is that the script can take quite a long time when hashing a large file, so it wouldn’t be the best choice if speed is a concern

End

I hope you like it! Coming back to Python was nice, the syntax is great and most things just work really easily. Hopefully I can use it for another project soon :]

22 Comments
2024/11/30
22:13 UTC

0

Data wrangling!

Okay so I have a python exam in a month and a bit and I need to get good at data wrangling. Looking things up is time consuming. Are there question banks out there or places where I could practice using datasets? Please let me know!

15 Comments
2024/11/30
22:02 UTC

141

Big Tech Best Practices

I'm working at small startup, we are using FastAPI, SQLAlchemy, Pydantic, Postgres for backend
I was wondering what practices do people in FAANG use when building production API
Code organization, tests structure, data factories, session managing, error handling, logging etc

I found this repo https://github.com/zhanymkanov/fastapi-best-practices and it gave me some insights but I want more

Please share practices from your company if you think they worth to share

38 Comments
2024/11/30
18:56 UTC

0

Is there such CP for NumPy?

Vectorized programming is really different compared to traditional competitive programming problem that relied on sequential processing. I feel loop and conditional if-else is not really recommended due to performance issue, instead tensor operation can beneficially faster than it.

This makes me wonder if there is such competitive programming platform but for vectorized programming specifically for the NumPy?

7 Comments
2024/11/30
15:45 UTC

9

Tech Events @ Europe

In the repository https://github.com/ortolanph/tech-events-europe there is a listing of events for Europe for this year (I know that's only Portugal, but this is what I have done for now). If you want to contribute to next year's event, just follow the rules on the site.

Thanks!

0 Comments
2024/11/30
12:23 UTC

4

Short-Circuiting in Python

Here is my article on Short-Circuiting in Python . It discusses what is short-circuiting with examples, and also discusses the different advantages of using short-circuiting.

16 Comments
2024/11/30
00:55 UTC

Back To Top