Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "metadata" output format #2597

Merged
merged 2 commits into from
Jan 10, 2022

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jan 8, 2022

What I did

This commit adds a "metadata" output format which is intended to be
useful for downstream tooling. Right now it is limited to function
signatures and their metadata, but it could be extended to more metadata
about modules such as type definitions and in-scope interfaces
(basically everything in GlobalContext).

How I did it

How to verify it

# tmp/foo.vy
@internal
def foo() -> (uint256, uint256, uint256):
    return 1, 2, 3

@internal
def bar():
    pass

@external
def baz():
    self.foo()
    self.bar()
$ vyper -f metadata tmp/foo.vy
/home/charles/.venvs/vyper/lib/python3.8/site-packages/vyper-0.3.2+commit.b77ab184-py3.8.egg/vyper/compiler/output.py:93: UserWarning: metadata output format is unstable!
  warnings.warn("metadata output format is unstable!")
{"function_signatures": {"foo": {"name": "foo", "args": [], "return_type": "(uint256, uint256, uint256)", "mutability": "nonpayable", "internal": true, "nonreentrant_key": null, "is_from_json": false, "base_args": [], "default_args": [], "default_values": {}, "frame_start": 224, "frame_size": 0, "_lll_identifier": "internal_foo___"}, "bar": {"name": "bar", "args": [], "return_type": "None", "mutability": "nonpayable", "internal": true, "nonreentrant_key": null, "is_from_json": false, "base_args": [], "default_args": [], "default_values": {}, "frame_start": 224, "frame_size": 0, "_lll_identifier": "internal_bar___"}, "baz": {"name": "baz", "args": [], "return_type": "None", "mutability": "nonpayable", "internal": false, "nonreentrant_key": null, "is_from_json": false, "base_args": [], "default_args": [], "default_values": {}, "frame_start": 224, "frame_size": 96}}}

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2022

Codecov Report

Merging #2597 (74938a5) into master (23ed82c) will increase coverage by 0.38%.
The diff coverage is 84.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2597      +/-   ##
==========================================
+ Coverage   86.26%   86.64%   +0.38%     
==========================================
  Files          90       91       +1     
  Lines        9351     9430      +79     
  Branches     2370     2357      -13     
==========================================
+ Hits         8067     8171     +104     
+ Misses        796      774      -22     
+ Partials      488      485       -3     
Impacted Files Coverage Δ
vyper/builtin_functions/utils.py 100.00% <ø> (ø)
vyper/codegen/stmt.py 86.61% <ø> (ø)
vyper/compiler/__init__.py 87.17% <ø> (ø)
vyper/utils.py 87.23% <ø> (+3.79%) ⬆️
vyper/codegen/expr.py 80.62% <50.00%> (+0.03%) ⬆️
vyper/semantics/types/user/interface.py 81.57% <75.00%> (-0.41%) ⬇️
vyper/codegen/types/types.py 84.92% <78.12%> (+1.58%) ⬆️
vyper/semantics/types/bases.py 83.95% <80.00%> (-0.20%) ⬇️
vyper/abi_types.py 80.95% <80.95%> (ø)
vyper/compiler/phases.py 92.52% <81.81%> (-1.54%) ⬇️
... and 28 more

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 cedf936...74938a5. Read the comment docs.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Jan 8, 2022

This pull request fixes 2 alerts when merging b77ab18 into 23ed82c - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable
  • 1 for Module is imported with 'import' and 'import from'

This commit adds a "metadata" output format which is intended to be
useful for downstream tooling. Right now it is limited to function
signatures and their metadata, but it could be extended to more metadata
about modules such as type definitions and in-scope interfaces
(basically everything in GlobalContext).
technically `-f abi` already outputs function signatures. this metadata
output format produces more information.
@charles-cooper charles-cooper merged commit 2799cc7 into vyperlang:master Jan 10, 2022
@charles-cooper charles-cooper deleted the metadata_output branch January 10, 2022 22:40
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.

None yet

3 participants