simplified scripts with args and added basic docker cmds

This commit is contained in:
Patrick Daly 2021-07-24 08:37:21 -07:00
parent bb4af4f16f
commit 4b53a99fc9
4 changed files with 44 additions and 33 deletions

6
poetry.lock generated
View File

@ -159,7 +159,7 @@ unicode_backport = ["unicodedata2"]
name = "click"
version = "8.0.1"
description = "Composable command line interface toolkit"
category = "dev"
category = "main"
optional = false
python-versions = ">=3.6"
@ -170,7 +170,7 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
name = "colorama"
version = "0.4.4"
description = "Cross-platform colored terminal text."
category = "dev"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
@ -933,7 +933,7 @@ multidict = ">=4.0"
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "b655f310d9f4a561cd0ad1fb94769d088f90362763251b8500eab116cb9d599c"
content-hash = "54b44cd9c491f5cfd9ffc40d350fac513fb1e63c3c4fd3046aa19f66ebf372d5"
[metadata.files]
aiohttp = [

View File

@ -9,6 +9,7 @@ python = "^3.8"
web3 = "^5.21.0"
pydantic = "^1.8.2"
hexbytes = "^0.2.1"
click = "^8.0.1"
[tool.poetry.dev-dependencies]
pre-commit = "^2.13.0"
@ -29,14 +30,11 @@ build-backend = "poetry.core.masonry.api"
lint = 'scripts.dev_tools:lint'
test = 'scripts.dev_tools:test'
isort = 'scripts.dev_tools:isort'
isortcheck = 'scripts.dev_tools:isortcheck'
mypy = 'scripts.dev_tools:mypy'
black = 'scripts.dev_tools:black'
blackcheck = 'scripts.dev_tools:blackcheck'
start = 'scripts.dev_tools:start'
start_background = 'scripts.dev_tools:start_background'
stop = 'scripts.dev_tools:stop'
build = 'scripts.dev_tools:build'
start = 'scripts.docker:start'
stop = 'scripts.docker:stop'
build = 'scripts.docker:build'
[tool.black]
exclude = '''

View File

@ -1,4 +1,5 @@
from subprocess import check_call
import click
from subprocess import check_call, run
def lint():
check_call(['pylint', '.'])
@ -6,30 +7,23 @@ def lint():
def test():
check_call(['pytest', '--cov=mev_inspect', 'tests'])
def isort():
check_call(['isort', '.'])
def isortcheck():
check_call(['isort', '--diff', '.'])
@click.command()
@click.option('-c', required=False, is_flag=True)
def isort(c: str):
'''if c is present run isort in diff mode'''
if c:
check_call(['isort', '.'])
else:
check_call(['isort', '--diff', '.'])
def mypy():
check_call(['mypy', '.'])
def black():
check_call(['black', '.'])
def blackcheck():
check_call(['black', '--diff', '--color', '.'])
def start():
check_call(['docker', 'compose', 'up'])
def start_background():
check_call(['docker', 'compose', 'up', '-d'])
def stop():
check_call(['docker', 'compose', 'down'])
def build():
check_call(['docker', 'compose', 'build'])
@click.command()
@click.option('-c', required=False, is_flag=True)
def black(c: str):
'''if c is present run black in diff mode'''
if c:
check_call(['black', '.'])
else:
check_call(['black', '--diff', '--color', '.'])

19
scripts/docker.py Normal file
View File

@ -0,0 +1,19 @@
import click
from subprocess import check_call, run
from typing import List
@click.command()
@click.option('-b', required=False, is_flag=True)
def start(b: str):
'''if d is present background compose'''
if b:
check_call(['docker', 'compose', 'up', '-d'])
click.echo('docker running in the background...')
else:
check_call(['docker', 'compose', 'up'])
def stop():
check_call(['docker', 'compose', 'down'])
def build():
check_call(['docker', 'compose', 'build'])