https://github.com/hyperspy/link_traits
A fork of traitlets' link and dlink that can link traits in addition to traitlets.
https://github.com/hyperspy/link_traits
Last synced: about 1 year ago
JSON representation
A fork of traitlets' link and dlink that can link traits in addition to traitlets.
- Host: GitHub
- URL: https://github.com/hyperspy/link_traits
- Owner: hyperspy
- License: other
- Created: 2017-05-16T14:25:19.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2021-08-20T08:55:39.000Z (almost 5 years ago)
- Last Synced: 2024-09-18T11:17:57.501Z (almost 2 years ago)
- Language: Python
- Size: 21.5 KB
- Stars: 2
- Watchers: 7
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING.md
Awesome Lists containing this project
README
# link_traits
[](https://travis-ci.org/hyperspy/link_traits)
[](https://codecov.io/gh/hyperspy/link_traits)
**link_traits** is a fork of [traitlets'](https://github.com/ipython/traitlets)
**link** and **dlink** functions to add the ability to link
[traits](https://github.com/enthought/traits) in addition to traitlets.
## Installation
Make sure you have
[pip installed](https://pip.pypa.io/en/stable/installing/) and run:
```bash
pip install link_traits
```
**link_traits** depends on **traits** which is not a pure Python package. In
[Anaconda](http://continuum.io/anaconda) you can install link_traits and
traits as follows:
```bash
conda install link-traits -c conda-forge
```
## Running the tests
py.test is required to run the tests.
```bash
pip install "link_traits[test]"
py.test --pyargs traitlets
```
## Usage
```python
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"))
```
```python
>>> 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](https://github.com/ipython/traitlets/)
first.