Skip to content

Conversation

@Winay-Chowdary66
Copy link
Contributor

@Winay-Chowdary66 Winay-Chowdary66 commented Oct 9, 2025

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 init command - Creates new projects with different package managers (uv, poetry, pip)
  • Interactive prompts - Asks for project name, package manager choice, etc. Pretty smooth UX imo
  • Multiple templates - Each package manager gets its own template with proper configs
  • Auto dependency installation - Can install deps after project creation

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 pip

The templates include all the basic stuff - worker.py, config, health checks domains, proper pyproject.toml/requirements.txt

Technicals

  • Built with asyncclick for the async CLI stuff
  • Used pyclack for the nice interactive prompts (spinners, selections, etc.)
  • Cross-platform (tested on Windows, should work fine on Linux/Mac)
  • Proper error handling.

Package manager support

  • UV (recommended) - Fast, modern, handles venvs automatically
  • Poetry - Full dependency management with lock files
  • Pip - Standard approach with requirements.txt
  • Each one creates the appropriate project structure and configs.

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.

Copy link
Member

@drgroot drgroot left a 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",
Copy link
Member

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!

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test cases?

Copy link
Contributor Author

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.

@drgroot
Copy link
Member

drgroot commented Oct 14, 2025

@Winay-Chowdary66 please move to the new repo here:
https://github.com/serv-c/servc-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants