[Nut-upsdev] Python and NUT (Was: Proposed discussion: standardization of Status Flags and Instant Commands for ECO mode)

Jim Klimov jimklimov at gmail.com
Sat Dec 4 15:41:58 GMT 2021


Just as a point on Python2 support: aiming to be portable, NUT has (hopes)
to build on as many systems as is not too painful to support. And some
older but still "relevant" systems were released before Py3.

PyNUT syntax (and that of build-time helper scripts) was not that
complicated for handling with Python versions between 2.7 and 3.9.

As a contrasting example, builds with C89/C90 are not a goal, hopefully
systems in use do support C99+ (and frankly there are also issues with
non-GNU strict-C in general, making it a non-goal for now; many pop up with
system headers so might be due to our sources not including "config.h"
first).

Jim


On Sat, Dec 4, 2021, 13:12 Roger Price <roger at rogerprice.org> wrote:

> On Fri, 3 Dec 2021, Jim Klimov via Nut-upsdev wrote:
>
> > Just in case, regarding the spin-off topic of Python scripting: note
> there is
> > a sort of binding in NUT sources, as used in GUI app etc.
>
> > I am not sure what practical state it is in, e.g. if it may need more
> > attention for NUT data points and concepts added in recent years,...
>
> If I remember correctly, the "binding" proposed is object oriented.
> Python is
> now de-emphasizing OO in order to attract more interest.  Does the NUT
> project
> need to support Object Orientation when NUT is essentially event oriented?
>
> > In master branch, it was recently fixed to pass self-test with both
> Python 2.x
> > and 3.x (several sub-versions).
>
> Python 2 support ended on 2020-01-01 and now has status "end-of-life".  I
> don't
> see any need to support it in NUT.
>
> > ...but I suppose fixing it in upstream (if needed) is better than
> everyone
> > reinventing their wheel ;)
>
> I wrote a Python replacement for upsmon, upssched and upssched-cmd.  It
> introduces the concept of groups of UPS's with different groups having
> different
> behaviours.  For example heartbeat dummy UPS's have their own group since
> there
> is no need to log heartbeat status changes.
>
> The biggest wheel I re-invented was the decoding of the new configuration
> file.
> I used PLY (Python Lex-Yacc) by David Beazley.  The advantage is that it
> doesn't
> require separate Lex and Yacc specificationn files, but the result is
> difficult
> to read, and if I were to do it again I would look for a real Lex and Yacc.
>
> Roger
>
> _______________________________________________
> Nut-upsdev mailing list
> Nut-upsdev at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsdev/attachments/20211204/516018e2/attachment.htm>


More information about the Nut-upsdev mailing list