r/Python • u/Extreme_Being7689 • 1d ago
Discussion pyinstall --onedir vs --onefile
Which one better? Currently I am using --onefile. But facing some tmpfs problem. What do you suggest?
Does --onefile actually shrinks the app size?
r/Python • u/AutoModerator • 11h ago
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!
Let's build and grow together! Share your journey and learn from others. Happy coding! ๐
r/Python • u/Extreme_Being7689 • 1d ago
Which one better? Currently I am using --onefile. But facing some tmpfs problem. What do you suggest?
Does --onefile actually shrinks the app size?
r/Python • u/AutoModerator • 1d ago
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
Share the knowledge, enrich the community. Happy learning! ๐
r/Python • u/Beginning-Fruit-1397 • 1d ago
Each time l see this sub it's about wathever package I don't use that got compromised which I couldn't care less about. Now that all code showcase are banned, the new ways for sloppers to feel seen is report security issues. At least the former was still related to code, cybersecurity is another thing completely. I'd rathet see slop code showcases than a boring report about x package hacked
r/Python • u/Business-Feedback635 • 2d ago
Python runs any line that starts with import in a .pth file in site-packages, every time it starts. You don't have to import the package. This year, the malicious releases of litellm (March and October) and agent-framework (November) all used a .pth file, so installing them was enough to run the credential stealer.
I wanted to see how many ordinary packages use the same feature. I took the latest release of 354,763 PyPI projects, found every .pth file with an import line, downloaded them and read them. The results:
.pth file that runs on every Python start.-nspkg.pth).urllib3 folder at startup.import lines (PEP 829), and 3.18 will ignore them. Only 13 of the 244 packages already ship the replacement .start file.The post includes a command that lists the .pth files with import lines in your own environment, and a table of what the 15 most downloaded ones do: https://py-code.org/blog/python-pth-files-pypi/
r/Python • u/AutoModerator • 2d ago
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
Let's keep the conversation going. Happy discussing! ๐
r/Python • u/enterthearena44 • 3d ago
I was reading about yesterday's Microsoft Agent Framework security incident, and something caught my attention.
Apparently, attackers published two malicious versions (1.26.1 and 1.26.2) of Microsoft's official Python package on PyPI. These versions could steal cloud credentials just by starting Python.
Both versions were removed quickly.
What surprised me was that the malicious code wasn't even checked into Microsoft's GitHub repository.
From what I understand:
- Developers write code in GitHub.
- CI/CD builds it into a Python wheel (.whl).
- The wheel gets published to PyPI.
- When we run "pip install", we download that package.
But apparently, someone with the right publishing credentials can upload a malicious wheel directly, without going through the original GitHub repository.
That raises some interesting questions:
I'm still learning about software supply-chain security, so I'd love to hear how experienced Python developers and security engineers think this should work.
r/Python • u/AutoModerator • 3d ago
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
Let's help each other grow in our careers and education. Happy discussing! ๐
r/Python • u/OriginalHistorian522 • 3d ago
Hey everyone! If youโre a college student interested in Applied AI Engineering, Cybersecurity, Web Development, or Technical Interview Prep, check out CodePathโs free Spring 2027 courses.
Iโm a Tech Fellow (TF) teaching Technical Interview Prep (TIP), and I highly recommend it if you want to learn data structures and algorithms in Python or get more comfortable with coding interviews. We practice breaking down problems, choosing the right data structure, and explaining our reasoning out loud. That last part makes a big difference when an interviewer asks you to walk through your approach.
If youโre interested, apply to CodePath here. Thatโs my referral link.
Happy to answer questions about TIP or what itโs like to take the course!
r/Python • u/BattleRemote3157 • 4d ago
1.26.1 and 1.26.2 both ship a credential stealer. It runs from a .pth file, so it executes at interpreter startup. Nothing has to import the package, a pip install in CI is enough. 1.26.1 got pulled, then 1.26.2 went up 33 minutes later with the same payload under different file names. Last clean release is 1.26.0.
complete details- https://safedep.io/blog/microsoft-agent-framework-pypi-compromise
r/Python • u/AutoModerator • 5d ago
Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.
Let's deepen our Python knowledge together. Happy coding! ๐
r/Python • u/Impossible-Ad-6925 • 5d ago
What My Project Does
git-wrapped reads your local git history and gives you a "year in review": a colored contribution heatmap in your terminal, plus a shareable 1080x1350 card (SVG or PNG) with your commits, active days, longest streak, peak coding hour, top languages and a "persona" for your year (Night Owl, Early Bird, Weekend Warrior...).
It can scan a whole folder of repos at once and de-duplicates commits.
Target Audience
Any developer who wants a fun, shareable recap of their year. It's a hobby/side project, not production tooling.
Comparison
Many GitHub stats widgets rely on the GitHub API and a token. git-wrapped only runs `git log` locally, so it works offline, with private repos and non-GitHub repos, and it has no Python dependencies (PNG export uses a renderer you already have, like Chrome or rsvg-convert).
Usage
pip install git+https://github.com/Mohammadsdq/git-wrapped
git-wrapped ~/projects --year 2026 --png
My own year, for fun: 74 commits, peak hour 11pm, favorite commit word "upload" (10x). Apparently I'm a "Steady Builder".
Repo: Github Repo
r/Python • u/AutoModerator • 6d ago
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.
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
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
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! ๐
r/Python • u/Ashamed-Calendar-139 • 7d ago
Hey folks! Iโve been playing with agentic coding and wondering if itโs actually worth adding Python-specific skills to my setup.
For those of you using them: which ones are genuinely useful? Any examples where a Python-specific skill noticeably improved the result vs just letting the agent figure things out on its own?
r/Python • u/AutoModerator • 7d ago
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!
Let's build and grow together! Share your journey and learn from others. Happy coding! ๐
r/Python • u/AutoModerator • 8d ago
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
Share the knowledge, enrich the community. Happy learning! ๐
r/Python • u/Sensitive-Raccoon155 • 8d ago
I'm using PyCharm with Python 3.13 and trying to implement a generic CQRS pattern.
I explicitly specify int as the response type, but PyCharm doesn't report any error when the handler returns str.
from abc import ABC, abstractmethod
from typing import Generic, TypeVar
TCommand = TypeVar("TCommand", bound="Command")
TResponse = TypeVar("TResponse")
class Command(ABC, Generic[TResponse]):
pass
class CommandHandler(ABC, Generic[TCommand, TResponse]):
@abstractmethod
async def handle(self, command: TCommand) -> TResponse:
pass
class CreateUserCommand(Command[int]):
pass
class CreateUserCommandHandler(CommandHandler[CreateUserCommand, int]):
async def handle(self, command: CreateUserCommand) -> str:
return "123"
Is this expected behavior, or am I missing something in my generic type definitions?
r/Python • u/DistributionBrief644 • 9d ago
LLMs are still outputting code that is too sloppy for some engineers. However, there will come a point in the near future where a model can write a "standard" style of code. Style of code is something most python developers recognise, and i wonder if that conversation has started yet.
r/Python • u/Quantititoo • 9d ago
I keep hearing that AI now writes most of the code at some companies. For people actually shipping Python with Claude Code, Cursor or Copilot:
Context: I work in risk and data and am deciding what to get good at next. Real examples would help more than opinions. Thanks!
r/Python • u/AutoModerator • 9d ago
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
Let's keep the conversation going. Happy discussing! ๐
r/Python • u/Stunning-Sherbet1853 • 9d ago
HI, i run a long-lived python backend on windows and mac!
it only listens on 127.0.0.1 and almost every route needs an access token. last week i turned on the default CodeQL scan for the first time and got 112 alerts ( 112 โ 1 critical, 87 high, 24 medium).
i went through them one by one with a single question: can this value come from text someone else wrote (a web page, a downloaded file, model output)? where an alert described an attack input, i actually fed it in and timed it.
the first one that surprised me was the regex that checks whether a downloaded file is html. `<!--\` followed by \`--><!--` 28 times kept it busy for 27 seconds. two more regexes that read text we didn't write did the same thing (22s and 11s). six alerts in that family were real. after the fix the html check runs 5,000 times in 0.003s.
the one i'm most embarrassed about: to see whether a login had finished, i checked whether the url contained the site name. so `evil.example/?next=naver.com` passed as a finished login, and `evilnaver.com` counted as the same site. seven alerts across different files. now one small helper pulls out the hostname and checks "equal, or ends with `.domain`", and all seven places use it. the last real one was a script tag filter that let `</script foo>` through.
every fix got a test, and i checked that the test fails when the fix is taken out.
the other 98 i dismissed with a one-line reason each. 42 of them were in my own tests, lines that just write down the url a test expects. most of the rest were path injection or stack trace exposure on routes that need the token anyway. i only traced two of the path ones all the way, so i might be wrong about a couple.
the same "incomplete url substring" rule was noise all 42 times in tests and a real hole in the login check. asking where the value comes from got me through it faster than reading the alert type.
how do you deal with this on a localhost-only or solo project? i dismissed with reasons but i'm not sure that scales.
r/Python • u/AutoModerator • 10d ago
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
Let's help each other grow in our careers and education. Happy discussing! ๐
r/Python • u/com_kieffer • 11d ago
The title is obviously tongue in cheek, but in 100 lines we can get a quite a lot done to type-check dataclasses.
https://thibaud.space/2026/10/pydantic-in-100-lines-part-1.html
r/Python
•
u/ExoticMandibles
•
11d ago
Tim died July 15, at his home in Ashland, Wisconsin. He was 74. We don't know any specifics yet.
In case you don't know who Tim Peters is, he was an early pioneer in helping shape the Python language and its runtime. He invented a new sorting algorithm ("Timsort"); a descendent of it ("PowerSort") is still used in Python today, as well as in Java, and several Javascript runtimes (Chrome, Node). He dashed off The Zen Of Python in response to a Usenet post asking about best practices. So many things in Python are directly due to Tim. Online, he was funny, charming, helpful, and had a depth of knowledge and wisdom that was frankly unmatched. He'll be missed.
https://www.bratleyfamilyfuneralhomes.com/obituary/timothy-peters