This commit is contained in:
osiris account 2023-03-12 15:29:57 -07:00
parent 7cb7a479f6
commit 69bb4175f1
124 changed files with 20 additions and 15 deletions

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

View file

@ -0,0 +1,41 @@
# Click / 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 .
```

View file

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

View file

@ -0,0 +1 @@
Click

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='steinkirch',
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
src=src.main:main
''',
)

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)