Issue2544

classification
Title: Using happybase (depending on thriftpy) in Jython
Type: behaviour Severity: urgent
Components: Jythonc compiler, Library Versions: Jython 2.7
Milestone: Jython 2.7.0
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: sowmya.rani, stefan.richthofer
Priority: Keywords:

Created on 2017-01-24.05:08:02 by sowmya.rani, last changed 2017-01-31.00:12:49 by stefan.richthofer.

Messages
msg11036 (view) Author: sowmya (sowmya.rani) Date: 2017-01-24.05:08:01
We are using Jython To do multiple python processing, These processing was before done with c-python before so most of the third party library was used without any hassle, now i have issue supporting these library with a help of jython

EX: --
import happybase

How can jython import these types of library
msg11037 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-01-26.02:12:05
sowmya,
basically, when filing an issue it would be helpful, to post the actual error message or describe the behavior that occurred. Ideally stripped down to the root cause as far as possible.

That said, happybase depends on thriftpy, which is probably not installed for your Jython.
Looking at thriftpy in turn shows that thriftpy uses native C-extensions and/or Cython. You could probably make that work on posix-systems using JyNI (www.jyni.org). You would have to use CPython to process setup.py running with --prefix compliant to your Jython-setup. Jython is unfortunately (currently) not capable of cythonizing the sources (not even with JyNI).

However, it appears like thriftpy does not necessarily require the C-extensions. An excerpt from its setup.py:

# cython detection
try:
    from Cython.Build import cythonize
    CYTHON = True
except ImportError:
    CYTHON = False

cmdclass = {}
ext_modules = []

# pypy detection
PYPY = "__pypy__" in sys.modules
UNIX = platform.system() in ("Linux", "Darwin")

# only build ext in CPython with UNIX platform
if UNIX and not PYPY:
    # rebuild .c files if cython available
    if CYTHON:
        cythonize("thriftpy/transport/cybase.pyx")
        cythonize("thriftpy/transport/**/*.pyx")
        cythonize("thriftpy/protocol/cybin/cybin.pyx")

    ext_modules.append(Extension("thriftpy.transport.cybase",
                                 ["thriftpy/transport/cybase.c"]))
    ext_modules.append(Extension("thriftpy.transport.buffered.cybuffered",
                                 ["thriftpy/transport/buffered/cybuffered.c"]))
    ext_modules.append(Extension("thriftpy.transport.memory.cymemory",
                                 ["thriftpy/transport/memory/cymemory.c"]))
    ext_modules.append(Extension("thriftpy.transport.framed.cyframed",
                                 ["thriftpy/transport/framed/cyframed.c"]))
    ext_modules.append(Extension("thriftpy.protocol.cybin",
["thriftpy/protocol/cybin/cybin.c"]))


This way it would unfortunately fail to detect Jython. You would have to modify setup.py such that Cython-stuff is ruled out in Jython case similar to the PyPy-check.

Hope this somewhat helps...
msg11046 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-01-31.00:12:49
Changed the title to describe what module this issue is actually about. Hope you don't mind...
History
Date User Action Args
2017-01-31 00:12:49stefan.richthofersetmessages: + msg11046
title: Third party python module import in Jython -> Using happybase (depending on thriftpy) in Jython
2017-01-26 02:12:06stefan.richthofersetnosy: + stefan.richthofer
messages: + msg11037
2017-01-24 05:08:02sowmya.ranicreate