fixstars / ion-kit

Modernized graph-based data processing framework
MIT License
7 stars 6 forks source link

Publish Python binding #195

Closed Fixstars-iizuka closed 9 months ago

Fixstars-iizuka commented 10 months ago
xinyuli1204 commented 10 months ago

https://pypi.org/project/ion-kit-python/

xinyuli1204 commented 9 months ago

pip install <name of the module> May I ask is it means pip install ionpy? since pip search the package index to install. And ionpy as a package name has already been taken. Also ion-python has the exact same name with https://github.com/amazon-ion/ion-python

iitaku commented 9 months ago

How about pip install ion-kit?

xinyuli1204 commented 9 months ago

How about pip install ion-kit?

So ion-kit is the package name and ionpy as the module name?

iitaku commented 9 months ago

Probably we can use ion as module name and ion-kit as package name.

iitaku commented 9 months ago

Is it possible to include a prebuilt ion-kit binary package in the package which is installed through pip?

xinyuli1204 commented 9 months ago

ion

you mean include libxxx.so, for example? I will check

xinyuli1204 commented 9 months ago

Naming Convention

  1. Package: ion-python Module: ionpy
  2. Package: ion-kit Module: ion
  3. Package: ion-python Module: ion

    Include binary

    Screenshot 2024-01-18 at 10 09 07 AM

[tool.setuptools.package-data]
ionpy = ["module/macos/*", "module/linux/*", "module/windows/*"]
xinyuli1204 commented 9 months ago
  1. reduce size
  2. include ion-bb
xinyuli1204 commented 9 months ago

https://github.com/fixstars/ion-kit/pull/211

Screenshot 2024-01-18 at 1 06 19 PM
xinyuli1204 commented 9 months ago
  1. include ion-bb

ion_bb = ctypes.cdll.LoadLibrary(ion_bb_module)

xinyuli1204 commented 9 months ago

If Include all the prebuilt binary

WARNING  Error during upload. Retry with the --verbose option for more details. 
ERROR    HTTPError: 400 Bad Request from https://test.pypi.org/legacy/          
         File too large. Limit for project 'ionpy' is 100 MB. See               
         https://test.pypi.org/help/#file-size-limit for more information.     
iitaku commented 9 months ago

@xinyuli1204 Can we create platform-specific wheels? https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/

Hopefully, PyPI allows us to upload .whl packages up to 100 MB for each.

xinyuli1204 commented 9 months ago

FYI, A simple line in CmakeFile seems to be fine. Tested both on linux and mac I will push the code later and also test on TestPYPI first.

if(APPLE)
    set(CMAKE_INSTALL_RPATH "@loader_path")
elseif(UNIX)
    set(CMAKE_INSTALL_RPATH "$ORIGIN")
endif()

check binary

$ readelf -d libion-core.so
Dynamic section at offset 0x106688 contains 30 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libHalide.so.16]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000e (SONAME)             Library soname: [libion-core.so]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
(base) xinyuli@xinyus-air lib %  otool -l  libion-core.dylib  | grep RPATH -A2

          cmd LC_RPATH
      cmdsize 32
         path @loader_path (offset 12)
(venv) (base) xinyuli@xinyus-air dist % python -c "import ionpy"  
(venv) (base) xinyuli@xinyus-air dist % 
(base) xinyu.li@spica:~/ion-kit/python/dist$ python -c "import ionpy"  
(base) xinyu.li@spica:~/ion-kit/python/dist$ 
xinyuli1204 commented 9 months ago

mv Publish Python binding to CICD for Python module release

Fixstars-iizuka commented 9 months ago

236