cloudflare / stpyv8

Python 3 and JavaScript interoperability. Successor To PyV8 (https://github.com/flier/pyv8)
Apache License 2.0
430 stars 39 forks source link

update setup.py #113

Closed olebedev closed 3 months ago

olebedev commented 3 months ago

Hi there 👋,

I tried to use the package and encountered issues with the published wheels.

% python_platform="x86_64-manylinux_2_28"
% requirements_os=linux
% python3.10 -m uv pip install \
    --no-deps \
    --python-version "3.10" \
    --python-platform ${python_platform} \
    --requirement "tools/build/python/third_party/requirements.${requirements_os}.txt"
...
[notice] A new release of pip is available: 24.0 -> 24.1.1
[notice] To update, run: pip install --upgrade pip
Resolved 565 packages in 187ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: stpyv8==12.6.228.19
  Caused by: Failed to build: `stpyv8==12.6.228.19`
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/home/coder/.cache/uv/.tmptZbEGo/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
  File "/home/coder/.cache/uv/.tmptZbEGo/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
    self.run_setup()
  File "/home/coder/.cache/uv/.tmptZbEGo/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/home/coder/.cache/uv/.tmptZbEGo/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
    exec(code, locals())
  File "<string>", line 10, in <module>
ModuleNotFoundError: No module named 'wheel'

I turned out that the metadata is inaccurate which led to the wheel's lookup miss. And later, for the fallback of building the package it relies on the wheel package which cannot be found during the build process due to it's not listed in the setup_requires argument.

In this PR I suggest the change that fixes both issue. Please let me know what are your thoughts. I am open for discussion around find the best approach to address the issue.

Kind regards, Oleg

buffer commented 3 months ago

PR merged. Thank you!

olebedev commented 3 months ago

Great, thank you @buffer for your swift response!

Can you guide me through the project's release process? I'm interested in understanding how to make it available on PyPI.

buffer commented 2 months ago

The release process is extremely simple and relies on Github Actions.

The YAML files in the folder .github/workflows take care of building STPyV8 every time a patch is committed and run tests once done to spot issues and regressions. This process is performed on all the supported platforms. Moreover every time a specific version of Google V8 is built on a specific platform the V8 binary is cached so that it is not built again and again thus saving time.

The release process to PyPI is fired just when I manually create a new Github release. This is done intentionally and allows me to have full control of the release process as there could be situations where I want to create a git tag but not to release STPyV8 to PyPI