Skip to content

Cmd settings to config#501

Merged
iamdefinitelyahuman merged 15 commits intoeth-brownie:masterfrom
matnad:cmd_settings-to-config
May 9, 2020
Merged

Cmd settings to config#501
iamdefinitelyahuman merged 15 commits intoeth-brownie:masterfrom
matnad:cmd_settings-to-config

Conversation

@matnad
Copy link
Copy Markdown
Collaborator

@matnad matnad commented May 6, 2020

What I did

Exposed block_time, default_balance and time ganache-cli parameters
Added cmd_settings to project config file
Added Wei.to() to convert wei to other units

Related issue: #486

How I did it

Project settings update network settings on project load
Wei.to() operates with Brownie's Fixed class

How to verify it

  • Add cmd_settings to project config file and lauch cmd
  • run tests

Checklist

  • I have confirmed that my PR passes all linting checks
  • I have included test cases
  • I have updated the documentation
  • I have added an entry to the changelog

@codecov-io
Copy link
Copy Markdown

codecov-io commented May 7, 2020

Codecov Report

Merging #501 into master will increase coverage by 0.09%.
The diff coverage is 83.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #501      +/-   ##
==========================================
+ Coverage   88.35%   88.44%   +0.09%     
==========================================
  Files          56       56              
  Lines        6104     6138      +34     
  Branches     1348     1355       +7     
==========================================
+ Hits         5393     5429      +36     
+ Misses        489      485       -4     
- Partials      222      224       +2     
Impacted Files Coverage Δ
brownie/_cli/networks.py 77.31% <ø> (ø)
brownie/_config.py 77.90% <42.85%> (+1.40%) ⬆️
brownie/network/rpc.py 89.17% <91.30%> (+0.51%) ⬆️
brownie/convert/datatypes.py 96.00% <100.00%> (+0.08%) ⬆️
brownie/exceptions.py 88.73% <100.00%> (+0.32%) ⬆️
brownie/network/transaction.py 87.39% <0.00%> (+0.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3a0e4f...4b31de4. Read the comment docs.

@iamdefinitelyahuman
Copy link
Copy Markdown
Member

Rebasing in #503 should fix the failing tests.

matnad added 5 commits May 7, 2020 16:11
Accepts a unit as string and will return a Fixed number converted to the desired unit type
Project specific cmd_settings for ganache-cli
new params: --time, --blockTime, --defaultBalanceEther
loading a project will update the network settings with project specific settings
- better validation of cmd_settings with error handling
- added block_time() to Rpc to get the time in seconds between blocks if specified
- added support for --time parameter
added brownie-config.yaml for test project
tests to verify that project specific configs update networks
@matnad matnad force-pushed the cmd_settings-to-config branch from 8626ef6 to 90fca4b Compare May 7, 2020 14:13
matnad added 2 commits May 7, 2020 21:04
No way to reliably query it from an attached instance
will only copy the brownie-config.yaml file when needed
will now properly open, close and reset the network
Copy link
Copy Markdown
Member

@iamdefinitelyahuman iamdefinitelyahuman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good overall, a few things to address and a couple questions. Thanks for your work on this!

matnad added 7 commits May 8, 2020 13:34
replace shutil.copy with yaml.dump and dump the config string into the project root
testprojectconfig fixture no longer necessary, additional logic moved to settings_proj fixture
better messages and Brownie specific classes for warning
changed type checking to isinstance
changed ValueError to TypeError
add "cmd_settings: {}" to default-config.yaml to indicate that these can be specified
@matnad matnad marked this pull request as ready for review May 8, 2020 15:44
Copy link
Copy Markdown
Member

@iamdefinitelyahuman iamdefinitelyahuman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few minor things.

- removed test file cleanup
- changed default cmd_settings from {} to null
- made _recursive_update null-safe
- replaced yaml.load with yaml.safe_load
- moved yield outside load context
- improved import statements in test_wei.py
@iamdefinitelyahuman iamdefinitelyahuman merged commit 025329e into eth-brownie:master May 9, 2020
@matnad matnad mentioned this pull request May 9, 2020
@matnad matnad deleted the cmd_settings-to-config branch December 28, 2020 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants