Code Monkey home page Code Monkey logo

poetry2conda's People

Contributors

abergeron avatar dojeda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

poetry2conda's Issues

KeyError on running poetry2conda

Following is the error

sumit@Sumits-MacBook-Air backend % poetry2conda pyproject.toml environment.yaml
Traceback (most recent call last):
  File "/opt/homebrew/bin/poetry2conda", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/poetry2conda/convert.py", line 294, in main
    converted_obj = convert(args.pyproject, include_dev=args.dev, extras=args.extras)
  File "/opt/homebrew/lib/python3.9/site-packages/poetry2conda/convert.py", line 53, in convert
    dependencies, pip_dependencies = collect_dependencies(
  File "/opt/homebrew/lib/python3.9/site-packages/poetry2conda/convert.py", line 161, in collect_dependencies
    tag = constraint["tag"]
KeyError: 'tag'

I'm suspecting this dependency in my pyproject.yaml is the culprit.

pyppeteer = { git = "https://github.com/pyppeteer/pyppeteer.git", rev = "0fd15a7" }

Failing with dot-containing dependencies

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')])

Option for extra indexes with Pip

I have a project that has a dependency for a package from an alternate source (not pypi). Is there a work around to to specify a package like that for pip?

Conda only dependency

Hello!

I think this is a great tool, but I think there is one package that stops me from using it. I'm talking about rdkit.

You see, it's impossible to install it as a git dependency and the simplest way to install it is via Conda.

Can I use your tool in this case? And how 😊?)

convert poetry sources to pip --index-url

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.

Install root package

Poetry by default will install your project’s package everytime you run install unless using the option --no-root. When exporting an environment.yaml and installing it to a conda virtual environment the root project package is not installed.

Also it is not possible to "sneak" this in as an optional, editable dependency or even a git dependency since Poetry is not happy about the self-loop.

Question: Why not take the environment name from `tool.poetry.name`?

Hi,

Thanks for this tool that makes it really easy to keep my conda friends happy!

I don't really understand why I have to add an extra section to my pyproject.toml file, as in general I would personally want the environment to be named after the project, and to be warned in case I already have an environment with that name.
If I don't want it to have to same name, I could just change the environment name in the resulting environment.yml file, right?
What am I missing?

Thanks in advance for the response!

Empty file created when poetry2conda fails

When the poetry2conda command fails, the target environment.yaml file is still created with empty contents. This is an undesirable behavior due to the usage of argparse.FileType. Ideally, the file should be written only when the conversion has succeeded.

semantic_version parsing fails with non semantic version constraints

It seems obvious, but when a constraing that does not follow semantic version is used on a dependency, poetry2conda will fail. Perhaps the most simple example is:

black = "^19.10b0"

which is present in our own pyproject.toml.

I think that there are two possible solutions here:

The pragmatic one, which is to catch semantic version parsing errors, show a warning and use pin what was declared. In the case of black = "^19.10b0", conda will not understand this caret version, but we could warn the use to not use a caret (black = "19.10b0") and we could pin it to black==19.10b0.

The more complex one: since poetry does understand this caret, we should probably re-use poetry caret-handling code. This is complex because we don't want to set poetry as a dependency (it would install poetry on the virtual environment, and this is discouraged on poetry's installation guide). However, I saw that poetry has recently been reorganized on a core package, which may respond to our need.

Looking for new maintainer

To anyone interested,
It has been a while since I updated this project and I currently don't have the bandwidth / time that this project requires.
I have seen that there are plenty of contributions and contributors so please let me know here if you are interested on becoming the maintainer of this project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.