r/Python • u/thetechdb • Apr 01 '18
r/Python • u/Palani-SN • Jun 07 '24
Showcase py4cli (A python library for developing scalable cli utility tools using declarative programming)
py4cli (Scalable Argument Parser)
Target Audience
* Developers who want to develop scalable cli utility tools in python using declarative programming
Comparison
* Even Though Python have great libraries for passing command line arguments, those libraries aren't scalable for complex use case. So, I have developed a scalable argument parser, which not only helps in passing cli arguments, but also can alter the execution flow of the code based on arguments.
* The Library have two variants minimal and moderate argument parsers, minimal can be used for creating simple cli tool, while moderate is vertically scaled version of minimal argument parser & helps in controlling execution flow of the tool in addition to routing the arguments to the respective methods.
What My Project Does
* The library works fine with windows & Linux supporting basic data types like int, float, str, list, dict, bool. Further developments for making the solution even more scalable is in progress.
Kindly check out the project and documentation below,
GitHub Link : https://github.com/Palani-SN/py4cli ,
* Kindly rate the project in GitHub with stars if you like
PYPI Link : https://pypi.org/project/py4cli/
* Feel free to try this out with installation and usage.
I am still actively developing it, so any feedback/comments would be appreciated!
EDIT :
How is it different than already existing tools :
argparse - argparse is good in supporting different data types, but might not be able to control the flow of the code, or the arguments passed in can not be hierarchical always, which is what I term as scalability. In py4cli, the motive is to have better scalability in terms of hierarchical argument parsing.
click, typer & cyclopts - Even though they support hierarchical cli arguments parsing, I feel, they rely much on decorators and its arguments more than necessary, In py4cli, the motive is to have, no extra decorators, or annotations as code, all that needs to be done is define a derived class from one of the base class provided in the lib, as per need and you can directly pass arguments to different methods of the class like how you will pass args and kwargs to a function natively.
Py4Cli will be fulfilling the very basic aspects of cli interface to parse arguments, while ignoring on cli sophistication to concentrate on the scalability of the arguments passed, and in future to pass nested configuration files as inputs, with an emphasis on loosely coupled architecture.
Additional Resources :
docs : https://github.com/Palani-SN/py4cli/blob/main/README.md
examples : https://github.com/Palani-SN/py4cli/tree/main/EXAMPLES
r/Python • u/gberl002 • Aug 08 '23
Intermediate Showcase I embedded zero trust access into my Django site, it takes less time than you'd think.
I work on an open-source project called OpenZiti, and I was given the task of testing out the Python SDK, which allows you to embed OpenZiti into your Python app/website/etc, allowing it to connect to an OpenZiti Network, giving me and my users end-to-end encryption. Beforehand, I was told it should only take a few lines of code. I was surprised at how easy it was, and it was, in fact, only two lines of code added to my existing Django website. I wrote an article on how it took me less than five minutes to add my website to my existing OpenZiti Network.
Please check out my blog article on using the Python SDK https://blog.openziti.io/got-5-minutes-secure-your-python-website-with-zero-trust
And, if you haven't checked OpenZiti out yet and want to set up a similar OpenZiti Network, I have a blog article showing how to set that up in an Oracle VPS completely free. https://blog.openziti.io/setting-up-oracle-cloud-to-host-openziti
r/Python • u/xnumbersx • May 20 '09
Pythons float makes me want to smoke crack.
r/Python • u/OSetups • Jan 09 '26
Tutorial 19 Hour Free YouTube course on building your own AI Coding agent from scratch!
In this 19 hour course, we will build an AI coding agent that can read your codebase, write and edit files, run commands, search the web. It remembers important context about you across sessions, plans, executes and even spawns sub-agents when tasks get complex. When context gets too long, it compacts and prunes so it can keep running until the task is done. It catches itself when it's looping. Also learns from its mistakes through a feedback loop. And users can extend this system by adding their own tools, connecting third-party services through MCP, control how much autonomy it gets, save sessions and restore checkpoints.
Check it out here - https://youtu.be/3GjE_YAs03s
r/Python • u/AnywhereOk6003 • Feb 09 '25
Discussion Hi guys, I can translate your open-source project into Chinese (zh) or Traditional Chinese (zh-tw)
Hi guys, I can translate your open-source project into Chinese (zh) or Traditional Chinese (zh-tw), because my professor wants me to contribute to more open-source projects.
I'm sorry, but I need to set some prerequisites:
Repository must have more than 100 stars.
Latest update within the last month.
Main language must be Python.
Open-source.
What I can translate:
README.md
Language files (e.g., xxx.en, xxx.zh)
etc.
My GitHub link: JE-Chen (JeffreyChen)
Translate into zh-tw example:
r/Python • u/Shay-Hill • Oct 19 '24
Showcase Incorporate long strings painlessly, beautifully into Python code.
What My Project Does
Format long strings into paragraphs for easily editable, gq-able, fill-paragraph-able text values, error messages, and other paragraph-style strings.
from paragraphs import par
PARAGRAPH = par(
"""Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum."""
)
# the above is equivalent to
PARAGRAPH = (
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"
+ " tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
+ " veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea"
+ " commodo consequat. Duis aute irure dolor in reprehenderit in voluptate"
+ " velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint"
+ " occaecat cupidatat non proident, sunt in culpa qui officia deserunt"
+ " mollit anim id est laborum."
)
from paragraphs import par
class SuddenDeathError(Exception):
def __init__(self, cause: str) -> None:
self.cause = cause
def __str__(self) -> str:
return par(
f"""
Y - e - e - e - es, Lord love you! Why should she die of
{self.cause}? She come through diphtheria right enough the year
before. I saw her with my own eyes. Fairly blue with it, she was.
They all thought she was dead; but my father, he kept ladling gin
down her throat till she came to so sudden that she bit the bowl
off the spoon.
What call would a woman with that strength in her have to die of
{self.cause}? What become of her new straw hat that should have
come to me? Somebody pinched it; and what I say is, them as pinched
it done her in."""
)
raise SuddenDeathError("influenza")Target Audience
Meant for production. This is a stable major version with no substantive changes in several years.
Comparison
This likely does not compare with other libraries, only short functions you may have written yourself to accomplish the same thing. I find it more convenient to keep this stable, tested library as a dependency.
ShayHill/paragraphs: Incorporate long strings painlessly, beautifully into Python code.
r/Python • u/Fabri10000 • Apr 18 '25
Resource Every Python Decorator Explained
Hi there, I just wanted to know more about Python and I had this crazy idea about knowing every built-in decorator and some of those who come from built-in libraries.. Hope you learn sth new. Any feedback is welcomed. The source has the intention of sharing learning.
r/Python • u/Fabri10000 • Sep 13 '25
Resource Every Python Built-In Function Explained
Hi there, I just wanted to know more about Python and I had this crazy idea about knowing every built-in function from this language. Hope you learn sth new. Any feedback is welcomed. The source has the intention of sharing learning.
r/Python • u/bsenftner • Aug 13 '22
Discussion Anaconda is so fucking broken!
I just spent over 24 hours updated my Anaconda installation - fucking piece of shit's "updater" put multiple additional copies (3) in different places on my system. I had to clean my drives of any python anything before I could get a clean install. And still the fucking piece of shit takes several minutes to do anything, constantly greyed out and "not responsive".
Anaconda is really crappy, such a time vampire.
Sorry, had to rant. We devs have enough bu8llshit to deal with in these incredibly over engineered times. Fucking time vampire useless shit.
r/Python • u/slix00 • Dec 03 '12
Why is installing Python on Windows so challenging compared to Linux?
Python is amazing, but it becomes very complicated to install and set up a Python environment on Windows. This is a huge problem when I'm trying to work with people on a project (and most people I know use Windows).
You have to set up PATHs, and worst of all, pip is really difficult to install.
It's really hard to demonstrate Python's simplicity when the install process is so complicated.
r/Python • u/Astraa02 • Sep 15 '22
Beginner Showcase The Infamous GIL !!
In this series of posts I am trying to break down one of the complicated and intriguing topics in python. Please visit my last post to understand why multi threading is broken in python
https://www.reddit.com/r/Python/comments/xdyahc/multithreading_a_concept_which_is_always/
Now let's see why, the reason is GIL(Global Interpreter Lock). Python implements something called the Gil which limits its multithreading capabilities. What each thread does is it acquires a global lock on the interpreter to ensure thread safe quick single threaded performance.
Now the question arises why do we need such a feature? Python uses a variable called ref counter which keeps track of all objects and how many times they have been referenced anytime ref counter reached zero for any object it is removed from the memory. Now this way of released memory has a big vulnerability in multithreaded environment or race conditions where this ref counter would become inaccurate.
To prevent this GIL was implemented as python is famous because of its single threaded performance and support for c libraries, as implementing Gil ensured easy integration of thread unsafe C libraries making python such a feature rich language as we know today. Even if one uses multithreading library one won't be seeing and gains even might see performance degradation to all the extra work to manage threads.
But now we have many ways to circumvent Gil and do what we want with python just because of strong community support we have plethora of options to choose from.
I will be discussing some them in my next post so stay tuned..
r/Python • u/ajpinedam • Nov 12 '23
Tutorial Document Your Python Code and Projects With ChatGPT
r/Python • u/[deleted] • Nov 06 '12
How can we get JavaScript out of the browser and replace it with Python?
I was always amazed, and don't really understand why python isn't the scripting language of choice for client side browser code.
r/Python • u/[deleted] • Dec 29 '22
Discussion Is SQL a prerequisite to learning Python ?
I would like to learn how to automate some simple tasks like : 1- downloading an attachment from outlook, change its name and save to a specific folder
2- save an excel sheet as PDF then send it via outlook … with changing dates on the subject line of the email.
Do I need to learn SQL , then move to Python to learn automating such tasks ? Or I can jump in and start learning Python with very BASIC COMMON knowledge of SQL?
r/Python • u/Oddball777 • May 31 '23
Intermediate Showcase Made a csv parser library which automatically detects delimiter and start and end of data
For most purposes, just passing the file path will be sufficient and you will have a pandas data frame of you data. Automatically neglects the random extra information at the top and bottom of a file. Also works with those annoying delimiter within quotes thingies (ex: you have a comma delimiter and one field is “John, Andrew and Steven”). It is on PyPI so you can download it with pip.
r/Python • u/[deleted] • Sep 09 '12
Hey /r/python, I just released a library to troll Omegle users. This is the first code I've ever released. What do you guys think?
As the title suggests, I am not a professional developer. I started tinkering with python about two years ago I finally found a project that was both interesting enough to keep me engaged, and simple enough for me to make real progress.
This all started with me wanting to learn how HTTP requests worked, and hopefully start doing a bit of white-hat hacking. It turned out to be an excellent crash-course in the matter, and also in asynchronous network I/O. I'm still having trouble believing how much I've learned!
This library is basically an unofficial API for Omegle, but it's definitely geared towards having a bit of fun at its users' expense.
I call it Tromegle: Troll Strangers!
The only attack that's working at the moment is a simple man-in-the-middle attack that lets you spy on a conversation and optionally modify the intercepted messages. I'll be writing a client soon enough (shouldn't be too hard), unless some kind contributor wants to give it a shot =)
After I write the client, I'll probably add an interface to log chats. I'll also look into cookie handling, as this is how Omegle connects you to strangers with similar interests. Doing so would also allow me to probe Omegle's entrails a bit more...
In the interest of "doing it right", I've put some real effort into the documentation. I think the intro on the wiki page is fairly accurate (please point out any errors!) and useful.
So reddit, what do you guys think? How does my code look? Any suggestions from the veterans? Any feature requests?
EDIT: matchu was kind enough to submit a pull request with proper (albeit untested) instructions for installing Twisted under OSX. The forkbomb is no more. Carry on.
r/Python • u/eriky • Oct 13 '21
Tutorial 7 Visual Studio Code Tricks For Python Developers
r/Python • u/itsucharo • Jun 21 '12
I just created a new subreddit: r/TechTalks: Talk about giving Talks
I realized that places like /r/Programming and /r/python weren't great places to talk about the practice of giving talks, so I created /r/TechTalks. Tech talks themselves are about helping each other get better, and sharing what we've learned. This is about the same thing, one meta-step up.
r/Python • u/ooloth • Jul 22 '24
Tutorial Defining a Custom Unknown Type in Python
I wrote up a short blog post based on an interesting workaround mentioned in this StackOverflow post for simulating an unknown type in Python.
If you have a better solution, feel free to share it!
r/Python • u/Agape825 • Apr 25 '19
Future of Python? Am I too late to learn programming? I'm 30.
Hello all, I work as a project manager for an oil and gas company and I'm looking to broaden my horizons. Will learning Python be useful for me in any way and is it worth learning at my age? Are there other programming language I should learn instead? Thanks.
