I'm trying to setup my bitbucket_pipelines.yml file to make it possible for all the steps to have Poetry already installed, so that running `poetry run [command]` should never return `bash: poetry: command not found`. So far I made it work with the following configuration:
# This is an example Starter pipeline configuration
# Use a skeleton to build, test and deploy using manual and parallel steps
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: python:3.12
definitions:
caches:
poetry-cache:
key:
files:
- poetry.lock
path: .venv
pipelines:
default:
- parallel:
- step:
name: 'Build and Test'
caches:
- poetry-cache
script:
- pipe: atlassian/poetry-cli-setup:0.2.0
- ./setup-poetry.sh
- poetry config virtualenvs.in-project true
- poetry install
- poetry run pytest
- step:
name: 'Lint'
caches:
- poetry-cache
script:
- pipe: atlassian/poetry-cli-setup:0.2.0
- ./setup-poetry.sh
- poetry install
- poetry run ruff check
As you can see, the only way I found was to reinstall Poetry in each step. It's already good enough that `poetry install` is fast because it uses the cache and in fact ends up installing nothing, however I wonder if there's a better way for poetry itself to make it available to all steps without having to install it in each.