Currently using the latest version of poetry on python 3.7.0.
Using poetry when developing on a local machine with cpu and then building a Docker to launch the code on a GPU machine is painful with some module and current poetry segmentation of dev and core dependencies. A bit like the command poetry install --no-dev it would be very useful if we could define X set of dependencies ex: poetry install --dependencies test. The dependencies argument by default could be the current poetry behaviour and then we could had what ever subset of dependencies in the pyproject.toml, ex:
[tool.poetry.dependencies]
python = "^3.6"
kfp = "^0.1.31"
tensorflow_gpu = "^2.0.0"
[tool.poetry.dev-dependencies]
matplotlib = "^3.1"
[tool.poetry.test-dependencies]
python = "^3.6"
kfp = "^0.1.31"
tensorflow = "^2.0.0"
If multi dependencies is not possible another solution could be enable installation of strictly the dev dependencies ex: poetry install --no-prd
Thank you.
Isn't it possible to achieve something similar with optional dependencies and extras?
Extra would still be install when poetry install is called no ? So there no way to install either only dev dependencies .
You specify which extras get installed as per the documentation, and you can make as many extra categories as you want.
And what's the behaviour of those extras ?
I'm no expert as I started using poetry only a few days ago, but they are optional sets of packages that you can opt-in to install. So for your use-case, you'd make something like:
[tool.poetry.dependencies]
python = "^3.6"
tensorflow = {version="^2.0.0", optional=true}
tensorflow-gpu = {version="^2.0.0", optional=true}
[tool.poetry.dev-dependencies]
matplotlib = "^3.1"
[tool.poetry.extras]
cpu = ["tensorflow"]
gpu = ["tensorflow-gpu"]
In your dev environment you'd do poetry install --extras "cpu", and in your Dockerfile you'd do poetry install --no-dev --extras "gpu"
Ok sorry I did a mistake previously, seems like this solves it ! Thanks. closing the issue.
Most helpful comment
I'm no expert as I started using poetry only a few days ago, but they are optional sets of packages that you can opt-in to install. So for your use-case, you'd make something like:
In your dev environment you'd do
poetry install --extras "cpu", and in your Dockerfile you'd dopoetry install --no-dev --extras "gpu"