Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate generated project from runtime.txt to .python-version #5652

Merged

Conversation

edmorley
Copy link
Contributor

@edmorley edmorley commented Jan 22, 2025

Hi! I'm the Heroku Python owner :-)

Heroku now supports the .python-version file as an alternative to the Heroku-specific (and now deprecated) runtime.txt file, and we recommend apps switch to using the former since it's more widely supported by other tooling.

The .python-version file is supported by pyenv, uv, the GitHub Actions setup-python action and many others.

In addition, the .python-version file supports the version being specified as just the major version (eg 3.12 vs 3.12.N) which means will pick up Python patch updates automatically (which is the recommended usage on Heroku).

See:
https://devcenter.heroku.com/changelog-items/3005
https://devcenter.heroku.com/articles/python-runtimes#selecting-a-runtime
heroku/heroku-buildpack-python#1642
https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#using-the-python-version-file-input


Checklist:

  • I've made sure that tests are updated accordingly (especially if adding or updating a template option)
  • I've updated the documentation or confirm that my change doesn't require any updates

Heroku now supports the `.python-version` file as an alternative to the
Heroku-specific (and now deprecated) `runtime.txt` file, and recommends
apps switch to using the former since it's more widely supported by other
tooling.

The `.python-version` file is supported by pyenv, uv, the GitHub Actions
`setup-python` action and many others.

In addition, the `.python-version` file supports the version being specified
as just the major version (eg `3.12` vs `3.12.N`) which means will pick up
Python patch updates automatically (which is the recommended usage on
Heroku).

See:
https://devcenter.heroku.com/changelog-items/3005
heroku/heroku-buildpack-python#1642
https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#using-the-python-version-file-input
@luzfcb luzfcb requested review from foarsitter and luzfcb and removed request for foarsitter January 22, 2025 23:41
Copy link
Collaborator

@luzfcb luzfcb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@edmorley Since you're likely more familiar with the recent changes at Heroku, does the cookiecutter-django Heroku deployment tutorial require any updates to align with current Heroku best practices?

https://github.com/cookiecutter/cookiecutter-django/blob/master/docs/3-deployment/deployment-on-heroku.rst

@edmorley
Copy link
Contributor Author

@luzfcb Thank you for the review!

Since you're likely more familiar with the recent changes at Heroku, does the cookiecutter-django Heroku deployment tutorial require any updates to align with current Heroku best practices?

Ah good question! Glancing through it, it seems mostly fine - though I spotted a couple of small tweaks that would be worth making - for which I've opened #5656.

@browniebroke browniebroke merged commit 827d357 into cookiecutter:master Jan 26, 2025
13 checks passed
@browniebroke
Copy link
Member

Thanks!

@edmorley edmorley deleted the runtime-txt-to-python-version branch January 26, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants