add a few simple boilerplates

This commit is contained in:
Mia von Steinkirch 2020-02-11 10:35:33 -08:00
parent 962d1a0778
commit 60f223867a
16 changed files with 80 additions and 0 deletions

24
Click_app/Makefile Normal file
View file

@ -0,0 +1,24 @@
.PHONY: clean-pyc clean-dit clean test dist version
default: test
clean-pyc:
@find . -iname '*.py[co]' -delete
@find . -iname '__pycache__' -delete
clean-dist:
@rm -rf dist/
@rm -rf build/
@rm -rf *.egg-info
clean: clean-pyc clean-dist
test:
pytest -vvv
dist: clean
python3 setup.py sdist
python3 setup.py bdist_wheel
version: dist
python3 setup.py --version

41
Click_app/README.md Normal file
View file

@ -0,0 +1,41 @@
# Awesome Python CLI Boilerplate
A quick boilerplate when creating a new CLI apps/scripts in Python3.
### Install
Create and source a virtual environment:
```
virtualenv venv
source venv/bin/activate
```
Install dependencies:
```
pip install -r requirements.txt
```
Install package:
```
pip install .
```
Test your install with:
```
yourapp --help
```
---
### Development
Create a virtual environment and install the package with an editable option:
```
pip install --editable .
```

5
Click_app/pytest.ini Normal file
View file

@ -0,0 +1,5 @@
[pytest]
norecursedirs = venv* .*
addopts =
-r fEsxXw
-vvv

View file

@ -0,0 +1 @@
Click==7.0

16
Click_app/setup.py Normal file
View file

@ -0,0 +1,16 @@
from setuptools import setup, find_packages
setup(
name='yourapp',
version='0.0.1',
packages=find_packages(),
include_package_data=True,
author='Mia von Steinkirch',
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
yourapp=yourapp.yourapp:main
''',
)

View file

@ -0,0 +1 @@
# -*- coding: utf8 -*-

View file

@ -0,0 +1 @@
#!/usr/bin/env python3

View file

@ -0,0 +1,32 @@
#!/usr/bin/env python3
import click
@click.command()
@click.option('-s',
'--source',
default='dev',
nargs=1,
show_default=True,
help='Some source string.')
@click.option('-t',
'--target',
default='staging',
nargs=1,
show_default=True,
help='Some target string.')
@click.option('-p',
'--services',
required=True)
def main(source, target, services):
print(source, target, services)
if __name__ == "__main__":
main(source, target, services)