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

pdm install breaks #1042

Closed
wmantly opened this issue Apr 15, 2022 · 5 comments
Closed

pdm install breaks #1042

wmantly opened this issue Apr 15, 2022 · 5 comments
Labels
🐛 bug Something isn't working

Comments

@wmantly
Copy link

wmantly commented Apr 15, 2022

  • [ x] 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.

05:44 PM william$ pdm install -v
Found following files from other formats that you may import:
0. /home/william/dev/quicksilver-tutorial/pyproject.toml (poetry)
1. don't do anything, I will import later.
Please select: (0, 1): 0
Traceback (most recent call last):
  File "/home/william/.local/bin/pdm", line 11, in <module>
    sys.exit(main())
  File "/home/william/.local/lib/python3.8/site-packages/pdm/core.py", line 233, in main
    return Core().main(args)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/core.py", line 168, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/core.py", line 163, in main
    f(options.project, options)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/cli/commands/install.py", line 36, in handle
    actions.ask_for_import(project)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/cli/actions.py", line 703, in ask_for_import
    do_import(project, str(filepath), key)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/cli/actions.py", line 654, in do_import
    project_data, settings = FORMATS[key].convert(project, filename, options)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/formats/poetry.py", line 202, in convert
    return converter.convert()
  File "/home/william/.local/lib/python3.8/site-packages/pdm/formats/base.py", line 59, in convert
    self._data[key] = func(self, value)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/formats/poetry.py", line 152, in dev_dependencies
    [_convert_req(key, req) for key, req in value.items()], True
  File "/home/william/.local/lib/python3.8/site-packages/pdm/formats/poetry.py", line 152, in <listcomp>
    [_convert_req(key, req) for key, req in value.items()], True
  File "/home/william/.local/lib/python3.8/site-packages/pdm/formats/poetry.py", line 90, in _convert_req
    return Requirement.from_req_dict(name, req_dict).as_line()
  File "/home/william/.local/lib/python3.8/site-packages/pdm/models/requirements.py", line 197, in from_req_dict
    return NamedRequirement.create(name=name, **req_dict)
  File "/home/william/.local/lib/python3.8/site-packages/pdm/models/requirements.py", line 160, in create
    return cls(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'optional'

Steps to reproduce

pdm install

Actual behavior

install breaks

Expected behavior

install works? I have never used this before.

Environment Information

PDM version 1.14.0 Python version 3.8 ubuntu 20.04

# Paste the output of `pdm info && pdm info --env` below:

05:54 PM william$ pdm info
[ProjectError]: The pyproject.toml has not been initialized yet. You can do this by running 'pdm init'.

05:54 PM william$  pdm info --env
[ProjectError]: The pyproject.toml has not been initialized yet. You can do this by running 'pdm init'.
@wmantly wmantly added the 🐛 bug Something isn't working label Apr 15, 2022
@pawamoy
Copy link
Contributor

pawamoy commented Apr 15, 2022

Can you provide the contents of your /home/william/dev/quicksilver-tutorial/pyproject.toml file?

@wmantly
Copy link
Author

wmantly commented Apr 15, 2022

@pawamoy not really, that's an internal project and I would be in trouble. I'm not even sure if I can make this issue TBH. Is there something you are looking for?

@wmantly
Copy link
Author

wmantly commented Apr 15, 2022

Here is the best i can do

...
[tool.poetry.dev-dependencies]
...
isort = {extras = ["pyproject"], version = "*", optional = true}

grep states that the only place 'optional' is in the file

@frostming
Copy link
Collaborator

frostming commented Apr 16, 2022

It is a bug of the Poetry converter, you can anyway comment out that line and add it to dev-dependencies later.

BTW, what is the semantic of optional dependencies when they are not picked up by any extras? I can't find any explanation in Poetry's doc.

@charbonnierg
Copy link

It is a bug of the Poetry converter, you can anyway comment out that line and add it to dev-dependencies later.

BTW, what is the semantic of optional dependencies when they are not picked up by any extras? I can't find any explanation in Poetry's doc.

It seems that optional dependencies are not optional unless used as extra (using poetry==1.2.0b1). You can check this README to see a reproducible example

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

No branches or pull requests

4 participants