unix-style path processing functions
Project description
unixpath
unix-style path processing functions
Why?
My goal was to provide posixpath
path processing functions in pure Python (e.g. normpath
, join
, split
, etc) minus any functions that rely on any kind of "filesystem" concept (stat
, etc).
Basically, this is a "minimum viable unix path processing framework." Path processing functions are useful for e.g. ML libraries that want to use unix-style paths to refer to model variables.
(Honestly unixpath
is kind of pointless. Its functions are copy-pasted from posixpath
, so why not just import posixpath
and not worry about the extra dependency on unixpath
? Answer: because I was curious how Python implemented their unix path processing functions, so I made this library as a learning exercise.)
Install
python3 -m pip install -U unixpath
Usage
import unixpath
unixpath.join('a', 'b') # 'a/b'
unixpath.join('a', 'b', '..', 'c') # 'a/b/../c'
unixpath.normpath('a/b/../c') # 'a/c'
License
MIT
Contact
A library by Shawn Presser. If you found it useful, please consider joining my patreon!
My Twitter DMs are always open; you should send me one! It's the best way to reach me, and I'm always happy to hear from you.
- Twitter: @theshawwn
- Patreon: https://www.patreon.com/shawwn
- HN: sillysaurusx
- Website: shawwn.com
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
File details
Details for the file unixpath-0.1.1.tar.gz
.
File metadata
- Download URL: unixpath-0.1.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.6 CPython/3.9.5 Darwin/20.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06fd59fdbbd77f281b89c04a1afdc875cf970408340eae938e72070b5a9d7228 |
|
MD5 | e8ea010fa47ab1ccc36f01c5e7687cdb |
|
BLAKE2b-256 | 476d3e3f7d3c7a7237d49b8f5b7620cb526094d2825adc15385de3ddc80fa018 |
File details
Details for the file unixpath-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: unixpath-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.6 CPython/3.9.5 Darwin/20.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e83d6953daec93006605a85bd89dc5e46c244a1eb4f6bd44d2bd0616c7c2f48 |
|
MD5 | fb6fc1315ddce7ec7ed8e668031bdd4e |
|
BLAKE2b-256 | cef8918606032b66d0efb6e770a40486c9ebe76dc58e7aad5ff4863b8c16190d |