vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.87k stars 800 forks source link

Import Remappings #4240

Open PatrickAlphaC opened 1 month ago

PatrickAlphaC commented 1 month ago

Simple Summary

Make shorthands for imports, similar to solidity remappings

Motivation

If I have a contract in a folder many directories away, it would be nice to be able to reference it easier.

Specification

If you have an import as such:

from my.path.to.my.other.package.here.some.other.dir.package_name import hello

it would be nice to be able to represent it as:

from @package_name import hello

When you compile, you could add a remapping to have these be identical, like:

vyper --remapping "@package_name=my.path.to.my.other.package.here.some.other.dir.package_name"

Backwards Compatibility

This is a new feature, so it should not have issues here.

Dependencies

None

References

None

Copyright

Copyright and related rights waived via CC0

charles-cooper commented 1 month ago

I think search paths does what you want right?