Skip to main content

Traitlets module for pathlib.

Project description


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()

    def _default_path(self):
        return 'path/to/foo'

foo = Foo()
# On Posix systems

# or on Windows systems

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.


Download and install this repo from source, and move into the base directory.

git clone
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 .


The code in this project is licensed under MIT license.

Project details

Download files

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

Files for traitlets-paths, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size traitlets_paths-0.1.3-py2.py3-none-any.whl (3.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size traitlets_paths-0.1.3.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page