[IPython-User] ANN: numtraits v0.2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[IPython-User] ANN: numtraits v0.2

Thomas Robitaille
Hi everyone,

(apologies if you already saw this on the numpy-discussion list. I am
resending it to the scipy-user and ipython-user mailing lists since
these were down last week)

We have released a small experimental package called numtraits that
builds on top of the traitlets package and provides a NumericalTrait
class that can be used to validate properties such as:

* number of dimension (for arrays)
* shape (for arrays)
* domain (e.g. positive, negative, range of values)
* units (with support for astropy.units, pint, and quantities)

The idea is to be able to write a class like:

    class Sphere(HasTraits):

        radius = NumericalTrait(domain='strictly-positive', ndim=0)
        position = NumericalTrait(shape=(3,))

and all the validation will then be done automatically when the user
sets 'radius' or 'position'.

In addition, tuples and lists can get automatically converted to
arrays, and default values can be specified. You can read more about
the package and see examples of it in use here:

  https://github.com/astrofrog/numtraits

and it can be easily installed with

  pip install numtraits

The package supports both Python 3.3+ and Legacy Python (2.7) :)

At this point, we would be very interested in feedback - the package
is still very young and we can still change the API if needed. Please
open issues with suggestions!

Cheers,

Tom and Francesco
_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|

Re: ANN: numtraits v0.2

Zoltán Vörös-2
Hi Thomas,

ipython-user is deprecated, you should post on ipython-dev, even if the name is misleading. All mail traffic is going through that now.

Cheers,
Zoltán

On Tue, Sep 29, 2015 at 3:59 PM, Thomas Robitaille <[hidden email]> wrote:
Hi everyone,

(apologies if you already saw this on the numpy-discussion list. I am
resending it to the scipy-user and ipython-user mailing lists since
these were down last week)

We have released a small experimental package called numtraits that
builds on top of the traitlets package and provides a NumericalTrait
class that can be used to validate properties such as:

* number of dimension (for arrays)
* shape (for arrays)
* domain (e.g. positive, negative, range of values)
* units (with support for astropy.units, pint, and quantities)

The idea is to be able to write a class like:

    class Sphere(HasTraits):

        radius = NumericalTrait(domain='strictly-positive', ndim=0)
        position = NumericalTrait(shape=(3,))

and all the validation will then be done automatically when the user
sets 'radius' or 'position'.

In addition, tuples and lists can get automatically converted to
arrays, and default values can be specified. You can read more about
the package and see examples of it in use here:

  https://github.com/astrofrog/numtraits

and it can be easily installed with

  pip install numtraits

The package supports both Python 3.3+ and Legacy Python (2.7) :)

At this point, we would be very interested in feedback - the package
is still very young and we can still change the API if needed. Please
open issues with suggestions!

Cheers,

Tom and Francesco
_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user


_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user