You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by David Brown <da...@gmail.com> on 2016/09/06 16:14:08 UTC

[DISCUSS] gremlin-python support Python 2/3 (client)

I was reading through the gremlin-python code, and things are looking
good. Currently, it only works with Python 2, but I think that we need
to consider striving for Python 2/3 compatibility in future releases.
It is great to maintain support for Python 2--there is a LOT of Python
2 code in production, and we don't want to limit the user base.
However, as "Python 3.x is the present and future of the language"[1],
it seems to me that we should shoot for Python 3 compatibility as
well.

In general, using a subset of Python that runs on 2.6+ and 3.3+ is
fairly simple. In the current code base, the "major" change would be
using a 2/3 compatible version of `long`. This is necessary because
Python 3 unifies the integer types `int` and `long` (available in
Python 2) into one type `int` [2]. In making this change, we would
have to consider how to serialize Python 3 integers to GraphSON,
probably using `@type` `int64` by default.

The other question here would be building and testing. It seems to me
that we would want to run the tests against both Python versions,
however, it would be nice if the tests would pass even if someone
doesn't have 3 (or 2) installed on their machine.

Thoughts?

1. https://wiki.python.org/moin/Python2orPython3
2. http://python3porting.com/differences.html#long

-- 
David M. Brown
R.A. CulturePlex Lab, Western University

Re: [DISCUSS] gremlin-python support Python 2/3 (client)

Posted by David Brown <da...@gmail.com>.
Unless anyone has any more input on this in the next day or so, I will
assume a lazy consensus and proceed by opening a Jira/PR...

On Thu, Sep 8, 2016 at 12:14 PM, Leifur Halldor Asgeirsson
<LA...@zerofail.com> wrote:
> About serializing python 3 integers to GraphSON, I would suggest that they be serialized the same way as python 2 longs, since they are roughly equivalent.
>
> ________________________________________
> From: Stephen Mallette <sp...@gmail.com>
> Sent: September 6, 2016 12:26 PM
> To: dev@tinkerpop.apache.org
> Subject: Re: [DISCUSS] gremlin-python support Python 2/3 (client)
>
> I agree with having 2/3 compatibility. One reason we don't want to dump
> Python 2  is that we want to maintain our server side support in the
> ScriptEngine with Jython (which is still stuck supporting 2.x) so that we
> can support python lambdas in traversals.
>
> On Tue, Sep 6, 2016 at 12:14 PM, David Brown <da...@gmail.com> wrote:
>
>> I was reading through the gremlin-python code, and things are looking
>> good. Currently, it only works with Python 2, but I think that we need
>> to consider striving for Python 2/3 compatibility in future releases.
>> It is great to maintain support for Python 2--there is a LOT of Python
>> 2 code in production, and we don't want to limit the user base.
>> However, as "Python 3.x is the present and future of the language"[1],
>> it seems to me that we should shoot for Python 3 compatibility as
>> well.
>>
>> In general, using a subset of Python that runs on 2.6+ and 3.3+ is
>> fairly simple. In the current code base, the "major" change would be
>> using a 2/3 compatible version of `long`. This is necessary because
>> Python 3 unifies the integer types `int` and `long` (available in
>> Python 2) into one type `int` [2]. In making this change, we would
>> have to consider how to serialize Python 3 integers to GraphSON,
>> probably using `@type` `int64` by default.
>>
>> The other question here would be building and testing. It seems to me
>> that we would want to run the tests against both Python versions,
>> however, it would be nice if the tests would pass even if someone
>> doesn't have 3 (or 2) installed on their machine.
>>
>> Thoughts?
>>
>> 1. https://wiki.python.org/moin/Python2orPython3
>> 2. http://python3porting.com/differences.html#long
>>
>> --
>> David M. Brown
>> R.A. CulturePlex Lab, Western University
>>



-- 
David M. Brown
R.A. CulturePlex Lab, Western University

