@@ -7,51 +7,48 @@ inputs:
7
7
description : ' Version of python to be installed'
8
8
default : ' .python-version'
9
9
cache :
10
- description : Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
11
- required : true
10
+ description : >
11
+ [Deprecated] Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
12
+ Current implementation uses uv which pulls in pre-compiled binaries of python thereby eliminating the
13
+ need to cache compiled python artifacts.
12
14
default : ' true'
15
+
13
16
runs :
14
17
using : " composite"
15
18
steps :
16
- - name : Ensure dependencies of python are installed
19
+ - name : Ensure system dependencies are installed
20
+ shell : bash
21
+ run : |
22
+ sudo yum install -y tar gzip which
23
+
24
+ - name : Install uv
17
25
shell : bash
18
26
run : |
19
- ${GITHUB_ACTION_PATH}/install-system-dependencies.sh
27
+ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.3.3/uv-installer.sh | sh
28
+ source $HOME/.cargo/env
29
+ uv self update
20
30
21
- - name : Find exact python version
22
- id : find-exact -python-version
31
+ - name : Find desired python version
32
+ id : find-desired -python-version
23
33
shell : bash
24
34
run : |
25
- exact_python_version =$(${GITHUB_ACTION_PATH}/find-exact -python-version.sh "${{ inputs.python-version }}" "${{ inputs.python-version-file }}")
26
- echo "exact_python_version =${exact_python_version }" >> $ GITHUB_OUTPUT
35
+ desired_python_version =$(${GITHUB_ACTION_PATH}/find-desired -python-version.sh "${{ inputs.python-version }}" "${{ inputs.python-version-file }}")
36
+ echo "desired_python_version =${desired_python_version }" | tee -a "${ GITHUB_OUTPUT}"
27
37
28
38
- name : Set installation directory
29
39
id : set-installation-directory
30
40
shell : bash
31
41
run : |
32
- exact_python_version="${{ steps.find-exact-python-version.outputs.exact_python_version }}"
33
- echo "installation_directory=${HOME}/.setup-python-amazon-linux/.python-versions/${exact_python_version}" >> $GITHUB_OUTPUT
34
-
35
- - name : Cache
36
- id : cache-python
37
- uses : actions/cache@v3
38
- if : inputs.cache == 'true'
39
- with :
40
- path : ${{ steps.set-installation-directory.outputs.installation_directory }}
41
- key : python-${{ steps.find-exact-python-version.outputs.exact_python_version }}-${{ runner.arch }}
42
+ desired_python_version="${{ steps.find-desired-python-version.outputs.desired_python_version }}"
43
+ echo "installation_directory=${HOME}/.setup-python-amazon-linux/.python-versions/${desired_python_version}" | tee -a "${GITHUB_OUTPUT}"
42
44
43
45
- id : setup-python
44
46
shell : bash
45
- if : inputs.cache == 'false' || (inputs.cache == 'true' && steps.cache-python.outputs.cache-hit != 'true')
46
47
run : |
47
48
installation_directory="${{ steps.set-installation-directory.outputs.installation_directory }}"
48
- exact_python_version="${{ steps.find-exact-python-version.outputs.exact_python_version }}"
49
-
50
- # Using a separate tmp directory instead of /tmp because in some OS images set a noexec option for the mount
51
- # this is a better way compared to changing the mount options of /tmp
52
- tmp_directory="${HOME}/.setup-python-amazon-linux/tmp"
49
+ desired_python_version="${{ steps.find-desired-python-version.outputs.desired_python_version }}"
53
50
54
- ${GITHUB_ACTION_PATH}/install- python.sh "${exact_python_version }" "${installation_directory}" "${tmp_directory }"
51
+ uv venv -- python "${desired_python_version }" "${installation_directory}"
55
52
56
53
- name : Add python to PATH
57
54
shell : bash
@@ -61,10 +58,15 @@ runs:
61
58
62
59
echo "The following python binaries are now available in the PATH"
63
60
ls "${installation_directory}/bin"
64
-
65
- echo "Linking python libraries..."
66
- ls "${installation_directory}/lib"
67
- sudo ldconfig "${installation_directory}/lib"
61
+
62
+ - name : Install pip
63
+ shell : bash
64
+ run : |
65
+ installation_directory="${{ steps.set-installation-directory.outputs.installation_directory }}"
66
+
67
+ python -m ensurepip --upgrade
68
+ ln -sf "${installation_directory}/bin/pip3" "${installation_directory}/bin/pip"
69
+ pip install --upgrade pip
68
70
69
71
branding :
70
72
icon : ' code'
0 commit comments