Re: ANN: numtraits v0.2
Zoltán Vörös <[email protected]> Tue, 29 Sep 2015 16:43:49 +0200
| Newsgroups | gmane.comp.python.ipython.user |
|---|---|
| Message-ID | <CAAHRMOX5J6V7OASoBeZNh60=-s-QmzR8LWQ-Rsq_Vw2_vR5EbQ@mail.gmail.com> |
--===============6339970520992902594== Content-Type: multipart/alternative; boundary=047d7bdca2f8912d4b0520e3d776 --047d7bdca2f8912d4b0520e3d776 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=C3=A1n On Tue, Sep 29, 2015 at 3:59 PM, Thomas Robitaille < [email protected]> 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 =3D NumericalTrait(domain=3D'strictly-positive', ndim=3D0) > position =3D NumericalTrait(shape=3D(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 > [email protected] > https://mail.scipy.org/mailman/listinfo/ipython-user > --047d7bdca2f8912d4b0520e3d776 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div><div>Hi Thomas, <br><br></div>ipython-user is de= precated, you should post on ipython-dev, even if the name is misleading. A= ll mail traffic is going through that now.<br><br></div>Cheers,<br></div>Zo= lt=C3=A1n<br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote= ">On Tue, Sep 29, 2015 at 3:59 PM, Thomas Robitaille <span dir=3D"ltr"><= <a href=3D"mailto:[email protected]" target=3D"_blank">thomas.rob= [email protected]</a>></span> wrote:<br><blockquote class=3D"gmail_quote= " style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">H= i everyone,<br> <br> (apologies if you already saw this on the numpy-discussion list. I am<br> resending it to the scipy-user and ipython-user mailing lists since<br> these were down last week)<br> <br> We have released a small experimental package called numtraits that<br> builds on top of the traitlets package and provides a NumericalTrait<br> class that can be used to validate properties such as:<br> <br> * number of dimension (for arrays)<br> * shape (for arrays)<br> * domain (e.g. positive, negative, range of values)<br> * units (with support for astropy.units, pint, and quantities)<br> <br> The idea is to be able to write a class like:<br> <br> =C2=A0 =C2=A0 class Sphere(HasTraits):<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 radius =3D NumericalTrait(domain=3D'strictl= y-positive', ndim=3D0)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 position =3D NumericalTrait(shape=3D(3,))<br> <br> and all the validation will then be done automatically when the user<br> sets 'radius' or 'position'.<br> <br> In addition, tuples and lists can get automatically converted to<br> arrays, and default values can be specified. You can read more about<br> the package and see examples of it in use here:<br> <br> =C2=A0 <a href=3D"https://github.com/astrofrog/numtraits" rel=3D"noreferrer= " target=3D"_blank">https://github.com/astrofrog/numtraits</a><br> <br> and it can be easily installed with<br> <br> =C2=A0 pip install numtraits<br> <br> The package supports both Python 3.3+ and Legacy Python (2.7) :)<br> <br> At this point, we would be very interested in feedback - the package<br> is still very young and we can still change the API if needed. Please<br> open issues with suggestions!<br> <br> Cheers,<br> <br> Tom and Francesco<br> _______________________________________________<br> IPython-User mailing list<br> <a href=3D"mailto:[email protected]">[email protected]</a><br> <a href=3D"https://mail.scipy.org/mailman/listinfo/ipython-user" rel=3D"nor= eferrer" target=3D"_blank">https://mail.scipy.org/mailman/listinfo/ipython-= user</a><br> </blockquote></div><br></div> --047d7bdca2f8912d4b0520e3d776-- --===============6339970520992902594== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ IPython-User mailing list [email protected] https://mail.scipy.org/mailman/listinfo/ipython-user --===============6339970520992902594==--