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

Run tests on Python 3.11 as well #411

Merged
merged 4 commits into from
Nov 3, 2022
Merged

Run tests on Python 3.11 as well #411

merged 4 commits into from
Nov 3, 2022

Conversation

vlaci
Copy link
Contributor

@vlaci vlaci commented Jul 26, 2022

No description provided.

@vlaci vlaci force-pushed the test-python-3.11 branch from 342a953 to 68ef9f6 Compare July 26, 2022 14:37
@vlaci
Copy link
Contributor Author

vlaci commented Jul 27, 2022

Unfortunately LIEF doesn't get built on Python 3.11. It should work, once a new release is published from it, as they have bumped the required pybind version and also added Python 3.11 to the CI.

@qkaiser
Copy link
Contributor

qkaiser commented Nov 2, 2022

LIEF has a wheel for Python 3.11 since yesterday :) https://github.com/lief-project/LIEF/releases/tag/0.12.3

@qkaiser qkaiser force-pushed the test-python-3.11 branch 3 times, most recently from d0296b1 to 4fc3f49 Compare November 2, 2022 21:06
@qkaiser
Copy link
Contributor

qkaiser commented Nov 2, 2022

So hyperscan for Python does not support Python 3.11 and I don't think it will be ready soon given that the maintainer is looking for others to take over (see darvid/python-hyperscan#44).

The only thing breaking with Python 3.11 is the absence of libch, which corresponds to libchimera in hyperscan.

I guess we could fork the hyperscan repo to work on 3.11 support and maybe vectorscan support (for ARM) when we have enough bandwidth.

@vlaci
Copy link
Contributor Author

vlaci commented Nov 2, 2022

So hyperscan for Python does not support Python 3.11 and I don't think it will be ready soon given that the maintainer is looking for others to take over (see darvid/python-hyperscan#44).

The only thing breaking with Python 3.11 is the absence of libch, which corresponds to libchimera in hyperscan.

I guess we could fork the hyperscan repo to work on 3.11 support and maybe vectorscan support (for ARM) when we have enough bandwidth.

Chimera is a mess to compile, statically links to PCRE which has to be compiled using their own cmake wrapper without sufficient documentation on how to do it. Tried to add it to Nix as well, but ran into intel/hyperscan#359 at the end so I gave up for the time being.
It definitely should be optional to use Chimera in the python wrapper because the above mentioned difficulties.

Thought about implementing our own thin wrapper which could be generalized over hyperscan and vectorscan. We don't really use much of the API surface afterall.

@qkaiser
Copy link
Contributor

qkaiser commented Nov 3, 2022

@vlaci works if we pin hyperscan to 0.2.0. Nix has a problem with poetry now 🐍

As it is not installable from wheel on Python 3.10+
@vlaci
Copy link
Contributor Author

vlaci commented Nov 3, 2022

@vlaci works if we pin hyperscan to 0.2.0. Nix has a problem with poetry now snake

Here you are :)

@vlaci vlaci marked this pull request as ready for review November 3, 2022 09:59
@qkaiser qkaiser self-requested a review November 3, 2022 10:20
Copy link
Contributor

@qkaiser qkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at changes in python-hyperscan between 0.2.0 and 0.3.2, they're only related to packaging with latest hyperscan lib. It's actually a good move to stick to 0.2.0 for stability.

@qkaiser qkaiser merged commit 3352503 into main Nov 3, 2022
@qkaiser qkaiser deleted the test-python-3.11 branch November 3, 2022 10:22
@AkechiShiro
Copy link

AkechiShiro commented May 20, 2023

Hey I'm packaging unblob for the AUR and I can't seem to get python-hyperscan packaged, trying to get it packaged seems to be quite hard, v0.2.0 is according to this issue darvid/python-hyperscan#55 not compatible with Python 3.10 and currently on Arch we're by default on Python 3.11.

Here is the PKGBUILD script, I'm using to build python-hyperscan :

_pyname=hyperscan
pkgname=python-${_pyname}-git
pkgver=v0.4.0.r3.g056538c
pkgrel=1
pkgdesc='A CPython extension for the Hyperscan regular expression matching library.'
arch=('any')
url="https://github.com/darvid/python-$_pyname"
license=(GPL)
depends=(python hyperscan)
conflicts=()
provides=(python-hyperscan)
makedepends=(git python-setuptools python-pip python-build python-installer python-wheel poetry python-platformdirs python-poetry-plugin-export) 
checkdepends=()
source=("git+https://github.com/darvid/python-$_pyname")
sha256sums=(SKIP)

pkgver() {
  cd "python-$_pyname"
  git describe --long --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    git -C "${srcdir}/python-${_pyname}" clean -dfx
}

build() {
    cd "python-$_pyname"
    PYTHON_HYPERSCAN_STATIC=false python -m build --wheel --no-isolation
}

package() {
    cd "python-$_pyname"
    python -m installer --destdir="$pkgdir" dist/*.whl
}

I'm running into the same issue as here, mainly libch is missing, I take it that I need to try to lower python-hyperscan's version to 0.2.0 first, and then try to build and see what happens ?

See output of build :

==> Retrieving sources...
==> WARNING: Skipping all source file integrity checks.
==> Extracting sources...
  -> Creating working copy of python-hyperscan git repo...
Cloning into 'python-hyperscan'...
done.
==> Starting prepare()...
==> Starting pkgver()...
==> Starting build()...
* Getting build dependencies for wheel...
* Building wheel...
Package libch was not found in the pkg-config search path.
Perhaps you should add the directory containing `libch.pc'
Traceback (most recent call last):
Package 'libch', required by 'virtual:world', not found
  File "/build/python-hyperscan-git/src/python-hyperscan/setup.py", line 29, in <module>
    build(setup_kwargs)
  File "/build/python-hyperscan-git/src/python-hyperscan/build_hyperscan_extension.py", line 67, in build
    pkg_config_options = pkgconfig(["libhs", "libch"], static=static)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/python-hyperscan-git/src/python-hyperscan/build_hyperscan_extension.py", line 33, in pkgconfig
    subprocess.check_output(
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['pkg-config', '', '--libs-only-l', 'libhs', 'libch']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
    return _build_backend().build_wheel(wheel_directory, config_settings,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/poetry/core/masonry/api.py", line 56, in build_wheel
    return WheelBuilder.make_in(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 85, in make_in
    wb.build(target_dir=directory)
  File "/usr/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 118, in build
    self._build(zip_file)
  File "/usr/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 179, in _build
    self._run_build_command(setup)
  File "/usr/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 217, in _run_build_command
    subprocess.check_call(
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', '/build/python-hyperscan-git/src/python-hyperscan/setup.py', 'build', '-b', '/build/python-hyperscan-git/src/python-hyperscan/build']' returned non-zero exit status 1.

ERROR Backend subprocess exited when trying to invoke build_wheel
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /home/username/project/opensource/aur/unblob-git/chroot/zwei/build

@vlaci
Copy link
Contributor Author

vlaci commented May 20, 2023

You shouldn't need python-hyperscan, we are using another library, pyperscan now.

@AkechiShiro
Copy link

I'll remove this dependency all together then and package pyperscan, thanks

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

Successfully merging this pull request may close these issues.

3 participants