This example demonstrates using UBI as a base for a simple Python command-line application.
- Simple CLI app: A greeting tool that demonstrates Python CLI best practices
- pyproject.toml: Modern Python dependency management
- XDG compliance: Uses UBI's XDG directory structure for configuration
- Devcontainer configuration: Ready-to-use VS Code devcontainer setup
- Docker installed
- VS Code with Remote-Containers extension (recommended)
- Open this directory in VS Code
- When prompted, click "Reopen in Container"
- Wait for the container to build and start
- You're ready to go!
# Build the container
docker build -f .devcontainer/Dockerfile -t python-cli-example .
# Run interactively
docker run -it --rm python-cli-example bashOnce inside the container:
# Install dependencies
pip install -e .
# Run the CLI tool
greet --help
greet --name "Developer"
# Or run directly
python -m greet_cli --name "World"python-cli/
βββ .devcontainer/
β βββ devcontainer.json # VS Code devcontainer configuration
βββ greet_cli/
β βββ __init__.py # Package initialization
β βββ cli.py # Main CLI application
βββ pyproject.toml # Python project configuration
βββ README.md # This file
- UBI as Base Image: Using
ghcr.io/egohygiene/ubi:0.1.5as the foundation - Python Development: Modern Python tooling with pyproject.toml
- CLI Applications: Using Click for command-line interfaces
- XDG Compliance: Leveraging UBI's XDG directory structure
- Developer Experience: Quick setup with minimal configuration
To adapt this example for your own Python project:
- Update
pyproject.tomlwith your project name and dependencies - Modify the CLI code in
greet_cli/to match your application logic - Adjust the devcontainer configuration as needed
- Add any additional Python dependencies your project requires
- Explore other examples: Node.js, Polyglot
- Learn more about UBI: Main Documentation
- Understand the architecture: Architecture Docs