heroku-buildpack-python
heroku-buildpack-python copied to clipboard
Support the PDM package manager
I have a project in python with pipenv it recently can do anything less resolve dependencies, I want to change it with PDM but does not exists material says whats package manager is supported ( https://devcenter.heroku.com/articles/buildpacks ) this can mean or not is supported or does not exists docs about it, I think this package manager is a good choise for the new projects
@jefer94 You might want to have a look at this https://github.com/tuergeist/heroku-pdm-skeleton - I put my pdm heroku example together as minimal project using fastapi.
That look good
You might want to have a look at this https://github.com/tuergeist/heroku-pdm-skeleton - I put my pdm heroku example together as minimal project using fastapi.
@tuergeist Hi! Taking a look at that repo I see it's running PDM install in the Procfile. This is very very much not a good idea, since:
- It delays app boot, causing more downtime on deploys and restarts
- It means for every dyno you have, each one is doing duplicate work (and potentially installing inconsistent versions; think race conditions with releases meaning different dynos running different versions of a package)
- If the install process fails for whatever reason (eg transient network issue), then the dyno will silently crash at runtime (rather than failing at build time more loudly, when a human can retrigger it)
The way to do this properly would be to either:
- Have a separate buildpack that runs after the Python buildpack, that does the PDM install (and just have PDM in the
requirements.txt, which gets installed by the Python buildpack ready for the second buildpack) - Just use the Python buildpack, have PDM in
requirements.txt(as above), but then run PDM install via thebin/post_compilehook. - Fork the Python buildpack and add native PDM support.
Regarding support in the Python buildpack for PDM - we'll have to see how PDM fares longer term (it's still newer and less popular than many of the other options). And even then, it would come after adding Poetry support (for which there is much more demand). Lastly, any new package manager support will be happening in the new CNB, rather than in this repo (which is for the classic buildpack, which will eventually be superseded by the CNB).
@edmorley Thanks for the comments. I'd go with option 2 (post_compile) as option 1/3 need more effort on the long run. I don't want to become a maintainer for a product I pay for. Sorry.
Just a note. A simple pdm install in post_compile does not work due to something the buildpack does later on. (not yet investigated)
Exist any example how work CNB in this cases?
Exist any example how work CNB in this cases?
@jefer94 What is CNB?