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

requirementslib will fail with AttributeError: 'JoinedStr' object has no attribute 's' when there is f-string in install_requires #328

Open
alexanderdevm opened this issue Jul 9, 2022 · 0 comments

Comments

@alexanderdevm
Copy link

requirementslib will fail with AttributeError: 'JoinedStr' object has no attribute 's' when there is f-string or string contact in install_requires within setup.py.

Example of code: https://github.com/alexanderdevm/test-lib-1/blob/main/setup.py

error:

pipenv install --verbose
Installing dependencies from Pipfile.lock (19667c)...
/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py:226: PipDeprecationWarning: DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
 pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
  issue=7555
Traceback (most recent call last):
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/cli/command.py", line 215, in install
    site_packages=state.site_packages
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/core.py", line 2008, in do_install
    keep_outdated=keep_outdated
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/core.py", line 1269, in do_init
    pypi_mirror=pypi_mirror,
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/core.py", line 824, in do_install_dependencies
    project, normal_deps, procs, failed_deps_queue, requirements_dir, **install_kwargs
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/core.py", line 688, in batch_install
    dep for dep in deps_to_install if not project.environment.is_satisfied(dep)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/core.py", line 688, in <listcomp>
    dep for dep in deps_to_install if not project.environment.is_satisfied(dep)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/environment.py", line 776, in is_satisfied
    vcs_type == req.vcs and commit_id == req.commit_hash
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/cached_property.py", line 36, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2491, in commit_hash
    with self.req.locked_vcs_repo() as repo:
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2223, in locked_vcs_repo
    self._parsed_line.vcsrepo = vcsrepo
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 907, in vcsrepo
    kwargs=wheel_kwargs,
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1598, in create
    created.get_initial_info()
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1431, in get_initial_info
    parsed.update(self.parse_setup_py())
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1162, in parse_setup_py
    parsed = ast_parse_setup_py(self.setup_py.as_posix())
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 880, in ast_parse_setup_py
    return SetupReader.read_setup_py(Path(path), raising)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 205, in read_setup_py
    "install_requires": caller(cls._find_install_requires, setup_call, body),
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 197, in caller
    return func(*args, **kwargs)
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 360, in _find_install_requires
    return [el.s for el in value.elts]
  File "/home/SYS/comp1/.pyenv/versions/3.7.13/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 360, in <listcomp>
    return [el.s for el in value.elts]
AttributeError: 'JoinedStr' object has no attribute 's'

Steps to reproduce:

git clone https://github.com/alexanderdevm/pipenv-bug-repro.git
cd pipenv-bug-repro
pipenv install 

Pipenv ticket ref: pypa/pipenv#5167

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