-
Notifications
You must be signed in to change notification settings - Fork 1
feat(cli): added cli support for project initialization #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
drgroot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.