-vvv option).I want to configure an dependency that is only applied when specific Python versions are used.
The documentation shows an example that matches my case: pathlib2 = { version = "^2.2", python = ["~2.7", "^3.2"] }
I added this to my project config.
Whenever I now try to run poetry install, poetry update or poetry check I am greeted with the following message:
[AttributeError]
'Array' object has no attribute 'strip'
No further action is done as poetry appears to break in this case.
[AttributeError]
'Array' object has no attribute 'strip'
Exception trace:
/home/wenselowski/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/home/wenselowski/.poetry/lib/poetry/console/application.py in do_run() at line 88
return super(Application, self).do_run(i, o)
/home/wenselowski/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/home/wenselowski/.poetry/lib/poetry/console/commands/command.py in run() at line 77
return super(BaseCommand, self).run(i, o)
/home/wenselowski/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/home/wenselowski/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/command.py in execute() at line 107
return self.handle()
/home/wenselowski/.poetry/lib/poetry/console/commands/check.py in handle() at line 13
check_result = self.poetry.check(self.poetry.local_config, strict=True)
/home/wenselowski/.poetry/lib/poetry/console/commands/command.py in poetry() at line 62
return self.get_application().poetry
/home/wenselowski/.poetry/lib/poetry/console/application.py in poetry() at line 60
self._poetry = Poetry.create(os.getcwd())
/home/wenselowski/.poetry/lib/poetry/poetry.py in create() at line 148
package.add_dependency(name, constraint)
/home/wenselowski/.poetry/lib/poetry/packages/package.py in add_dependency() at line 304
dependency.python_versions = python_versions
/home/wenselowski/.poetry/lib/poetry/packages/dependency.py in python_versions() at line 89
self._python_constraint = parse_constraint(value)
/home/wenselowski/.poetry/lib/poetry/semver/__init__.py in parse_constraint() at line 19
or_constraints = re.split(r"\s*\|\|?\s*", constraints.strip())
check
No error is shown when configuring it as multiple requirements but no further testing was done if this actually would resolve correctly.
pathlib2 = [
{ version = "^2.2", python = "~2.7" },
{ version = "^2.2", python = "^3.2" }
]
I think pathlib2 = { version = "^2.2", python = "~2.7 || ^3.2" } sould work.
I'm experiencing the same behavior. Is this a temporary or permanent solution?
Just ran into this one, I think this should either be fixed or the docs should be fixed as one of the examples is:
[tool.poetry.dependencies]
pathlib2 = { version = "^2.2", python = ["~2.7", "^3.2"] }
which leads to this issue.
I can confirm this issue still exists
@webartifex does using the double pipe fix your issue?
Hi @stephsamson , I was in your tutorial at Pycon.de :)
Regarding the fix, I chose not to support an older Python version in my project so I have no need for the double pipe any more. However, it is good that you put it in the docs. It was definitely missing there.
Thanks for your time.
Most helpful comment
Hi @stephsamson , I was in your tutorial at Pycon.de :)
Regarding the fix, I chose not to support an older Python version in my project so I have no need for the double pipe any more. However, it is good that you put it in the docs. It was definitely missing there.
Thanks for your time.