Skip to content

Commit

Permalink
Merge pull request #71 from HyperLink-Technology/compile
Browse files Browse the repository at this point in the history
v1.0.0b2
  • Loading branch information
iamdefinitelyahuman authored Apr 14, 2019
2 parents eb168d5 + 7aea396 commit 404abbc
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.0.0b2
-------

- add compile command to cli
- bugfix in pypi package requirements
- show numbers on skipped and failing tests

1.0.0b1
-----

Expand Down
20 changes: 11 additions & 9 deletions brownie/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@
from brownie.cli.utils import color
import brownie.project as project

__version__ = "1.0.0b1" # did you change this in docs/conf.py as well?
__version__ = "1.0.0b2" # did you change this in docs/conf.py as well?

__doc__ = """Usage: brownie <command> [<args>...] [options <args>]
Commands:
init Initialize a new brownie project
bake Initialize from a brownie-mix template
compile Compiles the contract source files
console Load the console
coverage Evaluate test coverage
init Initialize a new brownie project
run Run a script in the /scripts folder
test Run test scripts in the /tests folder
coverage Evaluate test coverage
Options:
-h --help Display this message
--help Display this message
Type 'brownie <command> --help' for specific options and more information about
each command."""
Expand Down Expand Up @@ -55,11 +56,12 @@ def main():
"ERROR: Brownie environment has not been initiated for this folder."
"\nType 'brownie init' to create the file structure."
)
for container in project.load(path):
setattr(brownie, container._name, container)
brownie.__all__.append(container._name)
brownie.a = brownie.accounts
brownie.__all__.append('a')
if args['<command>'] != "compile" and "--help" not in opts:
for container in project.load(path):
setattr(brownie, container._name, container)
brownie.__all__.append(container._name)
brownie.a = brownie.accounts
brownie.__all__.append('a')

try:
importlib.import_module("brownie.cli."+args['<command>']).main()
Expand Down
28 changes: 28 additions & 0 deletions brownie/cli/compile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/python3

from docopt import docopt
from pathlib import Path
import shutil

import brownie.project as project
import brownie._config as config


__doc__ = """Usage: brownie compile [options]
Options:
--all Recompile all contracts
--help Display this message
Compiles the contract source files for this project and saves the results
in the build/contracts folder."""


def main():
args = docopt(__doc__)
project_path = project.check_for_project('.')
build_path = project_path.joinpath('build/contracts')
if config.ARGV['all']:
shutil.rmtree(build_path, ignore_errors=True)
project.load(project_path)
print("Brownie project has been compiled at {}".format(build_path))
13 changes: 7 additions & 6 deletions brownie/cli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ExpectedFailing(Exception):
def _run_test(module, fn_name, count, total):
fn = getattr(module, fn_name)
desc = fn.__doc__ or fn_name
sys.stdout.write(" {1} - {0} ({1}/{2})... ".format(desc, count, total))
sys.stdout.write(" {0} - {1} ({0}/{2})... ".format(count, desc, total))
sys.stdout.flush()
if fn.__defaults__:
args = dict(zip(
Expand All @@ -50,8 +50,8 @@ def _run_test(module, fn_name, count, total):
))
if 'skip' in args and args['skip']:
sys.stdout.write(
"\r {0[pending]}\u229d{0[dull]} {1} ".format(color, desc) +
"({0[pending]}skipped{0[dull]}){0}\n".format(color)
"\r {0[pending]}\u229d{0[dull]} {1} - ".format(color, count) +
"{1} ({0[pending]}skipped{0[dull]}){0}\n".format(color, desc)
)
return []
else:
Expand All @@ -61,8 +61,8 @@ def _run_test(module, fn_name, count, total):
fn()
if 'pending' in args and args['pending']:
raise ExpectedFailing("Test was expected to fail")
sys.stdout.write("\r {0[success]}\u2713{0} {3} - {1} ({2:.4f}s)\n".format(
color, desc, time.time()-stime, count
sys.stdout.write("\r {0[success]}\u2713{0} {1} - {2} ({3:.4f}s)\n".format(
color, count, desc, time.time()-stime
))
sys.stdout.flush()
return []
Expand All @@ -71,14 +71,15 @@ def _run_test(module, fn_name, count, total):
c = [color('success'), color('dull'), color()]
else:
c = [color('error'), color('dull'), color()]
sys.stdout.write("\r {0[0]}{1}{0[1]} {2} ({0[0]}{3}{0[1]}){0[2]}\n".format(
sys.stdout.write("\r {0[0]}{1}{0[1]} {4} - {2} ({0[0]}{3}{0[1]}){0[2]}\n".format(
c,
'\u2717' if type(e) in (
AssertionError,
VirtualMachineError
) else '\u203C',
desc,
type(e).__name__,
count
))
sys.stdout.flush()
if type(e) != ExpectedFailing and 'pending' in args and args['pending']:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '1.0.0b1'
release = '1.0.0b2'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ hexbytes>=0.1.0,<1.0.0
lru-dict>=1.1.6,<2.0.0
pypiwin32>=223;platform_system=='Windows'
pyreadline==2.1;platform_system=='Windows'
py-solc-x>=0.2.0
py-solc-x>=0.2.1
requests>=2.16.0,<3.0.0
semantic-version>=2.6.0
websockets>=6.0.0,<7.0.0
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
setup(
name = 'eth-brownie',
packages=find_packages(),
version = '1.0.0b1',
version = '1.0.0b2',
license = 'MIT',
description = 'A python framework for Ethereum smart contract deployment, testing and interaction.',
long_description = long_description,
long_description_content_type = "text/markdown",
author = 'Benjamin Hauser',
author_email = 'ben.hauser@hyperlink.technology',
url = 'https://github.com/HyperLink-Technology/brownie',
download_url = 'https://github.com/HyperLink-Technology/brownie/archive/v1.0.0b1.tar.gz',
download_url = 'https://github.com/HyperLink-Technology/brownie/archive/v1.0.0b2.tar.gz',
keywords = ['brownie'],
install_requires = requirements,
entry_points = {"console_scripts": ["brownie=brownie.cli.__main__:main"]},
Expand Down

0 comments on commit 404abbc

Please sign in to comment.