Replace absolute imports with relative imports
See original GitHub issueI’d like to use 2.0 in a project of mine, but I rely on some packages that don’t yet support it, so my intent is to temporarily bundle prompt_toolkit as a subpackage until these issues clear themselves up. When trying to do this, I discovered many absolute imports that could/should be rewritten as package-relative, e.g. in application.py.
Would you be willing to accept a PR that replaces the absolute imports of prompt_toolkit.x
with relative imports? I’d stick to the library code and wouldn’t touch examples/tests/etc.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Absolute vs Relative Imports in Python
A relative import specifies the resource to be imported relative to the current location—that is, the location where the import statement is. There...
Read more >Absolute and Relative Imports in Python - GeeksforGeeks
Absolute import involves a full path i.e., from the project's root folder to the desired module. An absolute import state that the resource...
Read more >Get rid of relative import path hell by adding absolute imports ...
We're gonna make a minor change in tsconfig.json . Under the paths property, add another path definition indicate src folder: ... "paths": ...
Read more >How Pros Get Rid of Relative Imports - DEV Community
The easiest way to get rid of the long imports is to add baseUrl in the jsconfig.json (add jsconfig.json at the root level...
Read more >Automatically Fixing Relative Imports with ESLint - Jeff Chen
Absolute imports were the answer—I needed to both set up TypeScript to support them and transform all of the project's relative imports into ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
While I’d argue that using relative imports is the “correct” thing to do, I agree with you that it seems other large, well-established projects are getting along fine with absolute imports.
I also agree that adding docs/scripts concerning vendoring would be valuable, as I can’t imagine I’m the only person who will run into this issue with the 1.0/2.0 split.
When I get the chance I can play around with that one-liner and let you know what tweaks need to be made, if any.
I’m glad I found this, since I intend to do the same with my project, I too intend to do it this way by replacing all
from ...
with my package namespace. I hope in the future this is not broken too much @jonathanslenders , if you could have in mind people like us when you further develop that’d be great! Thanks for your great lib!