0 purchases
relpath 1.0.3
relpath - relative path module
This module addresses a limitation of the pathlib.Path class. When using Path, if the relative path is not a subdirectory of the base path, it raises a ValueError. However, with this module, that weakness is eliminated.
Installation
pip install rel-path
View on PyPi
View on GitHub
Example for error:
from pathlib import Path
base="/home"
rel="/"
# Error when using Path
Path(rel).relative_to(base)
Exception has occurred: ValueError
'/' does not start with '/home'
Example using relpath module:
from relpath import relative_path
base="/home"
rel="/"
print(relative_path(base, rel))
../
Configure PyPi API Token
Poetry is used to manage the package.
How to publish
To configure the PyPi API token, use the following command once:
# Run once to set the PyPi API token
set +o history
poetry config pypi-token.pypi '<your-pypi-token>'
set -o history
# Build the package
poetry build
# Publish the package
poetry publish
Support
If you encounter any issues with the relpath module, please report them on GitHub. I will respond as soon as possible. Contributions to the code are always welcome, and I appreciate ideas for new modules or improvements to existing ones.
Change Log
[1.0.3] - 2024-08-23
Fixed
Fixed the Github Actions for python tests
[1.0.2] - 2024-08-23
Added
Added support for poetry
Added Change Log to README.md
Removed
Support for Python 3.6, 3.7, and 3.7
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.