https://github.com/swiftsoftwaregroup/cli-py
Template for Command Line Interface (CLI) tool in Python
https://github.com/swiftsoftwaregroup/cli-py
Last synced: 5 months ago
JSON representation
Template for Command Line Interface (CLI) tool in Python
- Host: GitHub
- URL: https://github.com/swiftsoftwaregroup/cli-py
- Owner: swiftsoftwaregroup
- License: apache-2.0
- Created: 2024-07-24T19:35:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-24T22:02:20.000Z (almost 2 years ago)
- Last Synced: 2025-08-16T12:59:15.139Z (11 months ago)
- Language: Python
- Size: 38.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cli-py
Template for Command Line Interface (CLI) tool in Python
## Development
### Setup for macOS
#### Xcode Command Line Tools
Install Command Line Tools (CLT) for Xcode:
```bash
xcode-select --install
```
#### Homebrew
Install [Homebrew](https://brew.sh/):
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
#### pyenv
Install Python version manager [pyenv](https://github.com/pyenv/pyenv)
```bash
brew install pyenv
```
### Work on macOS
Configure project:
```bash
source configure.sh
```
Open the project in Visual Studio Code:
```bash
code .
```
### Run
```bash
echo "John" > name.txt
cli-py greet name.txt
cli-py greet --language es name.txt
cli-py greet -l bg name.txt
```
### Test
```bash
pytest
```
### Docs
```bash
# build
mkdocs build
# serve
mkdocs serve
# open docs in browser
open http://127.0.0.1:8000
```
### How to create a new project
```bash
# init the project
poetry init \
--no-interaction \
--name "cli-py" \
--description "CLI tool for greeting users in different languages" \
--license "Apache-2.0" \
--python "^3.12"
# add `click` package
poetry add click
# add `dev` packages
poetry add --dev pytest
poetry add --dev mkdocs mkdocs-material mkdocstrings[python]
```
Create the following project structure:
```sh
cli-py/
├── cli_py/
│ ├── __init__.py
│ └── main.py
├── pyproject.toml
├── README.md
└── LICENSE
```
Init docs:
```bash
mkdocs new .
```