Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Updated dependencies, improved README, small improvements for the cookiecutter files (using cookiecutter.project_slug where needed), improved example command with parameters, added a basic test #2

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 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
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
60 changes: 46 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# 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

Expand All @@ -30,24 +38,36 @@ $ cookiecutter gh:yankeexe/cookiecutter-python-cli
2. Create a virtual environment.

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

3. Activate it.
3. Linux / Mac - Activate it.

```bash
$ source venv/bin/activate
$ source venv/Scripts/activate
```

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

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

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

```bash
$ make install
```

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

```bash
$ 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**
>
Expand All @@ -58,7 +78,7 @@ $ <<cli_command>> init
```

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

### Test with Docker
Expand All @@ -67,7 +87,7 @@ 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
Expand All @@ -81,19 +101,31 @@ $ docker-run --rm <<cli_command>> init

## Documentation

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

```bash
$ make docs
```

2. Serve the docs locally.
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 serve-docs
```

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

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

## Linux / Mac - Distribution

> **NOTE**
>
Expand All @@ -111,7 +143,7 @@ $ make distributions
$ twine dist/*
```

## Help
## Linux / Mac - Help

For help related to make commands.

Expand Down
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}}"
6 changes: 3 additions & 3 deletions {{cookiecutter.project_slug}}/requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
pip-tools
pre-commit
tox
mypy
flake8
pytest
black
pre-commit
click
typing-extensions
rich
72 changes: 60 additions & 12 deletions {{cookiecutter.project_slug}}/requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile requirements/dev.in
#
appdirs==1.4.4
# via virtualenv
atomicwrites==1.4.1
# via pytest
attrs==20.3.0
# via pytest
black==22.8.0
# via -r requirements/dev.in
build==0.8.0
# via pip-tools
cfgv==3.2.0
# via pre-commit
click==7.1.2
click==8.1.3
# via
# -r requirements/dev.in
# black
# mkdocs
# nltk
# pip-tools
colorama==0.4.5
# via
# build
# click
# pytest
# tox
commonmark==0.9.1
# via rich
distlib==0.3.1
# via virtualenv
filelock==3.0.12
# via
# tox
# virtualenv
flake8==5.0.4
# via -r requirements/dev.in
future==0.18.2
# via lunr
identify==1.5.13
Expand All @@ -42,28 +60,39 @@ markdown==3.3.3
# pymdown-extensions
markupsafe==1.1.1
# via jinja2
mkdocs-material-extensions==1.0.1
mccabe==0.7.0
# via flake8
mkdocs==1.1.2
# via mkdocs-material
mkdocs-material==6.2.8
# via
# -r requirements/docs.in
# -r requirements\docs.in
# mkdocs-material-extensions
mkdocs==1.1.2
mkdocs-material-extensions==1.0.1
# via mkdocs-material
mypy-extensions==0.4.3
# via mypy
mypy==0.800
# via -r requirements/dev.in
mypy-extensions==0.4.3
# via
# black
# mypy
nltk==3.5
# via lunr
nodeenv==1.5.0
# via pre-commit
packaging==20.9
# via
# build
# pytest
# tox
pip-tools==5.5.0
pathspec==0.10.1
# via black
pep517==0.13.0
# via build
pip-tools==6.8.0
# via -r requirements/dev.in
platformdirs==2.5.2
# via black
pluggy==0.13.1
# via
# pytest
Expand All @@ -74,20 +103,28 @@ py==1.10.0
# via
# pytest
# tox
pycodestyle==2.9.1
# via flake8
pyflakes==2.5.0
# via flake8
pygments==2.7.4
# via mkdocs-material
# via
# mkdocs-material
# rich
pymdown-extensions==8.1.1
# via mkdocs-material
pyparsing==2.4.7
# via packaging
pytest==6.2.2
# via -r requirements/tests.in
# via -r requirements\tests.in
pyyaml==5.4.1
# via
# mkdocs
# pre-commit
regex==2020.11.13
# via nltk
rich==12.5.1
# via -r requirements/dev.in
six==1.15.0
# via
# livereload
Expand All @@ -99,6 +136,11 @@ toml==0.10.2
# pre-commit
# pytest
# tox
tomli==2.0.1
# via
# black
# build
# pep517
tornado==6.1
# via
# livereload
Expand All @@ -109,12 +151,18 @@ tqdm==4.56.0
# via nltk
typed-ast==1.4.2
# via mypy
typing-extensions==3.7.4.3
# via mypy
typing-extensions==4.3.0
# via
# -r requirements/dev.in
# black
# mypy
virtualenv==20.4.2
# via
# pre-commit
# tox
wheel==0.37.1
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
2 changes: 2 additions & 0 deletions {{cookiecutter.project_slug}}/requirements/docs.in
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
mkdocs-material
mkdocs-markdownextradata-plugin
mkdocs-click
Loading