Skip to content

VIP: Add support for relative imports. #1367

@jacqueswww

Description

@jacqueswww

Simple Summary

Allow using . and .. to specify relative imports of interfaces.

Abstract

Following a long discussion on #1361. It came to light that frameworks and programmers need more felxibility in terms of importing interfaces.

Motivation

The motivation is critical for VIPs that add or change Vyper's functionality. It should clearly explain why the existing Vyper functionality is inadequate to address the problem that the VIP solves as well as how the VIP is in line with Vyper's goals and design philosophy.

Specification

.. will specify parent directory of the current .vy being parsed.
. will specify current directory of the .vy being parsed.

e.g.

from .token_interface import TokenInterface

Will create an interface names TokenInterface from a file currently located at the same directory as the .vy file that is currently being parsed.

Environment variable:
Vyper shold be allowed to change it's lookup directory from CWD to one set in VYPER_PATHS.

Backwards Compatibility

Is forward compatible.

Dependencies

None.

Copyright

Copyright and related rights waived via CC0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Easy PickingsUsed to denote issues that should be easy to implementVIP: ApprovedVIP Approved

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions