A fork to traitlets' link and dlink to link traits in addition to traitlets.
Project description
link_traits is a fork of traitlets’ link and dlink functions to add the ability to link traits in addition to traitlets.
Installation
Make sure you have pip installed and run:
pip install link_traits
link_traits depends on traits which is not a pure Python package. In Anaconda you can install traits from conda forge before install link_traits as above:
conda install traits -c conda-forge
Running the tests
py.test is required to run the tests.
pip install "link_traits[test]"
py.test --pyargs traitlets
Usage
import traits.api as t
import traitlets
from link_traits import link
class A(t.HasTraits):
a = t.Int()
class B(traitlets.HasTraits):
b = t.Int()
a = A()
b = B()
l = link((a, "a"), (b, "b"))
>>> a.a = 3
>>> b.b
3
Development
Contributions through pull requests are welcome. The intention is to keep the syntax and features in sync with the original traitlets’ link and dlink functions. Therefore, before contributing a new feature here, please contribute it to traitlets first.
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
Built Distribution
Hashes for link_traits-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56674c84f4a70667a927447e117f1c4a5a9fbaf51a491d922b8af8a3f88635b4 |
|
MD5 | 3682d3dad8e7c77700bc0f7294db05a8 |
|
BLAKE2b-256 | 2e0469367b100e6d60753ae08c116dfbe3862831a1ce02a8a923f9f19044b89e |