I'm using poetry 1.1.12 with python 3.10. My project depends on numpy 1.21.1 that takes 5 minutes to install each time I run my continuous integration pipeline.
Is there a way to make poetry use some kind of compiled numpy package instead of rebuilding it each build ?
I've already mitigated this issue by caching my virtual environment repository following steps described in this answer, but I want a solution that works even if I change my poetry.lock
file or if my cache is expired.
I can only use ubuntu-latest
image in github actions due to corporate policy rules
My pyproject.toml
[tool.poetry]
name = "test-poetry"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = "^3.10"
numpy = "^1.21.1"
[tool.poetry.dev-dependencies]
pytest = "^6.2.5"
[build-system]
requires = ["poetry-core>=1.1.12"]
build-backend = "poetry.core.masonry.api"
My github actions workflow:
name: Continuous Integration
on: push
jobs:
test-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install Poetry packaging manager
run: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
- name: Configure Poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install project dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run test
run: poetry run pytest