Pre-release
This release is a pre-release and may not be stable for production use.
resolve-module-import
Resolves a (possibly relative) module import to its fully qualified module name.
Features
- Resolves both absolute and relative Python module imports
- Helps with tooling (e.g., linters, code analysis) that needs to resolve imports
Installation
pip install resolve-module-import
Usage
resolve_module_import(
current_module_name, # type: str
current_module_is_package, # type: bool
imported_module_name, # type: Optional[str]
imported_module_level, # type: int
)
from resolve_module_import import resolve_module_import
# from . import foo inside 'mypkg/subpkg/mymodule.py'
resolve_module_import('mypkg.subpkg.mymodule', False, 'foo', 1)
# Output: 'mypkg.subpkg.foo'
# from .. import foo inside 'pkg/bar/' (a package)
resolve_module_import('pkg.bar', True, 'foo', 2)
# Output: pkg.foo
# import sys
resolve_module_import('any.module', False, 'sys', 0)
# Output: 'sys'
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Release files for resolve-module-import 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| resolve_module_import-0.1.0a0.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| resolve_module_import-0.1.0a0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 6.7 kB
Release files / resolve_module_import-0.1.0a0.tar.gz
| Download URL | resolve_module_import-0.1.0a0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6e9c50b8eee95e872aaaba6e0f8b274e71d77fa1028417544b6bd02da48a87a
|
|
BLAKE2b-256 checksum How to use checksums |
27e61a5860c44b404f24d9877cffc5c3a7e6edf942c765c0cedb0904cea973a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / resolve_module_import-0.1.0a0-py2.py3-none-any.whl
| Download URL | resolve_module_import-0.1.0a0-py2.py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
323944d5005690832c424be23588d3820f3f18329c7f986c90d6fed879e4578a
|
|
BLAKE2b-256 checksum How to use checksums |
bbb42d7f7d2062c638fe74ec9427ed99968c7bc2d85b5aea8211da200d1a51fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|