Skip to content

url-dependency is missing from multiple-constraints-dependency #2033

@djlancelot

Description

@djlancelot
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: OSX 10.15.2 and Ubuntu

  • Poetry version: 1.0.2

  • Relevant part:

[tool.poetry.dependencies]
torch = [
        {url = "https://download.pytorch.org/whl/cpu/torch-1.4.0%2Bcpu-cp37-cp37m-linux_x86_64.whl", markers = "sys_platform == 'linux'"},
        {version="^1.4.0", markers = "sys_platform == 'darwin'"}
    ]

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Issue

Hi there,
When I tried adding multiple constraints using an url dependency I got the following error message:

poetry install -vvv

[RuntimeError]
The Poetry configuration is invalid:
  - [dependencies.torch] [{u'url': u'https://download.pytorch.org/whl/cpu/torch-1.4.0%2Bcpu-cp37-cp37m-linux_x86_64.whl', u'markers': u"sys_platform == 'linux'"}, {u'version': u'^1.4.0', u'markers': u"sys_platform == 'darwin'"}] is not valid under any of the given schemas


Traceback (most recent call last):
  File "/Users/lancelot/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/lancelot/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Users/lancelot/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 163, in _do_handle
    self._dispatcher.dispatch(PRE_HANDLE, event)
  File "/Users/lancelot/.poetry/lib/poetry/_vendor/py2.7/clikit/api/event/event_dispatcher.py", line 22, in dispatch
    self._do_dispatch(listeners, event_name, event)
  File "/Users/lancelot/.poetry/lib/poetry/_vendor/py2.7/clikit/api/event/event_dispatcher.py", line 89, in _do_dispatch
    listener(event, event_name, self)
  File "/Users/lancelot/.poetry/lib/poetry/console/config/application_config.py", line 85, in set_env
    poetry = command.poetry
  File "/Users/lancelot/.poetry/lib/poetry/console/commands/command.py", line 10, in poetry
    return self.application.poetry
  File "/Users/lancelot/.poetry/lib/poetry/console/application.py", line 49, in poetry
    self._poetry = Factory().create_poetry(Path.cwd())
  File "/Users/lancelot/.poetry/lib/poetry/factory.py", line 54, in create_poetry
    raise RuntimeError('The Poetry configuration is invalid:
'" + message)

The dependency doesn't seem to be valid under any of the given schemas.

Possible reason

After looking at the source code I found that the schema descriptor file is missing the url-dependency from the list of values here:

"multiple-constraints-dependency": {

Possible solution

Add the url-dependency to the list of values for multiple constraints:

        "multiple-constraints-dependency": {
            "type": "array",
            "minItems": 1,
            "items": {
                "oneOf": [
                    {
                        "$ref": "#/definitions/dependency"
                    },
                    {
                        "$ref": "#/definitions/long-dependency"
                    },
                    {
                        "$ref": "#/definitions/git-dependency"
                    },
                    {
                        "$ref": "#/definitions/file-dependency"
                    },
                    {
                        "$ref": "#/definitions/path-dependency"
                    },
                    {
                        "$ref": "#/definitions/url-dependency"
                    }
                ]
            }
        },

Let me know what you think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions