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

Python binding no longer compatible with python 3.12 and later #55

Open
hosiet opened this issue Feb 2, 2024 · 1 comment
Open

Python binding no longer compatible with python 3.12 and later #55

hosiet opened this issue Feb 2, 2024 · 1 comment

Comments

@hosiet
Copy link

hosiet commented Feb 2, 2024

The current python binding includes include imp instruction, which will raise error with Python 3.12 or later because the imp module has been removed with Python 3.12.

Downstream bug report: https://bugs.debian.org/1061809

When trying to regenerate the python binding with swig 4.2, the following warnings will appear:

-> % make swig-python          
swig -Wall -c++ -python -outdir python marisa-swig.i
marisa-swig.h:55: Warning 321: 'str' conflicts with a built-in name in python
marisa-swig.h:56: Warning 321: 'id' conflicts with a built-in name in python
marisa-swig.h:69: Warning 321: 'str' conflicts with a built-in name in python
marisa-swig.h:70: Warning 321: 'id' conflicts with a built-in name in python
mv marisa-swig_wrap.cxx python
cp marisa-swig.cxx marisa-swig.h python

Please revise the Python binding and fix the warnings accordingly. Thanks!

@juno-rmks
Copy link

Unofficially, I have created bindings that can be built with Python 3.10 and later. The source code is derived from the original, and I have set it up for package management via pip and for building with Python 3.10 and later.

https://github.com/juno-rmks/marisa-bindings

The README mentions that it can be installed from PyPI, but since this is an alpha version, it currently only supports installation from GitHub.

% pip install git+https://github.com/juno-rmks/marisa-bindings.git

I have confirmed that the native libraries can be compiled correctly on macOS (Apple Silicon) and Windows (x86_64), but I have not tested on other operating systems or architectures, including Linux. If anyone has time to try it out, I would appreciate your feedback.

If everything works well, I will upgrade to version 1.0.0 and upload it to PyPI.

The name "marisa-trie" is already in use, and using "marisa-swig" would imply reliance solely on SWIG in the future, so I chose the name "marisa-bindings."

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

No branches or pull requests

2 participants