Poetry Buildpack Proposal
See original GitHub issueHi, I recently made a repository that runs on Binder and installs a python environment via Poetry, and I’m considering writing a buildpack for Poetry and doing a PR.
To me, Poetry is a much nicer way to specify environments than conda or pip requirement files, as it properly concretises and hashes the dependencies and also tracks the version of packages installed from git repositories via the commit.
The contribution documentation says that when looking at adding a new buildpack you should consider “How easy it is to use a given setup without support from repo2docker natively.”, and the answer is that it’s very easy and can be done in three or four lines.
However, given how poetry environments are completely concretised via the lock files and will not change, it would be nice to include poetry as a build pack so that the environment layer doesn’t have to be rebuilt each time. Currently running the poetry install
command in postBuild
means that all the python packages have to be installed any time the repository updates even if the dependencies have not changed.
If the PR for this buildpack could be accepted then I’ll start work on this in March.
P.S. The feature request template didn’t work for me, so I’m not sure what to include here.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:5 (1 by maintainers)
Top GitHub Comments
+1 to introducing support for poetry. My sense is that it has really taken off since this issue first opened.
@betatim alright, have some time to start looking at this now, sorry for the (long) delay!
I think the project is going to keep growing, it’s a very nice tool for locking down version dependencies in a deterministic way, it has a couple of benefits over pipenv and the development is a bit more active than pipenv as well (not that active development is the best metric of quality).
I’ve had a look through the pipenv buildpack and I see your point, using a single python provider would make sense. Personally I don’t really like using conda very much so I’d lean more towards a pure pyenv implementation, but given that conda buildpack already serves as the base class for pipenv, in this case I think it makes sense to stick with conda then.
Managing the python version via conda shouldn’t be a problem for this, poetry’s use of pyenv is only a suggestion.
Good question, didn’t think of that!
For python3 where you’d have a single environment containing the kernel and jupyter, there’s a simple solution, you can run
poetry add jupyter
before the environment installation command. This would either (1) add a version of jupyter compatible with the existing environment or (2) say that jupyter is already available and no changes are needed.Splitting the environments definitely has its benefits, but in this case it could complicate things in some situations, especially if you use conda to manage the notebook server environment but use poetry to manage the kernel, most of the time it probably won’t matter but if the repo uses plugins/extensions a missmatch between the versions of packages in the notebook server environment and the kernel environment could cause issues.
Aha, I see your point. What kind of conflict issues were there with the Pipfile buildpack?
Just to get familiar with it I’ll start by modifying the pipfile buildpack to work with poetry, they’re similar enough that this shouldn’t take too long, I’ll try to make improvements along the way if anything obvious stands out to me.
Do you have any issues I cold look at related to the pipfile edge cases? I can think of a few but seeing some examples would be very helpful.
Yeah… in these kind of situations I think that having requests for something to be added is enough.
I found the link on the docs page here: https://repo2docker.readthedocs.io/en/latest/contributing/contributing.html?highlight=template%3Dfeature_request.md%26title#process-for-making-a-contribution