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

Conflicting versions for uritemplate library #299

Open
mesemus opened this issue Mar 8, 2023 · 0 comments
Open

Conflicting versions for uritemplate library #299

mesemus opened this issue Mar 8, 2023 · 0 comments

Comments

@mesemus
Copy link
Contributor

mesemus commented Mar 8, 2023

Package version (if known): 2.1.1

Describe the bug

Parts of Invenio use uritemplate library which provides python package uritemplate.
This library (and invenio-github as well) have dependency to uritemplate.py that provides the
same package - thus the one used is determined by the order in which libraries are installed (not deterministic).

For python 3.9 it seems that Invenio works with both implementations, but for python 3.10
uritemplate.py<2 is broken.

Steps to Reproduce

Install Invenio and reinstall uritemplate.py. Then run any test that uses uri template (for example service.scan):

/invenio_records_resources/services/records/results.py:199: in hits
    projection["links"] = self._links_item_tpl.expand(
....
/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/uritemplate/variable.py:278: in _string_expansion
    if dict_test(value) or tuples:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

value = 'as9k9-0nr40'

    def dict_test(value):
>       return isinstance(value, (dict, collections.MutableMapping))
E       AttributeError: module 'collections' has no attribute 'MutableMapping'

Expected behavior

If possible, only uritemplate library should be used throughout invenio.

Workaround

We currently use the following workaround:

pip install -e '.[tests]'
pip install -e 'tests/records2'
pip uninstall -y uritemplate
pip install uritemplate
export PYTHONPATH=.

pytest tests
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

No branches or pull requests

1 participant