Skip to content

Commit b7be59d

Browse files
Carlosespicurmergify[bot]
authored andcommitted
Add requirements.txt file for Python dependencies (#40)
Signed-off-by: Carlosespicur <carlosespicur@proton.me> (cherry picked from commit 0ca6886) # Conflicts: # .github/workflows/reusable-ci.yml # README.md
1 parent 0745990 commit b7be59d

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

.github/actions/install_python_packages/action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ description: 'Install specified Python packages in a virtual environment'
44
inputs:
55
packages:
66
description: 'A space-separated list of Python packages to install.'
7-
required: true
7+
required: false
8+
default: ''
9+
requirements-file:
10+
description: 'Path to a requirements.txt file listing Python packages to install.'
11+
required: false
12+
default: ''
813
python-version:
914
description: 'The Python version to use (e.g., 3.12).'
1015
required: true
@@ -36,5 +41,12 @@ runs:
3641

3742
- name: Install Python packages
3843
run: |
39-
pip install ${{ inputs.packages }}
44+
if [ -n "${{ inputs.requirements-file }}" ]; then
45+
pip install -r ${{ inputs.requirements-file }}
46+
fi
47+
48+
if [ -n "${{ inputs.packages }}" ]; then
49+
pip install ${{ inputs.packages }}
50+
fi
51+
4052
shell: bash

.github/workflows/reusable-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ jobs:
4545
- name: Install required python packages
4646
uses: ./.github/actions/install_python_packages
4747
with:
48+
<<<<<<< HEAD
4849
packages: "catkin_pkg lark-parser empy colcon-common-extensions"
50+
=======
51+
requirements-file: "${{ github.workspace }}/requirements.txt"
52+
>>>>>>> 0ca6886 (Add requirements.txt file for Python dependencies (#40))
4953
python-version: ${{ inputs.python-version }}
5054
use-sudo: "true"
5155

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ sudo apt install -y rsync pip git gcc-arm-none-eabi cmake
1818
This component needs `colcon` and other Python 3 packages in order to build micro-ROS packages:
1919

2020
```bash
21+
<<<<<<< HEAD
2122
pip3 install catkin_pkg lark-parser empy colcon-common-extensions
23+
=======
24+
pip3 install -r requirements.txt
25+
>>>>>>> 0ca6886 (Add requirements.txt file for Python dependencies (#40))
2226
```
2327
2428
## Usage

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
catkin_pkg
2+
lark-parser
3+
empy==3.3.4
4+
colcon-common-extensions

0 commit comments

Comments
 (0)