Re: [DISCUSS] gremlin-python support Python 2/3 (client)

Posted by Leifur Halldor Asgeirsson <LA...@zerofail.com>.
About serializing python 3 integers to GraphSON, I would suggest that they be serialized the same way as python 2 longs, since they are roughly equivalent.

________________________________________
From: Stephen Mallette <sp...@gmail.com>
Sent: September 6, 2016 12:26 PM
To: dev@tinkerpop.apache.org
Subject: Re: [DISCUSS] gremlin-python support Python 2/3 (client)

I agree with having 2/3 compatibility. One reason we don't want to dump
Python 2  is that we want to maintain our server side support in the
ScriptEngine with Jython (which is still stuck supporting 2.x) so that we
can support python lambdas in traversals.

On Tue, Sep 6, 2016 at 12:14 PM, David Brown <da...@gmail.com> wrote:

> I was reading through the gremlin-python code, and things are looking
> good. Currently, it only works with Python 2, but I think that we need
> to consider striving for Python 2/3 compatibility in future releases.
> It is great to maintain support for Python 2--there is a LOT of Python
> 2 code in production, and we don't want to limit the user base.
> However, as "Python 3.x is the present and future of the language"[1],
> it seems to me that we should shoot for Python 3 compatibility as
> well.
>
> In general, using a subset of Python that runs on 2.6+ and 3.3+ is
> fairly simple. In the current code base, the "major" change would be
> using a 2/3 compatible version of `long`. This is necessary because
> Python 3 unifies the integer types `int` and `long` (available in
> Python 2) into one type `int` [2]. In making this change, we would
> have to consider how to serialize Python 3 integers to GraphSON,
> probably using `@type` `int64` by default.
>
> The other question here would be building and testing. It seems to me
> that we would want to run the tests against both Python versions,
> however, it would be nice if the tests would pass even if someone
> doesn't have 3 (or 2) installed on their machine.
>
> Thoughts?
>
> 1. https://wiki.python.org/moin/Python2orPython3
> 2. http://python3porting.com/differences.html#long
>
> --
> David M. Brown
> R.A. CulturePlex Lab, Western University
>

Re: [DISCUSS] gremlin-python support Python 2/3 (client)

Posted by Stephen Mallette <sp...@gmail.com>.
I agree with having 2/3 compatibility. One reason we don't want to dump
Python 2  is that we want to maintain our server side support in the
ScriptEngine with Jython (which is still stuck supporting 2.x) so that we
can support python lambdas in traversals.

On Tue, Sep 6, 2016 at 12:14 PM, David Brown <da...@gmail.com> wrote:

> I was reading through the gremlin-python code, and things are looking
> good. Currently, it only works with Python 2, but I think that we need
> to consider striving for Python 2/3 compatibility in future releases.
> It is great to maintain support for Python 2--there is a LOT of Python
> 2 code in production, and we don't want to limit the user base.
> However, as "Python 3.x is the present and future of the language"[1],
> it seems to me that we should shoot for Python 3 compatibility as
> well.
>
> In general, using a subset of Python that runs on 2.6+ and 3.3+ is
> fairly simple. In the current code base, the "major" change would be
> using a 2/3 compatible version of `long`. This is necessary because
> Python 3 unifies the integer types `int` and `long` (available in
> Python 2) into one type `int` [2]. In making this change, we would
> have to consider how to serialize Python 3 integers to GraphSON,
> probably using `@type` `int64` by default.
>
> The other question here would be building and testing. It seems to me
> that we would want to run the tests against both Python versions,
> however, it would be nice if the tests would pass even if someone
> doesn't have 3 (or 2) installed on their machine.
>
> Thoughts?
>
> 1. https://wiki.python.org/moin/Python2orPython3
> 2. http://python3porting.com/differences.html#long
>
> --
> David M. Brown
> R.A. CulturePlex Lab, Western University
>