Skip to main content

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


Download files

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

Source Distribution

lib_path-1.0.0.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

lib_path-1.0.0-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page