Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using `poetry` with pipelines

Scott Fay January 12, 2023

I have tried a few different ways to install poetry:

Here, with pipx:

image: python:3.9

pipelines:
default:
- step:
caches:
- pip
script:
- python3 -m pip install --user pipx
- python3 -m pipx ensurepath
- pipx install poetry
- poetry install
- poetry run pytest -v tests/* --junitxml=test-reports/report.xml
This fails with
bash: pipx: command not found
image: python:3.9

pipelines:
default:
- step:
script:
- curl -sSL https://install.python-poetry.org | python3 -
- export PATH="$HOME/.poetry/bin:$PATH"
- poetry install
This also fails with:
bash: poetry: command not found
Clearly there's something I don't understand about the environment. How can I execute poetry commands in a pipeline script?

2 answers

0 votes
Joshua Tang
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2024

You can also setup Poetry via a pipe now:

script:
- pipe: atlassian/poetry-cli-setup:0.2.0
- ./setup-poetry.sh
- poetry install

See here for more details: https://bitbucket.org/product/features/pipelines/integrations?search=poetry&p=atlassian/poetry-cli-setup

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2023

Hi @Scott Fay,

Can you try the following commands? I was able to install poetry using these commands.

- curl -sSL https://install.python-poetry.org | python3 -
- export PATH="$HOME/.local/bin:$PATH"
- poetry --version

Bitbucket Pipelines builds run in Docker containers with Linux platform, so I used the instructions detailed below for Linux:

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events