Skip to content

Commit c9b9737

Browse files
authored
Merge pull request #434 from nanotaboada/feature/python-version
feat: migrate from runtime.txt to .python-version
2 parents 9f7a528 + 1dd02d9 commit c9b9737

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

.github/workflows/python-app.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ on:
1212
pull_request:
1313
branches: [ master ]
1414

15-
env:
16-
PYTHON_VERSION: 3.13.3
17-
1815
jobs:
1916
lint:
2017
runs-on: ubuntu-latest
@@ -25,10 +22,10 @@ jobs:
2522
- name: Lint commit messages
2623
uses: wagoid/commitlint-github-action@v6.2.1
2724

28-
- name: Set up Python ${{ env.PYTHON_VERSION }}
29-
uses: actions/setup-python@v6.1.0
25+
- name: Set up Python
26+
uses: actions/setup-python@v6.0.0
3027
with:
31-
python-version: ${{ env.PYTHON_VERSION }}
28+
python-version-file: '.python-version'
3229
cache: 'pip'
3330

3431
- name: Install lint dependencies
@@ -51,10 +48,10 @@ jobs:
5148
- name: Checkout repository
5249
uses: actions/checkout@v6.0.0
5350

54-
- name: Set up Python ${{ env.PYTHON_VERSION }}
51+
- name: Set up Python
5552
uses: actions/setup-python@v6.1.0
5653
with:
57-
python-version: ${{ env.PYTHON_VERSION }}
54+
python-version-file: '.python-version'
5855
cache: 'pip'
5956

6057
- name: Install test dependencies

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ipython_config.py
8686
# pyenv
8787
# For a library or package, you might want to ignore these files since the code is
8888
# intended to run in multiple environments; otherwise, check them in:
89-
# .python-version
89+
# Track .python-version for consistent Python version across environments
9090

9191
# pipenv
9292
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -158,4 +158,4 @@ cython_debug/
158158
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159159
# and can be added to the global gitignore or merged into this file. For a more nuclear
160160
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161-
#.idea/
161+
#.idea/

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13.3

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Stage 1: Builder
33
# This stage builds the application and its dependencies.
44
# ------------------------------------------------------------------------------
5+
# Python version should match .python-version file (currently 3.13.3)
56
FROM python:3.13.3-slim-bookworm AS builder
67

78
WORKDIR /app
@@ -19,6 +20,7 @@ RUN pip wheel --no-cache-dir --wheel-dir=/app/wheelhouse -r requirements.txt
1920
# Stage 2: Runtime
2021
# This stage creates the final, minimal image to run the application.
2122
# ------------------------------------------------------------------------------
23+
# Python version should match .python-version file (currently 3.13.3)
2224
FROM python:3.13.3-slim-bookworm AS runtime
2325

2426
WORKDIR /app

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Proof of Concept for a RESTful API made with [Python 3](https://www.python.org/)
1919

2020
_Figure: Simplified, conceptual project structure and main application flow. Not all dependencies are shown._
2121

22+
## Python Version Management
23+
24+
This project uses `.python-version` to specify the required Python version. If you use [pyenv](https://github.com/pyenv/pyenv), [asdf](https://asdf-vm.com/), or [mise](https://mise.jdx.dev/), the correct Python version will be automatically activated when you enter the project directory.
25+
26+
Alternatively, ensure you have Python 3.13.3 (or the version specified in `.python-version`) installed.
27+
2228
## Install
2329

2430
```console

runtime.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)