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

Support relative imports of the package under development #75

Open
lyz-code opened this issue Feb 15, 2021 · 0 comments
Open

Support relative imports of the package under development #75

lyz-code opened this issue Feb 15, 2021 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@lyz-code
Copy link
Owner

Description

When developing a package I prefer to use relative imports over absolute ones to avoid loop dependencies. Right now autoimport only uses absolute imports, so I need to remove the absolute reference and convert it to relative.

Possible Solution

It's not easy to solve, as we can't take into account the relative position of the file we're fixing regarding the rest of the project, as some of the tools that use autoimport (ALE for vim integration), copies the file to a temporal directory and applies the fixer there.

So we would need to:

  • Deduce the location of the file regarding the package. Either by analyzing the objects of the file we're fixing and searching them in the package, or by analyzing existent relative import statements.
  • Get the absolute path to the object that we need to import
  • Get the relative path from the file location to the desired object

Additional context

Related Issue

@lyz-code lyz-code added the enhancement New feature or request label Oct 22, 2021
@lyz-code lyz-code added the help wanted Extra attention is needed label Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant