[augeas-devel] Re: [ANNOUNCE RFC] Native python augeas bindings

Nathaniel McCallum nathaniel at natemccallum.com
Sat May 31 02:02:10 UTC 2008


Please "reply to all" if you need my attention.  I'm not subscribed
augeas-devel.

I'd also like to mention some further clarification.  There are two
levels of API breaks here:
1. C library
2. old python bindings -> new python bindings

The first proposal is to change this:
int aug_print(const augeas *aug, FILE *out, const char *path);

to something like this:
int aug_dump(const augeas *aug, const char *path, FILE *out);

This will:
1. Enhance the consistency of the bindings with the core language
("print" is a reserved keyword in many languages)
2. Provide predictable method argument order

I also think it is helpful to provide high quality bindings that
follow the native languages conventions.  Therefore, the bindings
should follow PEP8 as much as possible.

Feel free to reject any of these proposals. :)

That's all folks!
Nathaniel

On Fri, May 30, 2008 at 9:49 PM, Jeff Schroeder <jeffschroed at gmail.com> wrote:
> Hello all,
>
> I am pleased to announce native python bindings for augeas written by
> Nathaniel McCallum:
> http://www.digitalprognosis.com/opensource/augeas.py
>
> Q: Ummmm sorry dude, python-augeas already exists. What gives?
> A: These are python bindings using ctypes that contain no platform
> specific code and attempt
> to be as "pythonic" as possible.
>
> Q: Why aren't your bindings in that cool dcvs that starts with an m
> and ends with an ercurial?
> A: Because I don't have an account on hg.et.redhat.com
>
> Q: How do you know that these work?
> A: Because Harald Hoyer was nice enough to point me at the unit tests here:
> http://hg.et.redhat.com/misc/python-augeas?cmd=manifest;manifest=83d01599cc466c7fa4571862aa545e7ff6ac1aad;path=/test/
>
> which I modified from using augeas.augeas to augeas.Augeas. The
> modified version is located here:
> http://www.digitalprognosis.com/opensource/test_augeas.py
>
> Harald also sent a patch to fix a copy and paste error.
>
> Q: Why are you doing this?
> A: Duh... world domination. Python is awesome.
>
> Now that the announcement is over, we have a few questions for the
> augeas development team.
>
> Would an API break be out of the question?
>
> Ideally the python bindings should match PEP8:
> http://www.python.org/dev/peps/pep-0008/
> This is why augeas.Augeas is more pythonic than augeas.augeas. If
> nothing much is using
> the python bindings yet we should switch this.
>
> get() in C, returning NULL is the right behavior.  The question for
> today kids: "Is NULL an error?"
> If it is an error, it should be an exception in python
>
> If Harald is ok with it, we would like for these native python
> bindings to be the "preferred" ones.
>
> "print" as a method name is horrible.  It is a reserved keyword in
> many languages. What would
> be a better name for this method?
>
> The order of the variables in the "print" method (called "write" in
> our bindings) is crack
> this is because in all functions that take a path, path is the first
> argument (except write / print).
> It should be normalized
>
> Thanks and we look forward to the comments!
>
> --
> Jeff Schroeder
>
> Don't drink and derive, alcohol and analysis don't mix.
> http://www.digitalprognosis.com
>




More information about the augeas-devel mailing list