dojeda / poetry2conda

Convert pyproject.toml to environment.yaml
MIT License
126 stars 21 forks source link

Failing with dot-containing dependencies #15

Closed bitphage closed 3 years ago

bitphage commented 3 years ago

Looks like dependencies with a dot aren't handled well, see below

[tool.poetry.dependencies]
python = "^3.6.1"
ruamel.yaml = "^0.16"

# dev dependencies ...
% poetry2conda --dev pyproject.toml environment.yml
Traceback (most recent call last):
  File "/home/vvk/miniconda3/envs/birdfeeder/bin/poetry2conda", line 8, in <module>
    sys.exit(main())
  File "/home/vvk/miniconda3/envs/birdfeeder/lib/python3.8/site-packages/poetry2conda/convert.py", line 295, in main
    converted_obj = convert(args.pyproject, include_dev=args.dev, extras=args.extras)
  File "/home/vvk/miniconda3/envs/birdfeeder/lib/python3.8/site-packages/poetry2conda/convert.py", line 53, in convert
    dependencies, pip_dependencies = collect_dependencies(
  File "/home/vvk/miniconda3/envs/birdfeeder/lib/python3.8/site-packages/poetry2conda/convert.py", line 167, in collect_dependencies
    raise ValueError(
ValueError: This converter only supports normal dependencies and git dependencies. No path, url, python restricted, environment markers or multiple constraints. In your case, check the "ruamel" dependency. Sorry.
(Pdb) poetry_dependencies.items()
dict_items([('python', '^3.6.1'), ('ruamel', {'yaml': '^0.16'}), ('poetry2conda', '^0.3'), ('pre-commit', '^2.2.0'), ('pytest', '^5.4'), ('pytest-cov', '^2.7'), ('pytest-mock', '^3.1.0')])
bitphage commented 3 years ago

According to toml spec, such a key should be quoted: "ruamel.yaml" = "<=0.15" So, not a bug.