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 link_traits and traits as follows:
conda install link-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
File details
Details for the file link_traits-1.0.2.tar.gz
.
File metadata
- Download URL: link_traits-1.0.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a5de4aa37bc0c9e135b2b28c37b8986fcb0c8e68e1e7c26939b2316dfaa1674 |
|
MD5 | 23667341b3d8bbe392c2fec9a36bae95 |
|
BLAKE2b-256 | 68703193b471babb46ddb5be65fda14b4e17e544838531fcb84266f497217136 |
File details
Details for the file link_traits-1.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: link_traits-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59fb6c10a579f00308acadd7bed3caeaa112babe98203c933cff680106f635fc |
|
MD5 | fb099a76a05d13fc58e551f477b630f0 |
|
BLAKE2b-256 | d6404fb7bcca14e826d75df8acbaac39977a0d3645f14d0671699a28a2f4666b |