Skip to main content
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.

Metadata

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)

Source distribution for resolve-module-import 0.1.0a0
File Size Uploaded Provenance Actions
resolve_module_import-0.1.0a0.tar.gz 3.1 kB Without provenance Details for resolve_module_import-0.1.0a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for resolve-module-import 0.1.0a0
File Interpreter ABI Platform Actions
resolve_module_import-0.1.0a0-py2.py3-none-any.whl Python 3, Python 2 none any Details for resolve_module_import-0.1.0a0-py2.py3-none-any.whl

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

Security for resolve-module-import 0.1.0a0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page