Skip to content

Reusable GitHub Actions for NI Python projects

License

Notifications You must be signed in to change notification settings

ni/python-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ni/python-actions

ni/python-actions is a Git repository containing reusable GitHub Actions for NI Python projects.

ni/python-actions/setup-python

The setup-python action installs Python and adds it to the PATH.

It is a thin wrapper for https://github.com/actions/setup-python which is intended to single-source the default Python version for multiple NI Python projects.

By default, this action installs Python 3.11.9.

Usage

steps:
- uses: ni/python-actions/[email protected]

Inputs

python-version

You can specify the python-version input for testing with multiple versions of Python:

strategy:
  matrix:
    python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
steps:
- uses: ni/python-actions/[email protected]
  with:
    python-version: ${{ matrix.python-version }}

Outputs

python-version

You can use the python-version output to get the actual version of Python, which is useful for caching:

steps:
- uses: ni/python-actions/[email protected]
  id: setup-python
- uses: actions/cache@v4
  with:
    path: .venv
    key: venv-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}

python-path

actions/setup-python sets the pythonLocation environment variable to the directory containing the Python installation.

You can also use the python-path output to get the path to the Python interpreter:

steps:
- uses: ni/python-actions/[email protected]
  id: setup-python
- run: pipx install <package> --python ${{ steps.setup-python.outputs.python-version }}

ni/python-actions/setup-poetry

The setup-poetry action installs Poetry, adds it to the PATH, and caches it to speed up workflows.

This action installs Poetry using the Python version that was selected by the setup-python action, so you must call setup-python first.

By default, this action installs Poetry 1.8.2.

Usage

steps:
- uses: ni/python-actions/[email protected]
- uses: ni/python-actions/[email protected]
- run: poetry install -v

Inputs

poetry-version

steps:
- uses: ni/python-actions/[email protected]
- uses: ni/python-actions/[email protected]
  with:
    poetry-version: 2.1.3
- run: poetry install -v

About

Reusable GitHub Actions for NI Python projects

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published