Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upis there any scaffolding already done for this (for example with cookiecutter)? #940
Comments
|
We don't have any scaffolding or templates yet, although I think we should keep this issue open as the vehicle to create one. However, I have another project called tomcatmanager which offers a python library, a CLU, and a CLI using One note about the design of tomcatmanager. To avoid duplication of code logic, commands given on the command line (CLU mode) are just passed through to the CLI. There are two key classes, one is the library, the other is the When operating as a CLU, you have to strip off the command line arguments and pass them into the I advise taking a look at main.py to see how that works. The two key elements are Hope this is helpful. |
|
It's very helpful, thank you. |
|
@Laurentiu-Andronache Your question is a good one and it makes me thing that we should probably work on adding some documentation about overall application patterns and recommended best-practices for using I recently helped some coworkers setup a package that is essentially exactly what you are talking about - a library, a CLI and a CLU and we followed a very different overall architectural pattern than @kotfu followed for First we did some mild refactoring of the existing CLU scripts so that there were functions like the following for a script foo:
Then we added a super thin NOTE: If we were writing all of the code from scratch and didn't already have the existing CLU scripts, then I think the approach @kotfu outlined above is probably a better one. For the library we kept that in a separate package and then had a combined package for the CLI/CLU. Some overall lessons learned regarding best practices:
|
|
Ultimately, we will still need that cookiecutter that you can just install in 2 seconds. And link to it in the documentation.... |
I'm looking to build a package that's simultaneously a library, a CLI and a CLU. cmd2 seems perfect for the task, but I'd love to use some already existing scaffolding that has proper organization and proper code quality standards. Is there such a thing?