Is there a PyPI release likely?
jace opened this issue · 8 comments
It'll be nice to be able to do pip install stpyv8
.
Totally agree with you. But that's really complicated for multiple reasons. The first is that we need to compile Google V8 to generate the binary wheel. And this step is platform dependant. Moreover STPyV8 itself makes use of libboost and this further complicates thinking about a single workflow for that. But be aware there's something we already provide to ease the pain.
The easiest way to install STPyV8 is to use one of the Python wheels provided at https://github.com/cloudflare/stpyv8/releases. The wheels are automatically generated using Github Actions and multiple platforms and Python versions are already supported, with others planned for the future.
Each release zip file contains the ICU data file icudtl.dat and the wheel itself. First of all you should copy icudtl.data to the STPyV8 ICU data folder (Linux: /usr/share/stpyv8, MacOS: /Library/Application Support/STPyV8/) and then install/upgrade STPyV8 using pip.
So installing on MacOS is just a matter of executing the following steps
$ unzip stpyv8-macos-10.15-python-3.9.zip
Archive: stpyv8-macos-10.15-python-3.9.zip
inflating: stpyv8-macos-10.15-3.9/icudtl.dat
inflating: stpyv8-macos-10.15-3.9/stpyv8-9.9.115.8-cp39-cp39-macosx_10_15_x86_64.whl
$ cd stpyv8-macos-10.15-3.9
$ sudo mv icudtl.dat /Library/Application\ Support/STPyV8
$ sudo pip install --upgrade stpyv8-9.9.115.8-cp39-cp39-macosx_10_15_x86_64.whl
Processing ./stpyv8-9.9.115.8-cp39-cp39-macosx_10_15_x86_64.whl
Installing collected packages: stpyv8
Successfully installed stpyv8-9.9.115.8
Unfortunately if no wheels are provided for your platform and Python version you are required to build STPyV8.
I'm looking for a way to put this in a setup script or Makefile for my repo so that I can get my builds into CI.
My use case is integration tests for a Flask app — they'll run much faster and more reliably if I can use test_client.get(path)
and put it in a JS context with STPyV8 and make the assertions, instead of calling out to a webdriver.
Maybe I'll try and see if it's reliable enough to submit here.
IMHO this is something you can easily automate using the Python wheels. FYI I am the lead maintainer of Thug [1] which makes use of STPyV8. I suggest taking a look at how I perform tests. Maybe it could help you figure out a way to do that.
That is most useful, thanks! I had looked there previously and didn't see it in setup.py
, but didn't think to look in tox.ini
. I'll use that.
Have you heard of https://github.com/pypa/cibuildwheel? Would that not be of use for building wheels on lots of different platforms/versions?
@Gobot1234 unfortunately it's not so straightforward because of the boost dependency. The last time I took a look at it I realized that the image used to build a manylinux image was very old and the build used to fail. But I was taking a look at the manylinux_2_28 image right now and it seems very promising...
FYI #81 (comment)
It seems like a PyPI release is very close to happen. I performed a PyPI release of STPyV8 v12.0.267.15 just for testing and tested the generated artifacts on Linux (Ubuntu 20.04, Ubuntu 22.04, Debian 11 and Gentoo) and OSX 13. And everything works as expected. I have deleted the PyPI release because I ended up uploading some wrong artifacts during the code cleanup but, starting from the next STPyV8 release (this should happen on Jan. 23th according to Google V8 release schedule), we'll start enjoying PyPI releases. I will keep this issue open until that date just for tracking purposes.
UPDATE: A few minutes after I posted this comment V8 v12.0.267.16 was released. I thought it was perfect timing for a PyPI release and so I did [1]. Enjoy!