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

feat: allow specifying version in config [APE-1473] #98

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

antazoey
Copy link
Member

What I did

same as ApeWorX/ape-solidity#46

How I did it

How to verify it

Checklist

  • Passes all linting checks (pre-commit and CI jobs)
  • New test cases have been added and are passing
  • Documentation has been updated
  • PR title follows Conventional Commit standard (will be automatically included in the changelog)

@vany365 vany365 changed the title feat: allow specifying version in config feat: allow specifying version in config [APE-1473] Oct 26, 2023
@antazoey antazoey force-pushed the feat/version branch 2 times, most recently from 3d03212 to 2b24650 Compare October 26, 2023 19:07
@antazoey antazoey requested a review from Ninjagod1251 October 26, 2023 19:08
@antazoey antazoey marked this pull request as ready for review October 26, 2023 20:07
Copy link
Contributor

@sabotagebeats sabotagebeats left a comment

Choose a reason for hiding this comment

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

This seems to work, can you please review comment to make sure that it is appropriately working for me the way that it is desired to work?

Copy link
Contributor

Choose a reason for hiding this comment

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

$ ape compile -f
INFO: Compiling 'Token.vy'.
ERROR: (VyperCompileError) Token.vy
VersionException:line 1:0 Version specification "0.3.9" is not compatible with compiler version "0.3.7"
$ cat contracts/Token.vy | grep "@version"
# @version 0.3.9
$ cat ape-config.yaml
name: TokenProject
plugins:
  - name: vyper
vyper:
  version: 0.3.7
$ pico ape-config.yaml
$ cat ape-config.yaml
name: TokenProject
plugins:
  - name: vyper
vyper:
  version: 0.3.9
$ ape compile -f
INFO: Compiling 'Token.vy'.

Note: This seems to work for me, when the pragma matches the config it works and when it doesn't it fails with the error. Is this the desired effect?

Copy link
Contributor

Choose a reason for hiding this comment

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

I can reproduce the same result. I just want to make sure this is what we want @antazoey

Copy link
Contributor

Choose a reason for hiding this comment

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

also:
if i do the opposite, where they are not the same it also fails in the same manner:

$ ape compile -f
INFO: Compiling 'Token.vy'.
ERROR: (VyperCompileError) Token.vy
VersionException:line 1:0 Version specification "0.3.7" is not compatible with compiler version "0.3.9"

Copy link
Contributor

Choose a reason for hiding this comment

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

as requested I have tested it without the pragma now and it still compiles:

$ cat ape-config.yaml
name: TokenProject
plugins:
  - name: vyper
vyper:
  version: 0.3.9
$ cat contracts/Token.vy | grep "@version"
$ ape compile -f
INFO: Compiling 'Token.vy'.

Copy link
Contributor

Choose a reason for hiding this comment

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

it also works if there is no pragma and no version in the config:

$ cat ape-config.yaml
name: TokenProject
plugins:
  - name: vyper
$ cat contracts/Token.vy | grep "@version"
$ ape compile -f
INFO: Compiling 'Token.vy'.

Copy link
Contributor

Choose a reason for hiding this comment

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

it also works if there is only a pragma and there is not a version in the config:

$ cat ape-config.yaml
name: TokenProject
plugins:
  - name: vyper
$ cat contracts/Token.vy | grep "@version"
# @version 0.3.7
$ ape compile -f
INFO: Compiling 'Token.vy'.


# Show it uses this version in the compiler.
project.load_contracts(use_cache=False)
assert str(spy.call_args[1]["vyper_version"]) == version_from_config
Copy link
Contributor

@Ninjagod1251 Ninjagod1251 Oct 26, 2023

Choose a reason for hiding this comment

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

I have the same results as @sabotagebeats i just want to make sure it works as intended

@antazoey antazoey merged commit a56213a into ApeWorX:main Oct 27, 2023
11 checks passed
@antazoey antazoey deleted the feat/version branch October 27, 2023 12:01
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