I made a Python CLI project generator to avoid rewriting the same scaffolding over and over
Posted by Urasonlol@reddit | Python | View on Reddit | 26 comments
Hello!
I'm not the biggest fan of making GUIs and I make a lot of little projects that need some level of interaction. I tend to recreate a similar basic CLI each time which, after doing it 5+ times, felt like I was wasting time. Unfortunately projects are usually different enough that I couldn't just reuse the same menu's so I decided to try to make something that would dynamically generate the boiler-plate (I think that's how you use that term here) for me and I can just hook my programs into it and get a basic prototype going!
To preface, I have only been coding for about a year now but I LOVE backend work (especially in regards to data) and have had a lot of fun with Python and Java. That being said, I'm still learning so there could be easier ways to implement things. I will gladly accept any and all feedback!
Target Audience:
Honestly, anyone! I started out making this just for me but decided to try to make it a lot more dynamic and formal to not only practice but just in-case someone else felt it could be useful. If you want an easy to use CLI for your project, you can generate your project, delete the generator, and go on with your day! I provided as much documentation on how everything works and should work including a walkthrough example! If you're like me and you always make small projects that need a CLI, then keep the generator and just customize it using its templates.
Comparison
Most alternatives I found are libraries that help build CLIs (things like argparse, Click, or Typer ). They’re great, but they don’t handle the scaffolding, folder layout, documentation, or menu structure for you.
I also wanted something that acted like a personal “toolbox,” where I could easily include my own reusable helpers or plugin packs across projects.
So instead of being a CLI framework, this is a project generator: it creates the directory structure, menu classes, navigation logic, optional modules, and usage guide for you, based on the structure you define. Out of the tools I looked at, this was the only one focused on generating the entire project skeleton, not just providing a library for writing commands. This generator doesn't need you to write any code for the menus nor for template additions. You can make your project as normal and just hook it into the noted spots (I tried to mark them with comments, print statements, and naming conventions).
What My Project Does:
This tool simply asks for:
- A project name
- Navigation style (currently lets you pick between numbers or arrows)
- Formatting style (just for the title of each menu there is minimal, clean, or boxed)
- Optional features to include (either the ones I include or that someone adds in themselves, the generator auto-detects it)
- Menu structure (you get guided through the name of the menu, any sub-menus, the command names and if they are single or batch commands, etc.)
At the end, it generates a complete ready-to-use CLI project with:
- Menu classes
- UI helpers
- General utilities
- Optional selected plugins (feature packs?)
- Documentation (A usage guide)
- Stubs for each command and how to hook into it (also print statements so you know things are working until then)
All within a fairly nice folder structure. I tried really hard to make it not need any external dependencies besides what Python comes with. It is template driven so future additions or personal customizations are easy to drag and drop into either Core templates (added to every generated CLI) or Optional ones (selectable feature).
You can find the project here: https://github.com/Urason-Anorsu/CLI-Toolbox-Generator
Also here are some images from the process, specifically the result:
https://imgur.com/a/eyzbM1X
t_spray05@reddit
DM me if you would like to collab. I have a behavioral fintech Algo I'm working on.
jakob1379@reddit
The first thing that comes to mind is: how come this is not a copier/cookiecutter?
Urasonlol@reddit (OP)
I hadn't heard of cookiecutter until this post! I'd say even now, the only difference is that this builds a navigation menu for you rather than a project scaffold. That being said, I'll probably make a cookiecutter template based on this now so that my projects have everything I like!
jakob1379@reddit
Right, it's a hidden gem. Consider copier instead of cookiecutter, as that comes with built-in updating functionality, so I'd the template changes you can update the rendered output later on. Updating is not native to cookiecutter 😊
ksoops@reddit
go brrrr
solitary_black_sheep@reddit
Looks like yet another garbage hallucinated by a chatbot with a goal of putting some spam on pypi.
Urasonlol@reddit (OP)
I didn't really have any intention for this to be on pypi, at the very least not until it got much better and cleaner. That being said, I didn't realize so many people would be upset about the README template using AI as I thought most of the problem with it was with code generation. I'll keep this in mind moving forward.
It's not meant to be revolutionary tech or anything, just a problem I ran into constantly, my solution, and my attempt at scaling it up to being something other people could use
ExtinctedPanda@reddit
I think the README is the only thing people look at, and so if it looks written by AI, they assume the whole project is largely written by AI.
Urasonlol@reddit (OP)
To be fair, the README was heavily formatted by AI. I just rewrote a majority of it because it didn't feel as personal and didn't make sense at times. I think making documentation is easy, making it look nice and not feel like an ugly word document is the hard part but I'll work on making it myself going forward instead even if it comes out a lot less readable.
ExtinctedPanda@reddit
I think many of the people who read READMEs prefer them to look like boring text documents. Looks much more authentic than something written by a marketer (or AI).
solitary_black_sheep@reddit
I looked at sources too. But maybe I don't understand how it can be useful for others. It doesn't seem to be very sophisticated from functional point of view, yet it creates a lot of files. Why would a CLI application need so many files? It looks like it's just solving one very specific use-case.
hugthemachines@reddit
Don't worry too much about it. People online sometimes forget a human is on the receiving end of what they post, so they act like asses instead of being constructive. Solving a problem you encounter a lot is a great reason to build something. It does not have to be the next sliced bread.
Urasonlol@reddit (OP)
It's alright. I know most people, to some degree, are just passionate and are really advanced within their fields which can make things like this feel a bit like a waste of time which is okay! I acknowledge this isn't going to change the world, but getting feedback, learning new techniques/libraries, etc. Is what will lead me there eventually and you only get that from harsh realities and exposing yourself to criticism.
I appreciate the kind reassurance and I'm hoping to continue to slowly work on my small projects and posting them here!
solitary_black_sheep@reddit
Sorry for being too harsh. I looked at sources too and I just don't understand the use case, i.e., I get that it's useful for you, but it's not clear to me why would I need such a generated file structure for a CLI project. Normally I tend to not create complex user interface for a CLI tool, rather just make it usable with other scripts, i.e. to have reasonable command line arguments. If it needs human interface, then something like tkinter or more complex sounds better to me. But it would also help if you added some "demo" screenshots into the readme to show what kind of interface it can create. Something to explain and visualize why someone might want to use it.
Urasonlol@reddit (OP)
You're alright. I know the separation of a screen can often add a layer of disconnect. I only really use AI for formatting and busywork because I feel if I don't know how something works, then there's no reason to be using it (this adds some difficulty with programming because it makes me hate libraries so I often try to re-invent the wheel). I don't know many standards and honestly just navigate using some things I've seen, videos I've watched, or what I've learned in academia so sometimes its an odd amalgamation of all of that but that's why I don't mind taking some hits from making something like this public. I can learn, I can improve, and I can see how others would do things.
As for the usage of this, it truly was meant to be a niche use-case for me that I figured could be good practice to try to make it somewhat scalable (worst case only I use it, best case someone else finds it helpful). I don't have experience with front-end yet (nor do I really want to) and most user-interface libraries that python offers are a lot of setup (but they look great in exchange!). The main thing with this is that it'll let me generate a somewhat pretty and customizable multi-tiered menu for any project and just hook it up so within 30 minutes max I have something (as a real world example, I like to mess with data and so a menu like this lets me navigate through dataframes using different programs really easily with no fuss). I don't have the best memory and remembering args for programs is a hassle at a times since I jump around so much.
I tried to add a use-case with a walkthrough example provided in the documentation section (nothing too crazy nor practical but just a use-case nonetheless of a task tracker). Alongside this I put some images on imgur but I know that they're not the most descriptive samples. I'll work on revamping the README, cleaning it up from the AI usage (mostly the emojis, it was just a template that I filled out myself), and adding these samples there directly.
Also, I appreciate the mention of tkinter, I haven't seen it before and after looking at it for a bit, I like it for my "more advanced" projects where having an actual nice interface is beneficial! It feels like it would be a good middle-ground for me right now.
jakob1379@reddit
It's just uv init and uv publish?
prodleni@reddit
Truly a https://stopslopware.net moment
zxmalachixz@reddit
Nice! Saving this link for the future.
niltz0@reddit
Did you come across cookiecutter at all?
https://github.com/cookiecutter/cookiecutter
almcchesney@reddit
Also there is pyscaffold which is in our standards doc at work. Pretty extensible andmakes sure all the module components are correct.
https://pyscaffold.org/en/stable/
Urasonlol@reddit (OP)
I had seen this but it felt like it was more for standardization of entire projects outlines rather than customization. I'm not in any formal work environment yet so I'd rather learn the "standards" by hand first. This was just a nice way to have a navigation menu that I could easily hook into (I don't doubt that I'll eventually use a lot of pyscaffold though and I have added it to my list of things to remember)
Urasonlol@reddit (OP)
I did not! But after looking through it and their slideshow, it seems right up my alley. I could likely extract my CLI stuff from this and turn it into a cookiecutter template for this to actually be an entire project scaffold instead of just the menu navigation stuff (that's what I didn't like about pyscaffold). Better yet, someone more experienced with it may have a template floating around somewhere
robberviet@reddit
Sounds like not.
Orio_n@reddit
We dont care about your garbage ai sloprepo.
Scared_Sail5523@reddit
This is a really cool idea, and I think you’ve hit on a pain point that a lot of developers run into once they’ve built a few projects — the repetition of scaffolding and boilerplate. Your generator feels like a natural evolution of that frustration into something genuinely useful.
canhazraid@reddit
How does this differ from PyScaffold?