Skip to content

Commit

Permalink
bump vvm version, uses local vyper version when possible, only defaul…
Browse files Browse the repository at this point in the history
…t to vvm otherwise
  • Loading branch information
trocher committed Nov 21, 2024
1 parent c9e6d3c commit 0344d18
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
12 changes: 8 additions & 4 deletions boa/interpret.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import vvm
import vyper
from packaging.version import Version
from vvm.utils.versioning import detect_vyper_version_from_source
from vvm.utils.versioning import (
detect_version_specifier_set,
detect_vyper_version_from_source,
)
from vyper.ast.parse import parse_to_ast
from vyper.cli.vyper_compile import get_search_paths
from vyper.compiler.input_bundle import (
Expand Down Expand Up @@ -251,9 +254,10 @@ def loads_partial(
if dedent:
source_code = textwrap.dedent(source_code)

# TODO: let vvm know our preferred version (vyper.__version__)
version = detect_vyper_version_from_source(source_code)
if version is not None and version != Version(vyper.__version__):
specifier_set = detect_version_specifier_set(source_code)
# Use VVM only if the installed version is not in the specifier set
if specifier_set is not None and not specifier_set.contains(vyper.__version__):
version = detect_vyper_version_from_source(source_code)
filename = str(filename) # help mypy
# TODO: pass name to loads_partial_vvm, not filename
return _loads_partial_vvm(source_code, version, filename)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"pytest-cov",

# required to compile older versions of vyper
"vvm",
"vvm>=0.3.2",

# eth-rlp requirement, not installed by default with 3.12
"typing-extensions",
Expand Down
6 changes: 2 additions & 4 deletions tests/unitary/contracts/vvm/test_vvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ def test_load_vvm():
"# @version ==0.3.10",
"# @version ~=0.3.10",
"# @version 0.3.10",
# "# pragma version >=0.3.8, <0.4.0, !=0.3.10",
# TODO: uncomment when vvm accept Specifier sets
# "# pragma version ==0.4.0rc3",
# TODO: uncomment when vvm is fixed (https://github.com/vyperlang/vvm/pull/29)
"# pragma version >=0.3.8, <0.4.0, !=0.3.10",
"# pragma version ==0.4.0rc3",
],
)
def test_load_complex_version_vvm(version_pragma):
Expand Down

0 comments on commit 0344d18

Please sign in to comment.