heroku / buildpacks-python

Heroku's Cloud Native Buildpack for Python applications.
BSD 3-Clause "New" or "Revised" License
26 stars 2 forks source link

Support the `.python-version` file #6

Closed edmorley closed 17 hours ago

edmorley commented 1 year ago

We should support the .python-version file as a means for specifying what Python version an app is using.

This file format (used by pyenv and others) now also supports specifying Python versions in the X.Y format (and not just X.Y.Z), making it a strong contender over the Heroku-specific runtime.txt file.

Officially supported syntax:

Unofficially supported syntax:

...though the python- forms are undocumented and likely going to be deprecated soon (https://github.com/pyenv/pyenv/issues/3054#issuecomment-2341316638), so I'm leaning towards not supporting them.

For more background, see:

edmorley commented 1 week ago

I found a bug in pyenv's handling of some of the more obscure syntax variants, which I filed as: https://github.com/pyenv/pyenv/issues/3054

And have opened https://github.com/pyenv/pyenv/pull/3056 to fix.

megahall commented 12 hours ago

I created a one line .python-version containing 3.12 and tested this on Heroku but it did not work for me. Is there some special procedure or ETA before this buildpack update kicks in?

remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.12.6
remote:        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
edmorley commented 11 hours ago

@megahall Hi! This repository is for the Heroku Python Cloud Native Buildpack (the next generation of buildpacks, currently in preview), rather than the existing (classic) Heroku Python buildpack, which is at: https://github.com/heroku/heroku-buildpack-python

Support for Poetry and .python-version will be backported to the classic buildpack soon, but if you wanted to try out the Python CNB in the meantime, there is more information here: https://github.com/heroku/buildpacks

edmorley commented 11 hours ago

Support for Poetry and .python-version will be backported to the classic buildpack soon

To track that, subscribe to:

merwok commented 9 hours ago

if you wanted to try out the Python CNB in the meantime, there is more information here

I was curious about this, as I’ve been following recent activity, but all the docs I found talk about running tools locally, not using the CNB on heroku.

edmorley commented 9 hours ago

all the docs I found talk about running tools locally, not using the CNB on heroku.

Yeah it's currently not possible to use CNBs on Heroku (only locally using the Pack CLI), however, that's coming soon: https://github.com/heroku/roadmap/issues/20

edmorley commented 9 hours ago

If there is a way to make this clearer in the docs, feedback welcome :-)

(This repo's README has a banner here which links to a CNB overview repo that links to the roadmap item here - but perhaps the latter needs a specific banner call-out?)