feat(cli): added cli support for project initialization#132
feat(cli): added cli support for project initialization#132Winay-Chowdary66 wants to merge 1 commit intoserv-c:mainfrom
Conversation
drgroot
left a comment
There was a problem hiding this comment.
Overall good, I think the test cases is most important here!
| ] | ||
| dependencies = [ | ||
| "pyclack-cli[prompts]==0.4.0", | ||
| "asyncclick==8.3.0.5", |
There was a problem hiding this comment.
please remove these, the idea of excluding all pip modules if for security reasons, it ensures that the user/consumer chooses the amount of risk they want to expose themselves to. very important in an enterprise environment!
There was a problem hiding this comment.
Right, but without these the CLI may not work. The user has to explicitly install these for it to work. If that is fine then i will remove them in here and add them to requirements.txt for the unit tests for work.
There was a problem hiding this comment.
Hmm, i wonder then if we need to bundle this as a separate pip module then, enterprise environments aren't usually happy with dependency changes, it clobbers up their SBOM.
There was a problem hiding this comment.
nice, do you think we could do something like servc[cli]. And the cli can be installed separately with, decoupled from core svc logic
pip install servc[cli]|
|
||
| def main(): | ||
| start_server( | ||
| resolver=resolvers, |
There was a problem hiding this comment.
I'm researching on writing tests for CLI tools, bit a tricky here.
For the templates, I could add a scenario to verify templates are copied to target directory but I will have to think on adding tests to verify the installation and dev server works.
I will add the unit tests.
|
@Winay-Chowdary66 please move to the new repo here: |
Add CLI support for project initialization
I've been working on adding CLI functionality to make it easier to bootstrap new servc projects. This was something that came up a few times where I wanted a quick way to get started without having to copy-paste boilerplate code.
What's new
servc initcommand - Creates new projects with different package managers (uv, poetry, pip)How it works
# Basic usage servc init my-service# Interactive mode with immediate setup servc init my-service --interactive --immediate# Different package managers servc init my-service -t uv servc init my-service -t poetry servc init my-service -t pipThe templates include all the basic stuff - worker.py, config, health checks domains, proper pyproject.toml/requirements.txt
Technicals
Package manager support
What's next
Could add more templates in the future, maybe shell completion, but wanted to get the core functionality out first and see how we can use it.