I am trying to install a Python package via Poetry whose version to install should be determined based on the output (~return value) of a Bash command.
Is it possible doing something (in the pyproject.toml
) along the lines of:
[tool.poetry.dependencies]
python = "^3.8"
this-package = "^$(path-to-executable --version)"
where $(path-to-executable --version)
is the bash command call that would output a version?
Ideally, without having to run a script/Makefile/"""something""" on top of Poetry (as this Git thread seems to point to)
Specifically, this is because I'm trying to install GDAL. We don't use too advanced features, so pretty much any version would do. However, the Python package to be installed depends heavily on the version of the Gdal's executable (and its libraries) that is installed in the system. Which can be determined running gdal-config --version
in a terminal. In my case (Ubuntu 18.02), that command returns 2.2.3
, but in never Ubuntu will return something higher.
So, I'm trying to make the dependency resolution in Poetry's pyproject.toml
a liiiiitle bit dynamic: Whomever is trying to install my package would still need to install libgdal-dev
and other dependencies, but I'd like it to be a tiiiiiny bit dynamic so they don't have to edit the pyproject.toml
file to fill up their version of Gdal. Also, this is for internal use, so it only needs to work in Linux-like systems (no Windows or Apple)
Thank you in advance!