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

refactor[codegen]: make settings into a global object #3929

Merged
merged 16 commits into from
Apr 10, 2024

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Apr 9, 2024

What I did

How I did it

cherry-picked relevant commits from #3905

How to verify it

Commit message

this commit adds a global settings object, unifying various functions
which modify global settings:
anchor_opt_level, anchor_evm_version, _set_debug

Description for the changelog

Cute Animal Picture

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

this unifies various functions which modify global settings:
anchor_opt_level, anchor_evm_version, _set_debug
vyper/compiler/settings.py Fixed Show fixed Hide fixed
vyper/evm/opcodes.py Fixed Show fixed Hide fixed
vyper/cli/vyper_compile.py Fixed Show fixed Hide fixed
vyper/evm/opcodes.py Fixed Show fixed Hide fixed
tests/unit/compiler/ir/test_optimize_ir.py Fixed Show fixed Hide fixed
vyper/utils.py Fixed Show fixed Hide fixed
@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 90.75%. Comparing base (b43ffac) to head (ce4390d).

Files Patch % Lines
vyper/cli/vyper_compile.py 33.33% 1 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3929      +/-   ##
==========================================
- Coverage   90.96%   90.75%   -0.21%     
==========================================
  Files          95       95              
  Lines       14397    14393       -4     
  Branches     3191     3190       -1     
==========================================
- Hits        13096    13063      -33     
- Misses        901      924      +23     
- Partials      400      406       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

vyper/compiler/settings.py Fixed Show fixed Hide fixed
@charles-cooper charles-cooper marked this pull request as ready for review April 9, 2024 20:21
@@ -208,16 +207,9 @@
IR_OPCODES: OpcodeMap = {**OPCODES, **PSEUDO_OPCODES}


@contextlib.contextmanager
def anchor_evm_version(evm_version: Optional[str] = None) -> Generator:
def set_global_evm_version(evm_version: int) -> None:
global active_evm_version
Copy link
Member

Choose a reason for hiding this comment

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

Can this be combined into the global settings singleton?

Copy link
Member Author

Choose a reason for hiding this comment

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

i think the change is a bit more extensive, but let me try

Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

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

lgtm, one suggestion

@charles-cooper charles-cooper enabled auto-merge (squash) April 10, 2024 15:54
@charles-cooper charles-cooper merged commit e4f1c24 into vyperlang:master Apr 10, 2024
149 checks passed
electriclilies pushed a commit to electriclilies/vyper that referenced this pull request Apr 27, 2024
this commit adds a global settings object, unifying various functions
which modify global settings:
anchor_opt_level, anchor_evm_version, _set_debug
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

5 participants