I recalled this mail (from october last year) when the question
regarding RDFLib 3.0 popped up again on the list just now.
Garu, do you have this port publicly somewhere; and have you tracked
the continued updates of rdflib trunk since?
Anyway, AFAIK, the proper way to port libraries to Python 3 is still
to make sure it works on 2.6+, and then use 2to3 to autogenerate a
Py3-compatible version (i.e. strive to never manually fix stuff in the
port, only in the 2.x-version, until the 2.x support eventually goes
away (in 5-10 years? ;D)).
I remember trying to do this on RDFLib about a year ago, and bumped
into a bunch of (sort of expected) unicode things.
.. Anyway, it would be very nice to have a 3-compatible
(autogenerated) rdflib! Of course. :)
Best regards,
Niklas
> --
> You received this message because you are subscribed to the Google Groups "rdflib-dev" group.
> To post to this group, send email to rdfli...@googlegroups.com.
> To unsubscribe from this group, send email to rdflib-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rdflib-dev?hl=en.
>
>
- Gunnar
2011/3/11 Niklas Lindström <linds...@gmail.com>:
> I believe that having rdflib terms like URIRef, Literal etc.
> sub-classing unicode gives us some interesting problems, that I doubt
> 2to3 will solve for us.
> Anyone is of course welcome to try! :)
I'm at Pycon right now, and here there is of course lots of talk about porting to Python 3.
Anyone of the rdflib core developers here ?
The consensus though is that 2to3 will only get you so far and that there is no way you can do a completely automagic porting.
As Gunnar brings up the major stumbling block is the split of strings into bytes and unicode.
--Roland
I would love to have the code - it should be small enough to send it
to gromgull <AT> gmail dot com ?
You do not mind if I upload it to google code I hope?
- Gunnar
I have committed Michele's code to https://bitbucket.org/gromgull/rdflib-python3
I did not yet have a chance to look at it (first I have to install python 3:)
- Gunnar
On 23 Mar 2011, at 10:17, Gunnar Aastrand Grimnes wrote:
> All,
>
> I have committed Michele's code to https://bitbucket.org/gromgull/rdflib-python3
>
> I did not yet have a chance to look at it (first I have to install
> python 3:)
Under Python 3.2, an hg clone and a nosetests yields:
> ======================================================================
> ERROR: testEvents (test.test_events.EventTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "{src}/rdflib-python3/test/test_events.py", line 57, in
> testEvents
> assert ('bob' in c1) == False
> File "{src}/rdflib-python3/test/test_events.py", line 34, in
> __getitem__
> return self._data[key]
> KeyError: 0
>
> ======================================================================
> FAIL: testModel (test.test_n3.TestN3Case)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "{src}/rdflib-python3/test/test_n3.py", line 148, in testModel
> self.assertEquals(i, 3)
> AssertionError: 0 != 3
>
> ======================================================================
> FAIL: test.test_n3_2.testN3Store
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "{py3}/nose-1.0.0-py3.2.egg/nose/case.py", line 188, in runTest
> self.test(*self.arg)
> File "{src}/rdflib-python3/test/test_n3_2.py", line 32, in
> testN3Store
> assert type(formulaA)==QuotedGraph and type(formulaB)==QuotedGraph
> AssertionError
>
> ======================================================================
> FAIL: testIssue78 (test.test_nt.NTTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "{src}/rdflib-python3/test/test_nt.py", line 13, in testIssue78
> self.assertTrue(r"R\u00E4ksm\u00F6rg\u00E5s" in s)
> AssertionError: False is not true
>
> ======================================================================
> FAIL: testSerialize (test.test_trix_serialize.TestTrixSerialize)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "{src}/rdflib-python3/test/test_trix_serialize.py", line 59,
> in testSerialize
> self.assertTrue(q[0:3] in tg)
> AssertionError: False is not true
>
> ----------------------------------------------------------------------
> Ran 221 tests in 4.275s
>
> FAILED (errors=1, failures=4)
Looking /very/ good, props to Michele.
- --
Cheers,
Graham
-----BEGIN PGP SIGNATURE-----
iEYEARECAAYFAk2JzsEACgkQOsmLt1NhivwZGQCdEImp05PaxP9lavSz8V69bNMc
H2MAn1XNVNJSY2oACzsa3FCsZqE6h1wWiQCVAgUBTYnOwVnrWVZ7aXD1AQKIsgP9
EiDXyER/+AnbSH8XvbTer66Lzc/SSNTsYciPiO+WMvZDxr1LrseMdK8rey55Q6uS
BErEFrznc27h2Hchl2zXvGSTIMrUNfnjsvg/T4MPNQQdu1dzaq/aBHGa3R91V9Z2
5Y2tOBmrubLPjqHSXwzdVgxCjLIxHBCygks/Tu726P4=
=JHun
-----END PGP SIGNATURE-----
This it great! Just a quick idea before I forget it. If is a solid
port (and it sounds like it by Graham's remark), consider this
scenario:
1. First off, converting rdflib at googlecode to mercurial (so
merging will be easy).
2. Create a branch there and copy over this code (e.g. py3compat).
3. Backport this entirely to work on Python 2.6, and then generate a
Py3 version with 2to3.
4. Diff and merge with master to make sure the branch is up to speed.
5. If the stuff also works on 2.5, merge this into rdflib master and
carry on from there.
This might prove less daunting than it sounds -- and if it works it'll
be a rock-solid path into the future. :)
Best regards,
Niklas
--
<http://neverspace.net/>
On Wed, Mar 23, 2011 at 11:17 AM, Gunnar Aastrand Grimnes
On Fri, Mar 18, 2011 at 4:30 AM, Garu <stawo...@gmail.com> wrote:
> I haven't worked on the library since december, but it was working
> quite good and I have even written a wrapper for CouchDB to use it as
> a triple store
> ..snip..
> Just let me know if you would like to have the code I've worked on,
> I'll be glad to send it to you.
I would be very interested in seeing this CouchDB wrapper
-- Chime
Google user fertapric also commented here :
http://code.google.com/p/rdflib/issues/detail?id=163
that he is working on a mongodb store - it would be nice to compare!
Also Garu/Michele - apologies for not answering your email back in october!
- Gunnar
On 23 Mar 2011, at 15:52, Niklas Lindström wrote:
> 3. Backport this entirely to work on Python 2.6, and then generate a
> Py3 version with 2to3.
> 4. Diff and merge with master to make sure the branch is up to speed.
> 5. If the stuff also works on 2.5, merge this into rdflib master and
> carry on from there.
>
> This might prove less daunting than it sounds
Perhaps a diff produced by lib3to2 [1] could have a contribution to
make, either to the backporting to 2.6/5 or possibly to a third
approach - a unified package that runs under both Python 2 and 3.
[1] https://bitbucket.org/amentajo/lib3to2
- --
Cheers,
Graham
-----BEGIN PGP SIGNATURE-----
iEYEARECAAYFAk2KwrEACgkQOsmLt1NhivynYwCgrho9jCU0ShFpIilSyy0cHbTN
th4AoLr+L5DW9zKReAuQVeroWzbfuYJliQCVAgUBTYrCsVnrWVZ7aXD1AQIM4gQA
roalUnFj9CBvWQUvRjcUvphTBX8HANiOkpPI/rodVNETNdvMr8nsDB0gzu8V0yOt
11Iiocj7S/UJP3zxeLvreXCYwdl8S7RPfZVl0Z2IZamAoYKDk9KJ+Fbs2OhVOQKJ
ZhGLe+ctRfGu730iFqBrijz1b1Aws8/5OzcX8ta7Q0A=
=UwQH
-----END PGP SIGNATURE-----