Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish Python binding #195

Closed
Fixstars-iizuka opened this issue Jan 12, 2024 · 16 comments
Closed

Publish Python binding #195

Fixstars-iizuka opened this issue Jan 12, 2024 · 16 comments
Assignees
Labels
enhancement New feature or request

Comments

@Fixstars-iizuka
Copy link
Contributor

Fixstars-iizuka commented Jan 12, 2024

  • Better syntax for Builder/Node/Port (Backlog)
  • Design reference counting for c_ion objects (Backlog)
  • Publish on PyPI
    • Package Naming
    • Versioning
    • Allows users to install by pip install <name of the module>
@xinyuli1204
Copy link
Contributor

@Fixstars-momoko Fixstars-momoko changed the title Improve python binding Publish Python binding Jan 17, 2024
@xinyuli1204
Copy link
Contributor

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
Copy link
Collaborator

iitaku commented Jan 17, 2024

How about pip install ion-kit?

@xinyuli1204
Copy link
Contributor

xinyuli1204 commented Jan 17, 2024

How about pip install ion-kit?

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

@iitaku
Copy link
Collaborator

iitaku commented Jan 17, 2024

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

@iitaku
Copy link
Collaborator

iitaku commented Jan 17, 2024

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

@xinyuli1204
Copy link
Contributor

ion

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

@xinyuli1204
Copy link
Contributor

xinyuli1204 commented Jan 18, 2024

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
Copy link
Contributor

  1. reduce size
  2. include ion-bb

@xinyuli1204
Copy link
Contributor

xinyuli1204 commented Jan 19, 2024

#211

Screenshot 2024-01-18 at 1 06 19 PM

@xinyuli1204
Copy link
Contributor

  1. include ion-bb

ion_bb = ctypes.cdll.LoadLibrary(ion_bb_module)

@xinyuli1204
Copy link
Contributor

xinyuli1204 commented Jan 23, 2024

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
Copy link
Collaborator

iitaku commented Jan 24, 2024

@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
Copy link
Contributor

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
Copy link
Contributor

@Fixstars-iizuka
Copy link
Contributor Author

#236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants