Question about poetry and dependency resolution. I...
# contributing
l
Question about poetry and dependency resolution. I've been running
poetry add meltano
on a clean project (basically, create a directory, cd into it,
poetry init
with no dependencies, then
poetry add meltano
). The dependency resolution took 5191 seconds (yes, 1.5 hrs!). And no, this is not on a 56k modem 😉 I went through poetry's issues, particularly https://github.com/python-poetry/poetry/issues/2094 where they say it's caused by the package not defining dependencies correctly. I'd like to understand what is going on here. As I understand it, meltano has been using poetry for dependency management since December, and I see a
poetry.lock
in the repo. So from what I understand, it's all clear here. That said, when I look at the logs, I see poetry trying pretty much every version of
boto3
under the sun, and I'm not sure why. Has anyone else hit this problem (namely, insanely slow dependency resolution)?
d
@laurent That's crazy! I just found your comment here: https://github.com/python-poetry/poetry/issues/2094#issuecomment-780790115 I haven't actually used Poetry to installed
meltano
before, only pip and pipx (see https://gitlab.com/meltano/meltano/-/merge_requests/1960), since Poetry is most useful when you have to manage tons of dependencies, while Meltano typically lives by itself in a venv and is used like an application rather than a library as part of a bigger project
I assume that
poetry install
inside the Meltano project (https://meltano.com/docs/contributor-guide.html#setting-up-your-environment) was much faster? Since that definitely uses
poetry.lock
l
good question, I haven't actually tried this, but will do and report back
but maybe it means I've been doing things the wrong way around 🙃
d
Maybe 😄 Were you trying to just install Meltano locally, or contribute to Meltano?
l
just install it for my own use. I think I just went on autopilot, added it as a dependency for my project, like I'd add pandas or things like that. Is it fundamentally wrong?
d
It's not, but since you only care about the
meltano
executable and not about being able to reference the
meltano
module from your own source code, it doesn't need to be in your project like
pandas
would
Of course you can install them both as dependencies for consistency, instead of having to remember to install Meltano through some other method, but then you may unnecessarily run into dependency conflicts between meltano, pandas, and anything else you have in your project
l
ok, I see your point. So I guess I've been trying to shoehorn it into my usual approach, but it's not ideal, as you explain. I think my main concern is reproducibility, but the process you pointed to should be ok from the perspective, might just need to pin the git commit I'm using for meltano somehow. I'll figure it out.
Also, to your question above:
poetry install
took like 2 minutes, as it's installing from the lockfile
d
I think the problem is that poetry doesn't use
poetry.lock
when you're adding
meltano
to an existing project, since it needs to check all of the dependencies against the packages already installed in the virtual environment, while
poetry install
can assume there's nothing in the virtual environment yet
l
yes, makes sense. Thanks for the quick reply!