Skip to content

GitHub Action to setup python & poetry using cache for dependencies and poetry installation

License

Notifications You must be signed in to change notification settings

dsoftwareinc/setup-python-poetry-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action - Setup and Cache Python Poetry

This GitHub action simplifies the setup and caching of Poetry dependencies for Python projects.

When a job using this action runs for the first time, this action will download Poetry and the required project dependencies, then save it to the cache.

For the following runs (whether it's on a different workflow/job with the same cached commit) this action will restore the cache, which is much faster than downloading everything again.

Basic Usage

  • Make sure you have pyproject.toml, poetry.lock.
name: ci

on:
  push:
    branches: [ master ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      # Deal with environment setup and caching      
      - name: Check out the repository
        uses: actions/checkout@v4
      - name: "Setup Python, Poetry and Dependencies"
        uses: dsoftwareinc/setup-python-poetry-action@v1
        with:
          python-version: 3.11
          poetry-version: 1.7.1
          poetry-install-additional-args: '-E flag' # Optional

      # Run what you want in the poetry environment
      - name: Run tests
        run: |
          poetry run python manage.py test

Input variables:

Name Description Required Default value
python-version Python version to use. Yes n/a
poetry-version Poetry version to use. Yes n/a
poetry-install-additional-args Additional arguments to pass to poetry install. No ""

Notes

Dependencies

License

The scripts and documentation in this project are released under the MIT License.

About

GitHub Action to setup python & poetry using cache for dependencies and poetry installation

Resources

License

Stars

Watchers

Forks

Packages

No packages published