[Xapian-tickets] [Xapian] #346: Python 3 support
Xapian
nobody at xapian.org
Thu Jun 28 01:51:44 BST 2012
#346: Python 3 support
--------------------------------------+-------------------------------------
Reporter: olly | Owner: richard
Type: defect | Status: assigned
Priority: highest | Milestone: 1.3.2
Component: Xapian-bindings (Python) | Version: SVN trunk
Severity: normal | Keywords:
Blockedby: | Platform: All
Blocking: |
--------------------------------------+-------------------------------------
Comment(by olly):
> It sounds to me like Xapian has a clear model most of the time, with
some fuzzy areas, but this information gets lost when mapped to the C++
type, so that gets further fuzzy when mapping that single type to its
Python equivalent.
I guess Xapian's model is that strings are mostly opaque objects, and you
get out what you put in. When it needs to look at them as text, then it
assumes they are UTF-8 encoded. And serialisation functions/methods also
obviously care about the contents of the string too, but treat it as
binary data.
So simply mapping std::string to/from bytes in Python is probably the
closest to that model, but I think that wouldn't seem very comfortable to
use.
If we're changing 1.2.x to add Python 3 support, I'd rather be
conservative and minimise the risks that we break Python 2 support, so
simply splitting the two directories seems a sane approach, and avoids
needing to consider whether to raise the minimum Python 2 version
supported in the middle of a release series. It's unhelpful if we force
users to upgrade Python just to be able to upgrade to a Xapian point
release.
For 1.3.x, 2.6 seems a reasonable minimum requirement, especially as 1.4
is probably at least 6 months away. I'd prefer to solicit feedback on the
mailing list before finalising the versions of the various languages we're
aiming to support in 1.4, but I can't see this being controversial.
The context managers approach doesn't handle a case where you want to pass
one string argument as utf-8 and the other as bytes well - you might want
to do that when setting user metadata, for example key as utf-8, value as
bytes.
Using something based on 1.3.x is probably a reasonable approach for
software-centre in 12.10, provided it's made clear that the API is likely
to change, so we don't end up with lots of other packages depending on it
(or at least if we do, they have been warned). 1.3.x should be pretty
stable for a "development branch" - mostly there are no ABI compatibility
promises, and some API features are marked as experimental. Our record is
good so far - almost all bugs in the development branches have either been
in new code or also present in the previous release series. It would also
be good to see a significant piece of real software using the Python 3
API.
I'd say the first step there is to get it all working but always returning
bytes for std::string. That should give you something usable, and close
enough to the final API that updating shouldn't be painful.
--
Ticket URL: <http://trac.xapian.org/ticket/346#comment:40>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list