Traitlets module for pathlib.
Project description
traitlets_paths
Traitlets module for pathlib
This package defines traitlets
for all pathlib objects.
Getting Started
Install from pip:
pip install traitlets_paths
Basic Example
from traitlets import HasTraits, default
from traitlets_paths import PurePath
class Foo(HasTraits):
path = PurePath()
@default('path')
def _default_path(self):
return 'path/to/foo'
foo = Foo()
foo.path
# On Posix systems
PurePosixPath('path/to/foo')
# or on Windows systems
PureWindowsPath('path/to/foo')
How to get a TraitError
When we try passing a bad type:
foo = Foo(path=5)
we get a TraitError:
TraitError: The 'path' trait of a Foo instance must be a pathlib.PurePath trait, but a value of 5 <class 'int'> was specified.
Developing
Download and install this repo from source, and move into the base directory.
git clone https://github.com/Zsailer/traitlets_paths
cd traitlets_paths
If you use pipenv, you can install a developement version:
pipenv install --dev
Otherwise you can install a development version using pip
pip install -e .
Licensing
The code in this project is licensed under MIT license.
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
traitlets_paths-0.1.3.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file traitlets_paths-0.1.3.tar.gz
.
File metadata
- Download URL: traitlets_paths-0.1.3.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1ba6cacd220b7ba2d357ffd28488cec2c45d4bc687eab7f8bb54df1f618809a |
|
MD5 | befe8d9b8e12f69ae6534dbd8ec2760e |
|
BLAKE2b-256 | 1561ffc36a5e8f876433fec95c880591390ff696e7e85e10fa92514252135144 |
File details
Details for the file traitlets_paths-0.1.3-py2.py3-none-any.whl
.
File metadata
- Download URL: traitlets_paths-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f72f81463ad97933ec11a5e2bea56dad37f97acde206db7528f4e85b07f9b558 |
|
MD5 | 44633dd2d0172d41833e96866f1cd2cf |
|
BLAKE2b-256 | 8206427ae688548d7bfa6b99b0a708ca8e81a132da7da56fa5a9f1fdea857a10 |