Add wsl_path and win_path Properties to pathlib.Path Class.
Project description
wsl-pathlib
Extend pathlib.Path by addding the properties wsl_path and win_path that holds respectively the WSL (Windows Subsystem for Linux) and Windows representation of the Path object.
Features
- Lazy loading of the wsl_path and win_path properties on first access.
- Base
Pathobject remains fully functional. - Obviously works on both WSL and Windows side.
Limitations
- Only works for the windows drives, (paths living in the wsl's
'/mnt/'mount point) so'/home/'won't work for example.
Installation
pip install wsl-pathlib
Usage
from wsl_pathlib.path import WslPath
# Running on WSL
wsl_p = WslPath("C:\\foo")
print(wsl_p)
# => '/mnt/c/foo'
print(wsl_p.exists())
# => True
print(wsl_p.win_path)
# => 'C:\foo'
wsl_p2 = wsl_p / "file.txt"
print(wsl_p2.win_path)
# => 'C:\foo\file.txt'
License
Credits
This project was generated with wemake-python-package. Current template version is: 465848d4daab031f9be6e334ef34af011c2577bc. See what is updated since then.
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 wsl_pathlib-0.1.4.tar.gz.
File metadata
- Download URL: wsl_pathlib-0.1.4.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.2 Linux/5.15.133.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1727d17c87699135d042f54fe0fd6d5ec6259329f55d6a2d207aeb7f47079bec
|
|
| MD5 |
ab30d03c7a49a86e6c4177440ea9b142
|
|
| BLAKE2b-256 |
868c7b626ec9f7b9030a0ca460129f04d2c3b6d317d8000e61ef0b25ea69728c
|
File details
Details for the file wsl_pathlib-0.1.4-py3-none-any.whl.
File metadata
- Download URL: wsl_pathlib-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.2 Linux/5.15.133.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f33066f1314eecdc793c80f6b9c0fb5250547ebfefba401e138822172bd16af
|
|
| MD5 |
48fef39666bd8180533487b24c975fdd
|
|
| BLAKE2b-256 |
1d31beea7bfeb97c47c6b5b6fe8bc381e32357b2ad064657772963a017873dcb
|