No project description provided
Project description
midir
A library for resolving relative module dependencies.
Description
midir is a Python library designed to handle relative module dependencies by resolving directory paths in an intelligent and system-agnostic way. This library can be used to introspect the file structure of your project and manipulate Python's sys.path, allowing for dynamic module imports based on directory hierarchy. It is especially helpful for larger projects where file structure can become complex and static imports cumbersome to manage.
Features
-
midir(path: str) -> str:Returns the directory name of the given file or directory path. -
get_caller() -> str:Returns the name of the file or the location (directory) where the current execution point is present. -
mipath(path: str = None) -> str:Returns the canonical (absolute) path of the current execution point or a provided path. -
midir(path: str = None) -> str:Returns the directory name where the current execution point is or from a provided path. -
root_levels(levels: int = 1) -> None:Makes directories available for import by adding them to sys.path. It starts from directory of the caller file and move up the directory hierarchy. The number of levels up to move is determined by input argument. -
root_suffix(suffix: str) -> None:Similar toroot_levels, but instead of moving up a certain number of directories, it continues to move up until it finds a directory whose name ends with the provided suffix and adds that directory to sys.path.
Exceptions
FolderNotFoundError:Custom exception raised when no folder matching the required conditions (inroot_suffix) is found in the directory hierarchy.
Build instructions
- Building the package before uploading: 'python -m build' (from "midir").
- Upload the package to pypi: 'python -m twine upload --repository {pypi|testpypi} dist/*'
- Install the package from pypi: 'python -m pip install --index-url {https://test.pypi.org/simple|https://pypi.org/simple} --no-deps midir'
- If any dependencies are required, edit the
pyproject.tomlfile, "[project]" field, and add adependencieskey with aList\[str\]value, where each string is apip-readable dependency.
Project details
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 midir-1.0.0.tar.gz.
File metadata
- Download URL: midir-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c40a4763c9c9769b498cfa97ad50b7b5c977ae4a00bd1182810aad9bf33c35b
|
|
| MD5 |
c7b6ab1df567f759ac9e790d9ba4b2b6
|
|
| BLAKE2b-256 |
4bce14f4ba4414e4be4625df172ee1e97de6073935847eea80f94e6a58ead284
|
File details
Details for the file midir-1.0.0-py3-none-any.whl.
File metadata
- Download URL: midir-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93130aec89b5e7bc43b3997d575cc99f492be16f2593055687e2284d9b93d351
|
|
| MD5 |
01a6b77185a4843539aeaf70fdde372b
|
|
| BLAKE2b-256 |
81412786489cb64c1c89506af16f683fd1bb3650520344bd495c0af80f47275c
|