mirror of
https://github.com/autistic-symposium/web3-starter-py.git
synced 2025-05-18 06:30:23 -04:00
add a few simple boilerplates
This commit is contained in:
parent
962d1a0778
commit
60f223867a
16 changed files with 80 additions and 0 deletions
24
Click_app/Makefile
Normal file
24
Click_app/Makefile
Normal 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
41
Click_app/README.md
Normal 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
5
Click_app/pytest.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[pytest]
|
||||
norecursedirs = venv* .*
|
||||
addopts =
|
||||
-r fEsxXw
|
||||
-vvv
|
1
Click_app/requirements.txt
Normal file
1
Click_app/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Click==7.0
|
16
Click_app/setup.py
Normal file
16
Click_app/setup.py
Normal 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
|
||||
''',
|
||||
)
|
1
Click_app/tests/__init__.py
Normal file
1
Click_app/tests/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
# -*- coding: utf8 -*-
|
1
Click_app/yourapp/__init__.py
Normal file
1
Click_app/yourapp/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
#!/usr/bin/env python3
|
32
Click_app/yourapp/yourapp.py
Normal file
32
Click_app/yourapp/yourapp.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue