Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

path related functions

Project description

lib_path

Pypi Status Python Version license maintenance

Build Status Codecov Status Better Code Maintainability snyk security

path related functions - that also work correctly with windows UNC Paths like //server/share/directory/../../directory2

100% code coverage, mypy static type checking, tested under Linux, OsX, Windows and Wine, automatic daily builds and monitoring



Try it Online

You might try it right away in Jupyter Notebook by using the “launch binder” badge, or click here

Installation and Upgrade

From source code:

# normal install
python setup.py install
# test without installing
python setup.py test

via pip latest Release:

# latest Release from pypi
pip install lib_path

# test without installing
pip install lib_path --install-option test

via pip latest Development Version:

# upgrade all dependencies regardless of version number (PREFERRED)
pip install --upgrade https://github.com/bitranox/lib_path/archive/master.zip --upgrade-strategy eager
# normal install
pip install --upgrade https://github.com/bitranox/lib_path/archive/master.zip
# test without installing
pip install https://github.com/bitranox/lib_path/archive/master.zip --install-option test

via requirements.txt:

# Insert following line in Your requirements.txt:
# for the latest Release:
lib_path
# for the latest Development Version :
https://github.com/bitranox/lib_path/archive/master.zip

# to install and upgrade all modules mentioned in requirements.txt:
pip install --upgrade -r /<path>/requirements.txt

via python:

# for the latest Release
python -m pip install upgrade lib_path

# for the latest Development Version
python -m pip install upgrade https://github.com/bitranox/lib_path/archive/master.zip

Basic Usage

chdir_to_path_of_file(path: str) -> None

expand_filelist_subdirectories(l_paths: List[str], expand_subdirs: bool = True, follow_links: bool = True) -> List[str]

format_abs_norm_path(path: str) -> str

get_absolute_dirname(path: str) -> str

get_absolute_path(path: str) -> str

get_absolute_path_relative_from_path(path: str, path2: str) -> str

get_basename_without_extension(path: str) -> str

get_current_dir() -> str

get_files_and_directories_from_list_of_paths(l_paths: List[str]) -> Tuple[List[str], List[str]]

get_files_from_directory_recursive(directory: str, followlinks: bool = True) -> List[str]

is_relative_path(path: str) -> bool

is_windows_network_unc(path: str) -> bool

log_and_raise_if_directory_does_not_exist(directory: str) -> None

log_and_raise_if_file_does_not_exist(file: str) -> None

log_and_raise_if_path_does_not_exist(path: str) -> None

path_join_posix(path: str, *paths: str)

path_remove_trailing_slashes(path: str) -> str

path_starts_with_windows_drive_letter(path: str) -> bool

strip_and_replace_backslashes(path: str) -> str

substract_windows_drive_letter(path: str) -> str

Requirements

following modules will be automatically installed :

pytest  # see : https://github.com/pytest-dev/pytest
typing  # see : https://pypi.org/project/typing/
lib_platform

Acknowledgements

  • special thanks to “uncle bob” Robert C. Martin, especially for his books on “clean code” and “clean architecture”

Contribute

I would love for you to fork and send me pull request for this project. - please Contribute

License

This software is licensed under the MIT license

Changelog

1.0.0

2019-04-19: Initial public release, PyPi Release

Project details


Release history Release notifications

This version
History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
lib_path-1.0.0-py3-none-any.whl (7.3 kB) Copy SHA256 hash SHA256 Wheel py3
lib_path-1.0.0.tar.gz (6.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page