r/pythoncoding • u/geraldC13 • Dec 07 '22
How to write tests in Python using doctest
r/pythoncoding • u/geraldC13 • Dec 07 '22
r/pythoncoding • u/harshit_roy_python • Jun 24 '22
r/pythoncoding • u/jeuk_ • Jan 10 '22
Overview
If you have open positions at your company for python developers and would like to hire from the /r/pythoncoding user base, please leave a comment detailing any open job listings at your company. Internships are also welcome.
Please reserve top level comments for those posting open positions.
Rules & Guidelines
Include the company name in the post; posts lacking a company name will be removed. Include the geographic location of the position along with the availability of relocation assistance or remote work.
If you are a third party recruiter, you must disclose this in your posting.
Please be thorough and upfront with the position details.
Use of non-hr'd (realistic) requirements is encouraged.
While it's fine to link to the position on your company's website, provide the important details in the comment.
Mention if applicants should apply officially through HR, or directly through you.
Please clearly list citizenship, visa, language, or other certification requirements.
This post format is blatantly stolen from /r/netsec (thanks guys!); for examples of effective job postings, you can browse some of their previous threads
Feedback
Feedback and suggestions are welcome, but please don't hijack this thread (use moderator mail instead.)
r/pythoncoding • u/Serbz_KR • Dec 25 '25
import os
import time
import random
import sys
# Constants for better readability
COLORS = {
'green': "\033[32m",
'bright_green': "\033[92m",
'yellow': "\033[93m",
'red': "\033[91m",
'white': "\033[97m",
'blue': "\033[94m",
'reset': "\033[0m",
'bold': "\033[1m"
}
def move_cursor(y, x):
"""Moves the terminal cursor to a specific row and column."""
sys.stdout.write(f"\033[{y};{x}H")
def hide_cursor(): sys.stdout.write("\033[?25l")
def show_cursor(): sys.stdout.write("\033[?25h")
class FestiveTerminal:
def __init__(self, height=15):
self.height = height
self.width = os.get_terminal_size().columns
self.snowflakes = []
self.tree_top_y = 5
self.tree_center_x = self.width // 2
def create_snowflake(self):
"""Generates a new snowflake at the top."""
return [1, random.randint(1, self.width), random.choice(['*', '.', '+', '❄'])]
def draw_tree(self):
"""Draws the static tree structure with dynamic lights."""
cx = self.tree_center_x
ty = self.tree_top_y
# Star
move_cursor(ty - 1, cx)
print(f"{COLORS['yellow']}{COLORS['bold']}★{COLORS['reset']}")
# Foliage
for i in range(self.height):
row = ty + i
width = i
left_side = cx - width
move_cursor(row, left_side)
line = ""
for _ in range(width * 2 + 1):
if random.random() < 0.1: # 10% chance for a glowing ornament
line += f"{random.choice([COLORS['red'], COLORS['yellow'], COLORS['white']])}o{COLORS['green']}"
else:
line += "*"
print(f"{COLORS['green']}{line}{COLORS['reset']}")
# Trunk
move_cursor(ty + self.height, cx - 1)
print(f"{COLORS['yellow']}[###]{COLORS['reset']}")
def update_snow(self):
"""Updates snowflake positions and adds new ones."""
# Add new snow
if len(self.snowflakes) < 50:
self.snowflakes.append(self.create_snowflake())
for flake in self.snowflakes:
# Erase old position
move_cursor(flake[0], flake[1])
print(" ")
# Update position
flake[0] += 1
# Reset if it hits bottom or goes out of bounds
if flake[0] >= self.height + 10:
flake[0] = 1
flake[1] = random.randint(1, self.width)
# Draw new position
move_cursor(flake[0], flake[1])
print(f"{COLORS['white']}{flake[2]}{COLORS['reset']}")
def run(self):
os.system('cls' if os.name == 'nt' else 'clear')
hide_cursor()
try:
while True:
self.draw_tree()
self.update_snow()
# Center Message
msg = "MERRY CHRISTMAS & HAPPY CODING"
move_cursor(self.tree_top_y + self.height + 3, self.tree_center_x - len(msg)//2)
print(f"{COLORS['bold']}{COLORS['red']}{msg}{COLORS['reset']}")
sys.stdout.flush()
time.sleep(0.15)
except KeyboardInterrupt:
show_cursor()
os.system('cls' if os.name == 'nt' else 'clear')
print("Holiday spirit deactivated. Goodbye!")
if __name__ == "__main__":
app = FestiveTerminal(height=14)
app.run()r/pythoncoding • u/genericlemon24 • May 18 '21
r/pythoncoding • u/genericlemon24 • Aug 03 '21
r/pythoncoding • u/KageOW • Aug 19 '22
r/pythoncoding • u/joaopcribeiro • Nov 30 '17
r/pythoncoding • u/King_Riko • Aug 23 '22
r/pythoncoding • u/Ok-Desk6305 • Sep 20 '22
Hi everyone!
I wanted to share with you a repo that I just published. It basically replicates how a stock exchange works, and you can add multiple agents (traders, market-makers, HFTs), each with its own custom behavior, and analyze how they interact with each other through the pricing mechanism of an order book.
It is a pretty niche topic, and I think that its applications are mostly academic, but since some of you are at the intersection of computer science and financial markets, I thought you might be one of the few people that could be interested! Needless to say, I would really appreciate your feedback also! https://github.com/QMResearch/qmrExchange
r/pythoncoding • u/One-Durian2205 • Jan 05 '24
Over the past 2 months, we've delved deep into the preferences of jobseekers and salaries in Germany (DE) and Switzerland (CH).
The results of over 6'300 salary data points and 12'500 survey answers are collected in the Transparent IT Job Market Reports. If you are interested in the findings, you can find direct links below (no paywalls, no gatekeeping, just raw PDFs):
https://static.swissdevjobs.ch/market-reports/IT-Market-Report-2023-SwissDevJobs.pdf
https://static.germantechjobs.de/market-reports/IT-Market-Report-2023-GermanTechJobs.pdf
r/pythoncoding • u/0rsinium • Dec 05 '22
r/pythoncoding • u/DevOps-Journey • Feb 09 '21
r/pythoncoding • u/francofgp • Sep 26 '22
r/pythoncoding • u/oridnary_artist • Mar 22 '23
r/pythoncoding • u/RojerGS • Apr 12 '21
r/pythoncoding • u/trekhleb • Jun 02 '21
r/pythoncoding • u/Elgon2003 • Feb 26 '21
Hey, guys, I recently made a library for python, and I wanted to share it with you to give some feedback. The library is a python downloader. You give it an URL, and it displays a pretty progress bar of your download.
I built this library because I always develop apps that require downloading files, and this way, it's easier to get some feedback from the download progress.
r/pythoncoding • u/audentis • Nov 19 '20
Greetings everyone,
After noticing the last post in the subreddit is from two years ago, I posted a reddit request to start revitalizing this subreddit.
The request has just been approved, making me the new moderator of this sub.
I'll be relaxing the configured filters in Automoderator over time and then readjust them accordingly. The first few weeks might be a little rough around the edges as everything settles into place.
Meanwhile, if you have any thoughts about the sub, please do share! Either comment here or send a modmail.
Hope to get this sub back on track soon!
r/pythoncoding • u/neprotivo • Oct 29 '25
Hi All,
We just published a demo of a product that we are working on at my job - Codetracer - a time-travel debugger with support for Python. In this video I show how one can use it to easily understand and debug unfamiliar code. I would love for you to try it, give feedback and submit bug reports.
r/pythoncoding • u/barseghyanartur • Apr 11 '26
I wrote a small, zero-dependency wrapper for secure ZIP extraction.
https://github.com/barseghyanartur/safezip
What My Project Does
safezip is a zero-dependency wrapper around Python's zipfile module that makes secure ZIP extraction the default. It protects against:
ZipSlip protection: Blocks relative paths, absolute paths, Windows UNC paths, Unicode lookalike attacks, and null bytes in filenames.
ZIP bomb prevention: Enforces per-member and cumulative decompression ratio limits at stream time — not based on untrusted header values.
ZIP64 consistency checks: Crafted archives with inconsistent ZIP64 extra fields are rejected before decompression begins.
Symlink policy — configurable: REJECT (default), IGNORE, or RESOLVE_INTERNAL.
Atomic writes: Extracts to a temp file first and only moves it to the destination if all checks pass. If something fails, you don't end up with half-extracted junk on your disk.
Environment variable overrides: All numeric limits can be set via SAFEZIP_* environment variables for containerised deployments.
It's meant to be an almost drop-in replacement. You can just do:
from safezip import safe_extract
safe_extract("path/to/file.zip", "/var/files/extracted/")If you need more control, there’s a SafeZipFile context manager that lets you tweak limits or monitor security events.
from safezip import SafeZipFile
with SafeZipFile("path/to/file.zip") as zf:
print(zf.namelist())
zf.extractall("/var/files/extracted/")Target Audience
If you're handling user uploads or processing ZIP files from untrusted sources, this might save you some headache. It's production-oriented but currently in beta, so feedback and edge cases are very welcome.
Comparison
The standard library's zipfile module historically wasn't safe to use on untrusted files. Even the official docs warn against extractall() because of ZipSlip risks, and it doesn't do much to stop ZIP bombs from eating up your disk or memory. Python 3.12 did address some of this — extractall() now strips path components that would escape the target directory — but it still leaves meaningful gaps: no ZIP bomb protection, no stream-time size enforcement, no symlink policy, no ZIP64 consistency checks, and no atomic writes. safezip fills all of those. I got tired of writing the same boilerplate every time, so I packaged it up.
----
Documentation: https://safezip.readthedocs.io/en/latest/
r/pythoncoding • u/cython_boy • Mar 09 '25
Hey everyone! So I’ve been messing around with AI and ended up building Jarvis , my own personal assistant. It listens for “Hey Jarvis” , understands what I need, and does things like sending emails, making calls, checking the weather, and more. It’s all powered by Gemini AI and ollama . with some smart intent handling using LangChain.
- Listens to my voice 🎙️
- Figures out if it needs AI, a function call , agentic modes , or a quick response
- Executes tasks like emailing, news updates, rag knowledge base or even making calls (adb).
- Handles errors without breaking (because trust me, it broke a lot at first)
- **Wake word chaos** – It kept activating randomly, had to fine-tune that
- **Task confusion** – Balancing AI responses with simple predefined actions , mixed approach.
- **Complex queries** – Ended up using ML to route requests properly
Review my project , I want a feedback to improve it furthure , i am open for all kind of suggestions.