mirror of
https://github.com/autistic-symposium/web3-starter-py.git
synced 2025-05-17 22:20:22 -04:00
🛠 Commit simple boilerplate
This commit is contained in:
parent
30fa78c7d9
commit
8270d63489
8 changed files with 123 additions and 2 deletions
24
Makefile
Normal file
24
Makefile
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
.PHONY: clean-pyc
|
||||||
|
|
||||||
|
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
|
43
README.md
43
README.md
|
@ -1,2 +1,41 @@
|
||||||
# python3_CLI_boilerplate
|
# Awesome Python CLI Boilerplate
|
||||||
A quick boilerplate for CLI apps/scripts in Python3
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```
|
||||||
|
pip3 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
pytest.ini
Normal file
5
pytest.ini
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[pytest]
|
||||||
|
norecursedirs = venv* .*
|
||||||
|
addopts =
|
||||||
|
-r fEsxXw
|
||||||
|
-vvv
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Click==7.0
|
16
setup.py
Normal file
16
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
tests/__init__.py
Normal file
1
tests/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#!/usr/bin/env python3
|
1
yourapp/__init__.py
Normal file
1
yourapp/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#!/usr/bin/env python3
|
34
yourapp/yourapp.py
Normal file
34
yourapp/yourapp.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
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