Recursively traverses a source directory and yields tuples of Python module names as used in import statements and their corresponding file paths.
Project description
yield-module-names-and-python-file-paths
Recursively traverses a source directory and yields tuples of Python module names as used in import statements and their corresponding file paths.
Features
- Handles packages.
- Skips hidden files and directories.
- Useful for code analysis tools.
Installation
pip install yield-module-names-and-python-file-paths
Usage
Suppose your project has this structure:
src/
├── foo.py
├── bar.py
├── subpkg/
│ ├── __init__.py
│ └── utils.py
└── scripts/
└── tool.py
You can enumerate the modules:
from yield_module_names_and_python_file_paths import yield_module_names_and_python_file_paths
for module_name, python_file_path in yield_module_names_and_python_file_paths('src'):
print(module_name, '->', python_file_path)
Output:
foo -> myproject/foo.py
bar -> myproject/bar.py
subpkg -> myproject/subpkg/__init__.py
subpkg.utils -> myproject/subpkg/utils.py
scripts.tool -> myproject/scripts/tool.py
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yield_module_names_and_python_file_paths-0.1.0a0.tar.gz.
File metadata
- Download URL: yield_module_names_and_python_file_paths-0.1.0a0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bc6f5dc5d1f7f93550201aa8250ba29426d3330119252921c29948fb2640387
|
|
| MD5 |
6c94e74cc66e668b76f9b22b0afd131a
|
|
| BLAKE2b-256 |
11506ebfd6ab252ad1fddc1df0feea8b2e97e4dd8855d688a4589168c9511813
|
File details
Details for the file yield_module_names_and_python_file_paths-0.1.0a0-py2.py3-none-any.whl.
File metadata
- Download URL: yield_module_names_and_python_file_paths-0.1.0a0-py2.py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3ce0fd5b325ff3649919786824fa9154fd7421141919ea5d723df72e663d889
|
|
| MD5 |
8430ccc9a9042590312ead27496c9f52
|
|
| BLAKE2b-256 |
737f96dce82ae08bf060a1e011299a1ebdf4271ea62070977b610c25d8b795f1
|