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

Importing from setup.py without adds weird dependencies #1669

Closed
1 task done
FichteFoll opened this issue Feb 4, 2023 · 5 comments · Fixed by j178/pdm#1
Closed
1 task done

Importing from setup.py without adds weird dependencies #1669

FichteFoll opened this issue Feb 4, 2023 · 5 comments · Fixed by j178/pdm#1
Labels
🐛 bug Something isn't working

Comments

@FichteFoll
Copy link

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  1. Start with a setup.py as follows:
from setuptools import setup

setup(
    name='import_test',
    description='Tools for extracting text out of pdf documents',
    platforms=['any'],
    packages=['import_test'],
    entry_points={'console_scripts': ['import_test=import_test.__main__:main'], },
)
  1. invoke pdm import setup.py

Actual behavior

In the created pyproject.toml, the following is written:

dependencies = [
    "b''",
    "b''",
    "b''",
    "b''",
    "b''",
    "b''",
    "b''",
    "b''",
]

Nothing significant on the console:

$ pdm import setup.py -v
The project's requires-python has been set to >=3.10. You can change it later if necessary.
Changes are written to pyproject.toml.

Expected behavior

dependencies is either an empty list or omitted.

Environment Information

$ pdm info && pdm info --env
PDM version:
  2.4.2
Python Interpreter:
  /home/fichte/code/import_test/.venv/bin/python (3.10)
Project Root:
  /home/fichte/code/import_test
Project Packages:
  None
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.9",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.1.3-arch1-1",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT_DYNAMIC Wed, 04 Jan 2023 16:28:15 +0000",
  "python_full_version": "3.10.9",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "linux"
}
@FichteFoll FichteFoll added the 🐛 bug Something isn't working label Feb 4, 2023
@FichteFoll
Copy link
Author

FichteFoll commented Feb 4, 2023

Selecting setuppy during pdm init and with a dependency specified as follows:

install_requires="ass>=0.5.0",

pdm generates this:

dependencies = [".", ".", "0", "0", "5", "=", ">", "a", "s", "s"]

With requirements I get the same as in the initial report, just on a single line.

@pawamoy
Copy link
Contributor

pawamoy commented Feb 4, 2023

install_requires is supposed to be a list, not a string. The result you get when passing a string instead of a list is expected: PDM iterates on it, sorts it, and you get one item for each character, sorted alphabetically.

@FichteFoll
Copy link
Author

According to the setuptools documentation, install_requires supports a string or a list of strings.

@pawamoy
Copy link
Contributor

pawamoy commented Feb 4, 2023

Ah, my bad, didn't know that! Thanks for the link 👍

@frostming
Copy link
Collaborator

There has been a problem that wrong format is used to convert the file, you can workaround this by adding --format setuppy to make it explicit.

According to the setuptools documentation, install_requires supports a string or a list of strings.

At this point we don't handle such variants, please stick to a plain array instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants