File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # gh-action-setup-python-with-deps
2- Installs Python and some extra dependencies
1+ # Setup Python with dependencies Action
2+
3+ This action installs Python, upgrades ` pip ` and optionally installs some extra
4+ dependencies.
5+
6+ Here is an example demonstrating how to use it in a workflow:
7+
8+ ``` yaml
9+ jobs :
10+ test :
11+ name : Test
12+ runs-on : ubuntu-20.04
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+ - name : Setup Python
18+ uses : frequenz-floss/gh-action-setup-python-with-deps@v0.x.x
19+ with :
20+ python-version : " 3.11"
21+ dependencies : " mkdocs"
22+ - name : Run mkdocs
23+ run : mkdocs --help
24+ ` ` `
25+
26+ ## Inputs
27+
28+ * ` python-version`: The Python version to use. Required.
29+
30+ This is passed to the
31+ [`actions/setup-python`](https://github.com/actions/setup-python) action.
32+
33+ * `dependencies`: The dependencies to install. Default: "".
34+
35+ This is passed to the `pip install` command as is, without any shell
36+ escaping. If empty, no dependencies are installed.
Original file line number Diff line number Diff line change 1+ name : " Setup Python with dependencies"
2+ description : " Installs Python and some extra dependencies."
3+ author : " Frequenz Energy-as-a-Service GmbH"
4+
5+ # Refer to the following link(s) for more information on inputs:
6+ # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
7+ inputs :
8+ python-version :
9+ description : >
10+ The Python version to use. This is passed to the `actions/setup-python`.
11+ required : true
12+ dependencies :
13+ description : >
14+ The dependencies to install. If empty, no dependencies are installed.
15+
16+ This is passed to the `pip install` command as is, without any shell escaping.
17+ required : false
18+ default : " "
19+
20+
21+ # Refer to the following link(s) for more information on the composite run steps:
22+ # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs
23+ runs :
24+ using : " composite"
25+ steps :
26+ - name : Setup Python
27+ uses : actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
28+ with :
29+ python-version : ${{ inputs.python-version }}
30+ cache : pip
31+
32+ - name : Upgrade pip
33+ shell : bash
34+ run : python -m pip install --upgrade pip
35+
36+ - name : Install the dependencies
37+ shell : bash
38+ if : ${{ inputs.dependencies != '' }}
39+ run : python -m pip install ${{ inputs.dependencies }}
40+
41+ - name : Print the installed dependencies (debug)
42+ shell : bash
43+ if : ${{ inputs.dependencies != '' }}
44+ run : python -m pip freeze
You can’t perform that action at this time.
0 commit comments