Python bindings: Fix editable install + Execute Python2.7 workflow tests (#2044)
* Python binding: - Added missing `license` field in pyproject.toml file - Fixed editable mode install and some more code cleanup in setup.py - Refreshed README.md - Replaced f-string formatter in tests with `format` method in order to be py2-compatible - Fixed typos - PEP8 fixes * GitHub Action: Install Python2.7 and run tests for re-tagged wheels on native arch runners only * Python bindings: - Use #x formatter to format hex values
This commit is contained in:
@@ -25,27 +25,21 @@ Originally written by Nguyen Anh Quynh, polished and redesigned by elicn, mainta
|
||||
Install a prebuilt wheel from PyPI:
|
||||
|
||||
```bash
|
||||
pip3 install unicorn
|
||||
python3 -m pip install unicorn
|
||||
```
|
||||
|
||||
In case you would like to develop the bindings:
|
||||
|
||||
```bash
|
||||
# Python3
|
||||
DEBUG=1 THREADS=4 pip3 install --user -e .
|
||||
DEBUG=1 THREADS=4 python3 -m pip install --user -e .
|
||||
# Workaround for Pylance
|
||||
DEBUG=1 THREADS=4 pip3 install --user -e . --config-settings editable_mode=strict
|
||||
# Python2
|
||||
DEBUG=1 THREADS=4 pip install -e .
|
||||
DEBUG=1 THREADS=4 python3 -m pip install --user -e . --config-settings editable_mode=strict
|
||||
```
|
||||
|
||||
or install it by building it by yourself:
|
||||
|
||||
```bash
|
||||
# Python3
|
||||
THREADS=4 pip3 install --user .
|
||||
# Python2, unfortunately `pip2` doesn't support in-tree build
|
||||
THREADS=4 python3 setup.py install
|
||||
THREADS=4 python3 -m pip install --user .
|
||||
```
|
||||
|
||||
Explanations for arguments:
|
||||
@@ -59,4 +53,5 @@ Note that you should setup a valid building environment according to docs/COMPIL
|
||||
|
||||
## Python2 compatibility
|
||||
|
||||
By default, Unicorn python bindings will be maintained against Python3 as it offers more powerful features which improves developing efficiency. Meanwhile, Unicorn will only keep compatible with all features Unicorn1 offers regarding Python2 because Python2 has reached end-of-life for more than 3 years as the time of writing this README. While offering all features for both Python2 & Python3 is desirable and doable, it inevitably costs too much efforts to maintain and few users really rely on this. Therefore, we assume that if users still stick to Python2, previous Unicorn1 features we offer should be enough. If you really want some new features Unicorn2 offers, please check and pull request to `unicorn/unicorn_py2``. We are happy to review and accept!
|
||||
By default, Unicorn python bindings works with Python3.7 and above, as it offers more powerful features which improves developing efficiency compared to Python2. However, Unicorn will only keep compatible with all features Unicorn1 offers regarding Python2 because it has reached end-of-life for more than 3 years at the time of writing this README. While offering all features for both Python2 & Python3 is desirable and doable, it inevitably costs too much efforts to maintain and few users really rely on this. Therefore, we assume that if users still stick to Python2, previous Unicorn1 features should be enough. If you really want some new features Unicorn2 offers, please check and pull request to `unicorn/unicorn_py2`. We are happy to review and accept!
|
||||
Even though the build of wheel packages requires Python3, it's still possible to re-tag the wheel produced from Python3 with `py2` tag and then run `python2 -m pip install <retagged-wheel-py>`. For detailed commands please refer to our workflow files.
|
||||
|
||||
Reference in New Issue
Block a user