Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
aa37b51
feat: Updated dev.in
ltpitt Sep 12, 2022
a91ba08
Update README.md
ltpitt Sep 12, 2022
1efd942
feat: Removed rich
ltpitt Sep 12, 2022
20e7a1c
feat: Added simple hello command
ltpitt Sep 12, 2022
eda70c7
feat: Added hello command
ltpitt Sep 12, 2022
9301013
feat: Added hello command
ltpitt Sep 12, 2022
7503bcb
fix: Updated pip-tools to 6.8.0
ltpitt Sep 13, 2022
b07ed1b
feat: Added freshly generated dev.txt
ltpitt Sep 13, 2022
74c7a16
feat: Generated new docs.txt
ltpitt Sep 13, 2022
b8bdf84
feat: Generated new publish.txt
ltpitt Sep 13, 2022
f519671
feat: Updated tests.txt
ltpitt Sep 13, 2022
a13d2b5
feat: Removed packages versions
ltpitt Sep 13, 2022
ff1ec97
Update dev.txt
ltpitt Sep 13, 2022
00e72cd
feat: Generated dev.txt
ltpitt Sep 13, 2022
70f3bd9
Update dev.in
ltpitt Sep 13, 2022
b339ec2
Update dev.txt
ltpitt Sep 13, 2022
2789eea
Update dev.in
ltpitt Sep 13, 2022
a15426f
Update dev.in
ltpitt Sep 13, 2022
7539ef5
Update dev.in
ltpitt Sep 13, 2022
c419ae2
feat: Removed rich version
ltpitt Sep 13, 2022
7a2bb42
feat: Added text style / color
ltpitt Sep 13, 2022
507eef4
Update cookiecutter.json
ltpitt Sep 13, 2022
154303d
feat: Added Darth Vader image
ltpitt Sep 13, 2022
3c52f40
feat: Added Darth vader
ltpitt Sep 13, 2022
66972e0
doc: Added Windows step to install dependencies
ltpitt Sep 13, 2022
5a6ae3f
doc: Added hello command
ltpitt Sep 13, 2022
641d3e9
feat: Removed python3
ltpitt Sep 13, 2022
7923f55
feat: Generated fresh dev.txt
ltpitt Sep 13, 2022
9351cd3
fix: Removed extra parenthesis
ltpitt Sep 13, 2022
e8ff0d7
feat: Prettified output
ltpitt Sep 13, 2022
43ae779
feat: Added click and markdownextradata-plugin dependecies
ltpitt Sep 13, 2022
82ffbdb
Update mkdocs.yml
ltpitt Sep 13, 2022
60b8b15
Update docs.txt
ltpitt Sep 13, 2022
947baa9
Update docs.txt
ltpitt Sep 13, 2022
505c942
feat: Added example test
ltpitt Sep 13, 2022
aa7c9c7
Update test_help.py
ltpitt Sep 13, 2022
e8d2a49
Update mkdocs.yml
ltpitt Sep 13, 2022
e1c9159
feat: Added index.md in order to automatically generate docs from code
ltpitt Sep 13, 2022
b09d068
Update app.py
ltpitt Sep 13, 2022
4548033
Update test_help.py
ltpitt Sep 13, 2022
7e48e81
Update app.py
ltpitt Sep 13, 2022
8532bce
Update setup.py
ltpitt Sep 13, 2022
a6e079b
Delete index.md
ltpitt Sep 13, 2022
e616b38
Update README.md
ltpitt Sep 13, 2022
39e200e
Update README.md
ltpitt Sep 13, 2022
0157980
Update README.md
ltpitt Sep 13, 2022
2c2a781
Update README.md
ltpitt Sep 13, 2022
a57e1d9
Update README.md
ltpitt Sep 13, 2022
9e0cd6e
Update README.md
ltpitt Sep 13, 2022
aec8ca4
Update README.md
ltpitt Sep 13, 2022
f20babb
Update README.md
ltpitt Sep 13, 2022
feeee04
Update README.md
ltpitt Sep 13, 2022
c7bac92
Update README.md
ltpitt Sep 13, 2022
ecadffd
Update README.md
ltpitt Sep 15, 2022
3a43b5a
Update cookiecutter.json
ltpitt Sep 15, 2022
284590b
Update cookiecutter.json
ltpitt Sep 15, 2022
448070b
Update README.md
ltpitt Sep 15, 2022
afbe6fa
Update README.md
ltpitt Sep 27, 2022
d18482d
Update README.md
ltpitt Sep 27, 2022
067f21e
Update README.md
ltpitt Sep 3, 2025
02f13be
Update README.md
ltpitt Sep 3, 2025
e4aa70e
Create dependabot.yml
ltpitt Sep 3, 2025
98de1c6
Update README.md
ltpitt Sep 3, 2025
c8feed9
Update dev.in
ltpitt Sep 3, 2025
b511edc
Update dev.in
ltpitt Sep 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "pip"
directory: "{{cookiecutter.project_slug}}/requirements"
schedule:
interval: "weekly"
82 changes: 57 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Cookiecutter for Python Click CLI :cookie:
# Important note
A newer version of this Cookiecutter (using the amazing [Typer](https://typer.tiangolo.com/)!) is currently work in progress and available [here](https://github.com/ltpitt/python-cookiecutter-typer-cli).

# A cookiecutter to bake tasty Python Click CLI tools :cookie:

![Come to the dark side... We have cookies!](https://github.com/ltpitt/cookiecutter-python-cli/blob/master/darth_vader_cookies.jpg?raw=true)

## Comes with:

- [x] Containerization
- [x] Pre-commit hooks
- [x] mypy
- [x] black
- [x] click
- [x] flake8
- [x] mkdocs-material
- [x] mypy
- [x] packaging
- [x] Containerization


## Usage

Install cookiecutter.

```bash
$ pip install --user cookiecutter
pip install --user cookiecutter
```

Generate your project template using cookiecutter.

```bash
$ cookiecutter gh:yankeexe/cookiecutter-python-cli
cookiecutter gh:ltpitt/cookiecutter-python-cli
```

## Project Setup
Expand All @@ -30,35 +38,47 @@ $ cookiecutter gh:yankeexe/cookiecutter-python-cli
2. Create a virtual environment.

```bash
$ make venv
python -m venv venv
```

3. Linux / Mac - Activate it.

```bash
source venv/Scripts/activate
```

3. Windows - Activate it.

```bash
source venv/Scripts/Activate.ps1
```

3. Activate it.
4. Linux / Mac - Install development dependencies with editable mode to test the CLI.

```bash
$ source venv/bin/activate
make install
```

4. Install development dependencies with editable mode to test the CLI.
4. Windows - Install development dependencies with editable mode to test the CLI.

```bash
$ make install
pip install -e . -r requirements/dev.txt
```

## Take your CLI for a spin

This Cookiecutter comes with two generic CLI commands, namely, `init` and `show`.
This Cookiecutter comes with two generic CLI commands, namely, `init` and `hello`.

> **NOTE**
>
> `<<cli_command>>` is the executable command you choose for your CLI during project setup.

```bash
$ <<cli_command>> init
<<cli_command>> init
```

```bash
$ <<cli_command>> show
<<cli_command>> hello
```

### Test with Docker
Expand All @@ -67,33 +87,45 @@ CLI commands can be tested with Docker.

1. Build an image for the CLI.

Image is tagged with the same name as the `cli_command`.
Image is tagged <<cli_command>> name.

```bash
$ make docker-image
make docker-image
```

2. Run the command inside the container.

```bash
$ docker-run --rm <<cli_command>> init
docker-run --rm <<cli_command>> init
```

## Documentation

1. Install documentation-related dependencies.
1. Linux / Mac - Install documentation-related dependencies.

```bash
make docs
```

1. Windows - Install development dependencies with editable mode to test the CLI.

```bash
pip install -r requirements/docs.txt
```

2. Linux / Mac - Serve the docs locally.

```bash
$ make docs
make serve-docs
```

2. Serve the docs locally.
2. Windows - Serve the docs locally.

```bash
$ make serve-docs
mkdocs serve -f docs/mkdocs.yml
```

## Distribution
## Linux / Mac - Distribution

> **NOTE**
>
Expand All @@ -102,19 +134,19 @@ $ make serve-docs
To publish you CLI to PyPI, run:

```bash
$ make distributions
make distributions
```

`dist` directory will be created inside your project directory. Upload it to PyPI using:

```bash
$ twine dist/*
twine dist/*
```

## Help
## Linux / Mac - Help

For help related to make commands.

```bash
$ make help
make help
```
4 changes: 2 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"project_name": "Awesome CLI",
"project_slug": "{{cookiecutter.project_name.strip().lower().replace(' ', '_').replace('-', '_')}}",
"cli_command": "yocli",
"cli_command": "acli",
"author": "Yankee Maharjan",
"description": "This CLI tool does awesome things."
"description": "This CLI tool does one thing and does it awesomely."
}
Binary file added darth_vader_cookies.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test: # run pytest in verbose mode
@pytest -vvv

venv: # create a virtual env
@python3 -m venv venv
@python -m venv venv

format: # format all files using black
@black .
Expand All @@ -41,7 +41,7 @@ serve-docs: # serve docs on localhost

distributions: # create distribution wheel and zip for PyPI
@pip install -r requirements/publish.txt
@python3 setup.py sdist bdist_wheel
@python setup.py sdist bdist_wheel
@echo "Use `twine upload dist/*` to upload to PyPI"

docker-image:
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ make install

## Take your CLI for a spin

This Cookiecutter comes with two generic CLI commands, namely, `init` and `show`.
This Cookiecutter comes with two generic CLI commands, namely, `init` and `hello`.

```bash
$ {{cookiecutter.cli_command.strip().lower().replace(' ', '_').replace('-', '_')}} init
Expand Down
20 changes: 0 additions & 20 deletions {{cookiecutter.project_slug}}/docs/docs/commands/index.md

This file was deleted.

6 changes: 6 additions & 0 deletions {{cookiecutter.project_slug}}/docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Welcome to {{cookiecutter.project_name}}

::: mkdocs-click
:module: {{cookiecutter.project_slug}}.app
:command: {{cookiecutter.cli_command}}
:depth: 1

16 changes: 9 additions & 7 deletions {{cookiecutter.project_slug}}/docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ theme:
features:
- navigation.instant

nav:
- Overview:
- Introduction: index.md
- Commands:
- Overview: ./commands/index.md

# Extensions
markdown_extensions:
- markdown.extensions.admonition
- markdown.extensions.codehilite:
Expand All @@ -37,3 +30,12 @@ markdown_extensions:
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde
- mkdocs-click

plugins:
- search
- markdownextradata: {}


extra:
cli_command: "{{cookiecutter.cli_command}}"
9 changes: 6 additions & 3 deletions {{cookiecutter.project_slug}}/requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
pip-tools
pre-commit
tox
mypy
flake8
pytest
black
pre-commit
click
typing-extensions
rich
pyyaml>=6.0
py>=1.11.0

Loading