mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-02 20:54:41 +03:00
Migrate generated project from runtime.txt
to .python-version
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 https://github.com/heroku/heroku-buildpack-python/issues/1642 https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#using-the-python-version-file-input
This commit is contained in:
parent
bb6e4085c7
commit
665e3e2578
|
@ -76,7 +76,7 @@ def remove_utility_files():
|
|||
|
||||
|
||||
def remove_heroku_files():
|
||||
file_names = ["Procfile", "runtime.txt", "requirements.txt"]
|
||||
file_names = ["Procfile", "requirements.txt"]
|
||||
for file_name in file_names:
|
||||
if file_name == "requirements.txt" and "{{ cookiecutter.ci_tool }}".lower() == "travis":
|
||||
# don't remove the file if we are using travisci but not using heroku
|
||||
|
|
|
@ -98,7 +98,7 @@ updates:
|
|||
# Enable version updates for Python/Pip - Production
|
||||
- package-ecosystem: 'pip'
|
||||
# Look for a `requirements.txt` in the `root` directory
|
||||
# also 'setup.cfg', 'runtime.txt' and 'requirements/*.txt'
|
||||
# also 'setup.cfg', '.python-version' and 'requirements/*.txt'
|
||||
directory: '/'
|
||||
# Every weekday
|
||||
schedule:
|
||||
|
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
python-version-file: '.python-version'
|
||||
|
||||
{%- if cookiecutter.open_source_license != 'Not open source' %}
|
||||
# Consider using pre-commit.ci for open source project
|
||||
|
@ -88,9 +88,9 @@ jobs:
|
|||
{%- else %}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
python-version-file: '.python-version'
|
||||
cache: pip
|
||||
cache-dependency-path: |
|
||||
requirements/base.txt
|
||||
|
|
3
{{cookiecutter.project_slug}}/.gitignore
vendored
3
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -59,9 +59,6 @@ docs/_build/
|
|||
# PyBuilder
|
||||
target/
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
{% if cookiecutter.use_celery == 'y' -%}
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
|
1
{{cookiecutter.project_slug}}/.python-version
Normal file
1
{{cookiecutter.project_slug}}/.python-version
Normal file
|
@ -0,0 +1 @@
|
|||
3.12
|
|
@ -1 +0,0 @@
|
|||
python-3.12.7
|
Loading…
Reference in New Issue
Block a user