finstem
docopt
finstem | docopt | |
---|---|---|
6 | 29 | |
15 | 7,891 | |
- | -0.1% | |
7.4 | 2.5 | |
6 months ago | about 23 hours ago | |
Python | Python | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
finstem
-
Ask HN: Best thing you've made in CLI
It ain't much, but it's honest work: https://github.com/hiAndrewQuinn/finstem
I moved to Finland a few years ago to be with my then-fiancee, now-wife. I started learning Finnish and found that constantly going to Wiktionary to search for the root forms of their words, which have 15 declensions, possessive endings, clitics similar to Japanese particles, and other craziness going on in the root form themselves.
I wrote this to let me very quickly strip away all of that and get just the original dictionary forms of words. Later I wrapped it into a little `fzf` script to make it easy to analyze entire sentences or paragraphs at once.
The code is nothing special at all, but I use this thing dozens of times daily, and it's never let me down.
-
Command Line Interface Guidelines
I know it goes without saying for most of us here, but actually being a heavy terminal user yourself is one of the most important things to understand how to design CLIs. It helps a ton to understand the ecosystem you live in, not just your own organism.
Example: Something I did a few months back ago for a tiny personal project @ https://github.com/hiAndrewQuinn/finstem was implement `--format CSV`, `TSV` and `JSON` flags. I haven't had need for any of these myself, but they exist so any future people who want to use `csvkit`, `awk` and `jq` respectively to wrap around my program have easy ways to do so. That's not stuff I would have had the instincts to do if I wasn't myself a user of all 3 of those programs.
-
Cold-Blooded Software
Most of the software I write is at least somewhat cold-blooded by this definition. My program to find the dictionary forms of Finnish words is an okay example:
https://github.com/hiAndrewQuinn/finstem
I wrote the initial draft in an afternoon almost a year ago, and from then on endeavored to only make changes which I know play nicely with my local software ecology. I usually have `fzf` installed, so an interactive mode comes as a shell script. I usually have `csvkit`, `jq`, and if all else fails `awk` installed, so my last major update was to include flags for CSV, JSON, and TSV output respectively. Etc, etc.
The build instructions intentionally eschew anything like Poetry and just gives you the shell commands I would run on a fresh Ubuntu VirtualBox VM. I hand test it every couple of months in this environment. If the need to Dockerize it ever arose I'm sure it would be straightforward, in part because the shell commands themselves are straightforward.
-
PysimpleGUI
I'm considering taking a tool I have which has a pretty nicely fleshed-out CLI interface and wrapping a GUI around it, so people who don't run desktop Linux can use it too. This seems like it might be perfect for my needs.
https://github.com/hiAndrewQuinn/finstem
-
`finstem` can now do get you the root words for full sentences and paragraphs.
Big GitHub link
-
Things I've learned about building CLI tools in Python
I build little CLI tools in Python non-stop. ChatGPT and some basic knowledge of how the `click` library works has made it almost completely trivial to get the ball rolling for whatever need I have for it, `--help` text included.
The fact that the barrier for creation is so low means I'm even willing to do them to solve very niche problems in generalizable ways. [1] is common enough that a few people have starred it. [2] is niche enough that other Anki folks haven't used it AFAICT. [3] is likely something I'll never personally need again, even though Azure VM reservations not letting you customize your reminders for when they're about to expire is probably a costly mistake for a great many firms. All generated with this same starting methodology, because what I wanted was just a little too fiddly to want to hack together with my shell toolkit.
[1]: https://github.com/hiAndrewQuinn/finstem
[2]: https://github.com/hiAndrewQuinn/table2anki
[3]: https://github.com/hiAndrewQuinn/AzureReservations2ICS
docopt
- Docopt: Command-line interface description language
-
Building a Command Line Tool with PHP and Symfony Console
Symfony Console closely follows the well-established docopt conventions. Docopt, based on longstanding conventions from help messages and man pages, ensures a consistent and intuitive interface for describing a program's interface. Symfony Console's adherence to docopt conventions guarantees that your command line tools maintain a standardized and predictable user experience, simplifying development and user interaction.
-
CLI user experience case study
You probably already know, but just in case you don't, you might read about http://docopt.org/ It seems to me a lot of your usage ideas could be refinements of / tooling around docopt-style interfaces.
-
Gooey: Turn almost any Python command line program into a full GUI application
http://docopt.org/
Not quite what you asked for, but close: type example invocations to generate the CLI, and just pull the arguments from a dictionary at runtime.
-
Things I've learned about building CLI tools in Python
I've been using docopt to handle CLI arguments for years now.
http://docopt.org/
-
What's up, Python? The GIL removed, a new compiler, optparse deprecated
If you aren't averse to using a third party package, on my personal projects I always found https://github.com/docopt/docopt to be nice.
You can kill 2 birds with one stone by documenting your scripts while also providing the argument structure / parsing.
-
adaszko/complgen: Generate {bash,fish,zsh} completions from a single EBNF-like grammar
As for the implementation differences, complgen uses a trivial DSL that’s everybody is already familiar with more or less because it’s a slightly more rigorous version of what tools usually spit out when you do command --help (projects like docopt even use that for command line arguments parsing). Those happen to be regular languages and therefore can be represented as a Deterministic Finite Automata. complgen compiles the grammars to DFAs, minimizes the DFA and spits out shell-specific shell completions scripts that simply walk the DFA to match and complete the current input.
-
[Media] shrs: a shell that is configurable and extensible in rust
The current completion system has a list of rules of which completions to use at which time. It's purposely simple to make it as flexible as possible. The current things I'm planning is a derive macro like what clap has to generate these rules. I'm also considering introducing a plugin that let's you write rules in the format of docopt
-
Docopt.sh – Command-Line Argument Parser for Bash 3.2, 4, and 5
For anyone unfamiliar, docopt is an established standard for specifying arguments in a script’s doc string. I use it for Python and it’s lovely. You’re going to write a docstring with examples anyway, why not make them functional?
http://docopt.org/
-
I am sick of writing argparse boilerplate code, so I made "duckargs" to do it for me
I like http://docopt.org/ a lot. You seem like someone who might have opinions on that.
What are some alternatives?
python_script_cc - A personal cookiecutter template for simple python3 scripts
click - Python composable command line interface toolkit
table2anki - HTML tables to Anki card packages. Does what it says on the tin!
Python Fire - Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
poetry-cookiecutter - 🍪 Poetry Cookiecutter is a modern Cookiecutter template for scaffolding Python packages and apps
typer - Typer, build great CLIs. Easy to code. Based on Python type hints.
AzureReservations2ICS - Given the CSV of the Azure Reservations website, create an ICS file of reminder events leading up to the expiration.
Gooey - Turn (almost) any Python command line program into a full GUI application with one line
Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
Argh - An argparse wrapper that doesn't make you say "argh" each time you deal with it.
poetry2nix - Convert poetry projects to nix automagically [maintainer=@adisbladis]
cement - Application Framework for Python