heroku-buildpack-python icon indicating copy to clipboard operation
heroku-buildpack-python copied to clipboard

Support the PDM package manager

Open jefer94 opened this issue 3 years ago • 7 comments

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 avatar Jul 31 '22 04:07 jefer94

@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.

tuergeist avatar Jul 31 '22 19:07 tuergeist

That look good

jefer94 avatar Aug 04 '22 18:08 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.

@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:

  1. It delays app boot, causing more downtime on deploys and restarts
  2. 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)
  3. 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:

  1. 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)
  2. Just use the Python buildpack, have PDM in requirements.txt (as above), but then run PDM install via the bin/post_compile hook.
  3. 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 avatar Aug 04 '22 19:08 edmorley

@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.

tuergeist avatar Aug 05 '22 09:08 tuergeist

Just a note. A simple pdm install in post_compile does not work due to something the buildpack does later on. (not yet investigated)

tuergeist avatar Aug 05 '22 10:08 tuergeist

Exist any example how work CNB in this cases?

jefer94 avatar Aug 14 '22 07:08 jefer94

Exist any example how work CNB in this cases?

@jefer94 What is CNB?

tuergeist avatar Aug 24 '22 11:08 tuergeist