Toilal / rebulk

Define simple search patterns in bulk to perform advanced matching on any string
MIT License
55 stars 9 forks source link

Python 3.8.1 support? - "ValueError: unused keyword argument XX" caused by incompatible changes in regex 2020.1.7 #20

Closed 0xACE closed 4 years ago

0xACE commented 4 years ago

Hey, I'm running late here for an errand, so I'm posting this as a quick question/issue.

Does rebulk work with python 3.8.1? on my machines, multiple of the tests are failing.

The build script I'm using from the AUR is failing on the check() specifically the line python setup.py test is failing

pkgname=('python-rebulk' 'python2-rebulk')
_name=${pkgname#python-}
pkgver=2.0.0
pkgrel=1
pkgdesc="Define simple search patterns in bulk to perform advanced matching on any string. "
arch=("any")
url="https://github.com/Toilal/rebulk"
license=('MIT')
makedepends=('python-setuptools'
             'python2-setuptools')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('e42bc73645eaa33ee321d69d5091c0a11e47ade0b2b48ba78b8b682e327f0608bb4345e7be7e51551b672bbfd6de490bc563e12344da30be6900b5860b9047ab')

prepare() {
  cp -a "rebulk-${pkgver}"{,-py2}
}

check() {
  cd "${srcdir}/rebulk-${pkgver}"
  python setup.py test

  # Tests don't work in python2, issue Toilal/rebulk/issues/19
  #cd "${srcdir}/rebulk-${pkgver}-py2"
  #python2 setup.py test
}

package_python-rebulk() {
  depends=('python'
           'python-six'
           'python-regex')
  cd "${srcdir}/rebulk-${pkgver}"
  python setup.py install --root="${pkgdir}/" --optimize=1
}

package_python2-rebulk() {
  depends=('python2'
           'python2-six'
           'python2-regex'
           'python2-ordereddict')
  cd "${srcdir}/rebulk-${pkgver}-py2"
  python2 setup.py install --root="${pkgdir}/" --optimize=1
}
0xACE commented 4 years ago

The error I get is a 7000 lines long dump:

https://gist.github.com/0xACE/437c55eaae70385ece7a1d7304ff94dc

singron commented 4 years ago

I'm currently using this workaround:

diff --git a/rebulk/loose.py b/rebulk/loose.py
index 5e747a8..e92d594 100644
--- a/rebulk/loose.py
+++ b/rebulk/loose.py
@@ -56,7 +56,7 @@ def call(function, *args, **kwargs):
     :rtype: object
     """
     func = constructor_args if isclass(function) else function_args
-    call_args, call_kwargs = func(function, *args, **kwargs)
+    call_args, call_kwargs = func(function, *args, ignore_unused=True, **kwargs)
     return function(*call_args, **call_kwargs)

The issue is that python-regex made a breaking change to reject unused kwargs: https://bitbucket.org/mrabarnett/mrab-regex/issues/357/new-exception-valueerror-unused-keyword

fryfrog commented 4 years ago

Thanks @0xACE for pointing out the issue and @singron for the patch, I've included it in the AUR package for now and will remove when rebulk gets it sorted out. :)

phiresky commented 4 years ago

Could you rename this issue? It's affecting more downstream programs like https://github.com/pymedusa/Medusa/issues/7743 and https://github.com/Diaoul/subliminal/issues/992 and is kinda hard to find right now. This isn't related to python version but just to the update of the regex library forbidding unused keyword args.

0xACE commented 4 years ago

It has been some time since I looked at this issue. Any suggestions on what the title should be?

phiresky commented 4 years ago

maybe "ValueError: unused keyword argument XX" caused by incompatible changes in regex 2020.1.7

This is the issue that is the reason for the "regression": https://bitbucket.org/mrabarnett/mrab-regex/issues/354/raise-over-unrecognised-kwargs-to-help

mgorny commented 4 years ago

Yep, it's not specific to Python 3.8. It's broken all over the place now, and I guess this means it's going to our removal queue.

Toilal commented 4 years ago

I'll fix this issue and perform a new release, sorry for the delay but stay tuned :)

Toilal commented 4 years ago

Fixed in 2.0.1, tests are now runned with and without regex module installed in TravisCI.

Toilal commented 4 years ago

It was related to regex additional and optional python module, not the python version itself. Thanks to @singron for his fix, I think it saves me some hours of debugging :)