Would you expect bytes or unicode (or both) for the hglib API in Python 3?

Brett Cannon bcannon at gmail.com
Tue Jan 27 22:49:45 UTC 2015


I have a need to query Mercurial repositories for some log data and I want
to do it from Python 3. I would like to use hglib but it currently doesn't
support past Python 2.7. I'm willing to try and port it so it can (somehow)
support Python 2.4 - Python 3.4, but before I do that I would like to know
two things: 1) would you accept a porting of the library to Python 3 if it
can still support Python 2.4 (although obviously my life would be easier if
Python 2.6 was the cut-off =), and 2) what kind of Python 3 API would you
want the library to have?

For 2) what I'm specifically wondering about is whether the API should be
returning bytes, Unicode strings, or should it depend on which method is
called in hglib.client.hgclient? E.g., should everything stored in an
hglib.client.revision instance be bytes or Unicode? How about other methods
like hglient.annotate()? And if it's Unicode strings should I always decode
based on what hgclient.encoding() returns or is there some other encoding I
should be using?

I currently have all tests from test-annotate to test-move passing already
by returning Unicode strings and assuming UTF-8 encoding (mostly just so I
could see how hard the port would be), but I thought I should ask my two
questions before going any farther and then contemplating tidying up the
changes and seeing if they could be made backwards-compatible and thus
upstreamed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150127/2ee1666e/attachment.html>


More information about the Mercurial-devel mailing list