dojeda / poetry2conda

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

convert poetry sources to pip --index-url #12

Open sanzoghenzo opened 3 years ago

sanzoghenzo commented 3 years ago

Hi, first of all many thanks for this project!

TL;DR: the generated pip section should include the --index-url and --extra-index-url using info from tool.poetry.source

I'm on a limbo of mixed environments and repos, but I need to switch back from a poetry-based to a conda-based build env. I already have some projects built with poetry and saved on a private devpi index; the directive to use the private repo is in pyproject.toml's tool.poetry.source:

[[tool.poetry.source]]
name = "private"
url = "https://my.private.repo/my/stable/+simple/"
default= true

I added the tool.poetry2conda.dependencies section to mark my packages with channel = "pip", and when I use poetry2conda pyproject.toml environment.yml, the yaml file contains the pip packages but no --index-url option.

Passing extra options in the environment.yml's pip section is possible from conda version 4.4.0 (see this pr).

It would be wonderful if the urls specified in the tool.poetry.source sections could be translated to a --index-url entry if default = true, or a --extra-index-url otherwhise.