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

TOML-based projects plus -e == exception #199

Closed
mcdonc opened this issue Dec 24, 2023 · 1 comment · Fixed by #200
Closed

TOML-based projects plus -e == exception #199

mcdonc opened this issue Dec 24, 2023 · 1 comment · Fixed by #200

Comments

@mcdonc
Copy link

mcdonc commented Dec 24, 2023

Using pip-api 0.0.30, a minor issue.

Python 3.11.6 (main, Oct  2 2023, 13:45:54) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip_api
>>> pip_api.parse_requirements("test.txt")
Traceback (most recent call last):
  File "/home/chrism/projects/apex/eao_dash/.devenv/state/venv/lib/python3.11/site-packages/pip_api/_parse_requirements.py", line 260, in _parse_local_package_name
    value = [kw.value for kw in setup_kwargs if kw.arg == "name"][0]
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/chrism/projects/apex/eao_dash/.devenv/state/venv/lib/python3.11/site-packages/pip_api/_parse_requirements.py", line 531, in parse_requirements
    name, url = _parse_editable(known.editable)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chrism/projects/apex/eao_dash/.devenv/state/venv/lib/python3.11/site-packages/pip_api/_parse_requirements.py", line 285, in _parse_editable
    return _parse_local_package_name(url_no_extras[len("file://") :]), url_no_extras
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chrism/projects/apex/eao_dash/.devenv/state/venv/lib/python3.11/site-packages/pip_api/_parse_requirements.py", line 263, in _parse_local_package_name
    raise PipError(
pip_api.exceptions.PipError: Directory '/home/chrism/projects/apex/eao_dash' is not installable. Could not parse package name from 'setup.py'.

Where test.txt is:

-r ./requirements.txt
-e ./.

That would be totally reasonable, but this project is of the new regime where the setup.py looks like:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""The setup script."""

from setuptools import setup

setup()

And it gets all its metadata from pyproject.toml:

[project]
name = "eao_dash"

It should likely fall back to trying to parse the name out of pyproject.toml.

@di
Copy link
Owner

di commented Jan 3, 2024

Thanks, this will be fixed in the next release (0.0.31) once the release finishes.

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 a pull request may close this issue.

2 participants