This is not a complete overview of ways to create CLIs in Python, just something rather specific. ... A single command line tool, lots of sub-commands.
Python composable command line interface toolkit. Contribute to pallets/click development by creating an account on GitHub.
Discussions
How to publish a Python CLI tool on Github to allow for easy installation with pip?
Use the scripts keyword. https://setuptools.readthedocs.io/en/latest/references/keywords.html More on reddit.com
r/learnpython
4
1
March 2, 2021
Why is GitHub cli not properly integrated in Linux?
Does it not have users on Linux? I didn't even know it existed, I don't know why there's any reason to use it either. I'm guessing not many people use it and just use git. It's also just a single binary so you can just download it from the releases page and put it in your $PATH More on reddit.com
r/linuxquestions
16
1
January 6, 2022
GitHub/Git CLI Tutorial for dummies. Looking for ELI5 or something
The amount of jargon to master when learning git is truly out of control. For the very basics of git at least, here's the bottom line of what you need to know: First, git is not GitHub. These are two completely different things, albeit there is a relation between them. Git is a kind of simple language, GitHub is a web-based service. The latter requires the former, but the former does not require the latter. Git tracks changes between files, and allows you to change the state of a directory tree. In ELI5 language, if a folder contains your project, git can take snapshots of that folder across time, and reset the folder to how it was at any snapshot. This is particularly smart practice for software development, but git can really be used for anything. A repository (repo) is like a folder/directory on your computer. It is just storage. The difference between regular folders and repositories is that the latter are kinda hooked up to "the cloud". You can either create a repo on your computer and back it up in the cloud, or else find an existing repo already in the cloud and create a copy of it on your computer. Either way, the version in the cloud is called a remote repo (origin is a common alias for this) and the version on your computer is called a local repo. You can't modify the former directly (meaning that all files in a remote repo are (mostly) safe from accidental destruction). Rather, you'd make any desired changes in the local, then periodically tell the remote about the changes so that the two repos' states can sync up. This state-syncing between local and remote is the meat of git, so more info below (get ready for the firehose of git jargon)... Say you find a repo on GitHub for an open-source project that interests you. Someone else created this repo, but you want to contribute to it. The first step is to clone the repo. This means to create a local copy of the remote repo. After cloning, let's say the local repo looks like this: root directory file 1 file 2 Git will be tracking file 1 and file 2; Equivalently, these files are being tracked. This means that git is monitoring the states of these files, and will know if they've been modified. If you created a file3 after cloning the repo, git will NOT track file 3 until you tell it to. Say you make changes to file 1 and you're pretty sure you want to keep them. To do so, first you'd stage file 1, which means add it to the list of things whose modifications you're happy with and want to keep. Then you'd commit those changes, which means you'd tell git to take a snapshot of the local repo's state. At this point, because you have made and committed some changes, your local repo is now out of sync with the remote repo (specifically, you'd say the local is "ahead" of the remote by 1 commit, because the local's state history is equal to the remotes, plus one commit). That's cool and all, but if you accidentally delete your local repo, all your work is gone. To protect against this, you can back up your changes by pushing them to the remote repo. This will sync the remote up with your local, such that all changes you made in the local are now present in the remote. The remote essentially becomes a carbon copy of your local. Say someone else is also contributing to this project at the same time as you. They have their own clone with their own commits. When you push your changes, that other person will probably want to incorporate them into their local repo too. To do so, after you've pushed everything, they would pull your changes from the remote. This is essentially pushing in reverse: make the local repo a carbon copy of the remote. So I have covered only a very small portion of git, but this portion contains the main bits of what makes git so powerful. Another huge part of git which I haven't touched upon is branching. This is where things like master, checkout, and merge come into play. While everything I've said thus far is git 101, branching is kinda git 102. If you've found my explanation clear thus far and want to know about branching, I can try to explain. But hopefully I've given you plenty to think about already! Git is a giant pain, but definitely the best option out there. You should definitely learn it. More on reddit.com
r/learnpython
4
2
February 10, 2022
What CLI libraries do you use to build your own custom commands?
Click - all day. It’s the best cli library and I’ve tried many. It’s also a great example of OOP design More on reddit.com
Tyro : Tool for generating command-line interfaces and configuration objects in Python. Typer : Library for building CLI applications that users will love using and developers will love creating.
github-cli provides an executable called ghi, that can be used to access all of GitHub’s documented Issues API (v2) functionality from your command-line
electron react javascript python reactjs python-cli electronjs electron-react dyscalculia electron-reactjs tubitak python-cli-project tubitak-4006 ... A simple CLI tool written in Python to post statuses to Bluesky and view your timeline.
We'll cover 3 different ways to create tools, from the very basic (with sys.argv) to using a framework that comes with Python (argparse), and finally the more involved, by using an external library like Click.
A comprehensive command-line tool for managing GitHub repositories with advanced synchronization, SSH configuration management, and intelligent local repository management. github github-api smartlegionlab python-cli-app alexander-suvorov ...
Typer is a library for building CLI applications that users will love using and developers will love creating. Based on Python type hints. It's also a command line tool to run scripts, automatically converting them to CLI applications.
Hi r/learnpython, I am currently writing a useful CLI tool in python that greatly increases terminal workflows and I am stuck on figuring out how to actually package it and allow for other people to install and use.
What I am envisioning is something like virtualenv, which installs the virtualenv command and adds it to your path when you run pip install virtualenv.
I have looked online and see that there is stuff like wheels to package python packages, but truthfully I am really confused by all of it and could use some assistance pointing me to the right direction.
I should mention that if there is a better way to do this than using pip like actual os package managers like brew, apt, or pacman, I would be open to doing it that way as well, but figured that doing it through the python ecosystem might be easier.