diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 67014ba..1d529a2 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -12,9 +12,6 @@ on: pull_request: branches: [ master ] -env: - PYTHON_VERSION: 3.13.3 - jobs: lint: runs-on: ubuntu-latest @@ -25,10 +22,10 @@ jobs: - name: Lint commit messages uses: wagoid/commitlint-github-action@v6.2.1 - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v6.1.0 + - name: Set up Python + uses: actions/setup-python@v6.0.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version-file: '.python-version' cache: 'pip' - name: Install lint dependencies @@ -51,10 +48,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v6.0.0 - - name: Set up Python ${{ env.PYTHON_VERSION }} + - name: Set up Python uses: actions/setup-python@v6.1.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version-file: '.python-version' cache: 'pip' - name: Install test dependencies diff --git a/.gitignore b/.gitignore index 6f316ab..7d392e5 100644 --- a/.gitignore +++ b/.gitignore @@ -86,7 +86,7 @@ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: -# .python-version +# Track .python-version for consistent Python version across environments # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. @@ -158,4 +158,4 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file +#.idea/ diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2c20ac9 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13.3 diff --git a/Dockerfile b/Dockerfile index d6e6c52..04d747a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ # Stage 1: Builder # This stage builds the application and its dependencies. # ------------------------------------------------------------------------------ +# Python version should match .python-version file (currently 3.13.3) FROM python:3.13.3-slim-bookworm AS builder WORKDIR /app @@ -19,6 +20,7 @@ RUN pip wheel --no-cache-dir --wheel-dir=/app/wheelhouse -r requirements.txt # Stage 2: Runtime # This stage creates the final, minimal image to run the application. # ------------------------------------------------------------------------------ +# Python version should match .python-version file (currently 3.13.3) FROM python:3.13.3-slim-bookworm AS runtime WORKDIR /app diff --git a/README.md b/README.md index 99ec439..2f8f1a0 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,12 @@ Proof of Concept for a RESTful API made with [Python 3](https://www.python.org/) _Figure: Simplified, conceptual project structure and main application flow. Not all dependencies are shown._ +## Python Version Management + +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. + +Alternatively, ensure you have Python 3.13.3 (or the version specified in `.python-version`) installed. + ## Install ```console diff --git a/runtime.txt b/runtime.txt deleted file mode 100644 index b50f9b0..0000000 --- a/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.13.3