Storage Performance Development Kit (SPDK)
 help / color / mirror / Atom feed
* [SPDK] spdk 19.1 RPCs using python 3
@ 2019-02-06 13:11 Shahar Salzman
  0 siblings, 0 replies; 3+ messages in thread
From: Shahar Salzman @ 2019-02-06 13:11 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

Hi,

As spdk 19.1 RPC have moved to python 3, I am faced with a problem, as some of our production code runs on python 2.6.
I was able to successfully port the spdk RPCs to python 2.6 by using the print_function from __future__.

I prefer to use the spdk rpc "as is", and not have to modify the code every time I integrate it into my environment, but understand that python 2.6 is EOL, so moving to python 3 is expected.

Would it be possible to keep a python 2.6 RPC which imports the new RPCs and uses print_function, e.g.

#!/usr/bin/python
from __future__ import print_function
from rpc_implementation import *

And have a python 3 version be something like this:
#!/usr/bin/env python3
from rpc_implementation import *

In this way python 2.6 support can be maintained without duplicating any of the code.

WDYT?
I would be glad to wirte and test this code if you approve.

Shahar

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [SPDK] spdk 19.1 RPCs using python 3
@ 2019-02-06 20:00 Harris, James R
  0 siblings, 0 replies; 3+ messages in thread
From: Harris, James R @ 2019-02-06 20:00 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]

Hi Shahar,

I would be hesitant to merge something like this.  It indicates that SPDK is supporting Python 2.x which is not the case.  All SPDK testing is done using Python 3, so even though the proposal may work today, there's no guarantee it would work in the future.

Regards,

-Jim

 
On 2/6/19, 6:11 AM, "SPDK on behalf of Shahar Salzman" <spdk-bounces(a)lists.01.org on behalf of shahar.salzman(a)kaminario.com> wrote:

    Hi,
    
    As spdk 19.1 RPC have moved to python 3, I am faced with a problem, as some of our production code runs on python 2.6.
    I was able to successfully port the spdk RPCs to python 2.6 by using the print_function from __future__.
    
    I prefer to use the spdk rpc "as is", and not have to modify the code every time I integrate it into my environment, but understand that python 2.6 is EOL, so moving to python 3 is expected.
    
    Would it be possible to keep a python 2.6 RPC which imports the new RPCs and uses print_function, e.g.
    
    #!/usr/bin/python
    from __future__ import print_function
    from rpc_implementation import *
    
    And have a python 3 version be something like this:
    #!/usr/bin/env python3
    from rpc_implementation import *
    
    In this way python 2.6 support can be maintained without duplicating any of the code.
    
    WDYT?
    I would be glad to wirte and test this code if you approve.
    
    Shahar
    _______________________________________________
    SPDK mailing list
    SPDK(a)lists.01.org
    https://lists.01.org/mailman/listinfo/spdk
    


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [SPDK] spdk 19.1 RPCs using python 3
@ 2019-02-11 23:42 Walker, Benjamin
  0 siblings, 0 replies; 3+ messages in thread
From: Walker, Benjamin @ 2019-02-11 23:42 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 2128 bytes --]

On Wed, 2019-02-06 at 13:11 +0000, Shahar Salzman wrote:
> Hi,
> 
> As spdk 19.1 RPC have moved to python 3, I am faced with a problem, as some of
> our production code runs on python 2.6.
> I was able to successfully port the spdk RPCs to python 2.6 by using the
> print_function from __future__.
> 
> I prefer to use the spdk rpc "as is", and not have to modify the code every
> time I integrate it into my environment, but understand that python 2.6 is
> EOL, so moving to python 3 is expected.
> 
> Would it be possible to keep a python 2.6 RPC which imports the new RPCs and
> uses print_function, e.g.
> 
> #!/usr/bin/python
> from __future__ import print_function
> from rpc_implementation import *
> 
> And have a python 3 version be something like this:
> #!/usr/bin/env python3
> from rpc_implementation import *
> 
> In this way python 2.6 support can be maintained without duplicating any of
> the code.
> 
> WDYT?
> I would be glad to wirte and test this code if you approve.

I spent a bit of time getting to the bottom of this. Is the problem that on
Python 2.6, this Python code doesn't work?

>> print("test")

Because that works for me on Python 2.7 and Python 3. This print_function seems
to only be necessary for the more advanced usages of print() in Python 3, which
rpc.py is not using.

Also, you mention Python 2.6, but Python 2.6 is officially end of life as of
October 29, 2013 and has been replaced by Python 2.7. Since the Python
foundation dropped support for 2.6 more than five years ago, we can't support it
in SPDK.

For Python 2.7, that's officially supported until the end of this year. I think
SPDK will take the official stance that Python 2.7 will be supported in SPDK
until then, at which point we'll migrate fully to Python 3. If you notice any
compatibility issues with Python 2.7 in SPDK scripts, go ahead and file a bug
and we'll get them fixed for releases occurring in 2019.


> 
> Shahar
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://lists.01.org/mailman/listinfo/spdk


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-11 23:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-11 23:42 [SPDK] spdk 19.1 RPCs using python 3 Walker, Benjamin
  -- strict thread matches above, loose matches on Subject: below --
2019-02-06 20:00 Harris, James R
2019-02-06 13:11 Shahar Salzman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox