Skip to content
/ cli-py Public template
forked from swiftsoftwaregroup/cli-py

Template for Command Line Interface (CLI) tool in Python

License

Notifications You must be signed in to change notification settings

vkantchev/cli-py

 
 

Repository files navigation

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:

xcode-select --install

Homebrew

Install Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

pyenv

Install Python version manager pyenv

brew install pyenv

Work on macOS

Configure project:

source configure.sh

Open the project in Visual Studio Code:

code .

Run

echo "John" > name.txt

cli-py greet name.txt
cli-py greet --language es name.txt
cli-py greet -l bg name.txt

Test

pytest

Docs

# build 
mkdocs build

# serve
mkdocs serve

# open docs in browser
open http://127.0.0.1:8000

How to create a new project

# 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:

cli-py/
├── cli_py/
│   ├── __init__.py
│   └── main.py
├── pyproject.toml
├── README.md
└── LICENSE

Init docs:

mkdocs new .

About

Template for Command Line Interface (CLI) tool in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 80.2%
  • Shell 19.8%