From abeb93438bf42e9cfceaa3ee9c5f7b0fc58c8955 Mon Sep 17 00:00:00 2001 From: Michael Ekstrand Date: Tue, 2 Jul 2024 12:50:00 -0400 Subject: [PATCH] pip install for test workflow --- .github/workflows/test.yml | 35 ++++++++++++++++++++++++++++++----- README.md | 2 +- lkdev/workflows/test.py | 14 ++++++++++++-- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90582f694..ffd84eed1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,9 +31,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: 🐍 Setup bootstrap Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' - name: 👢 Generate Conda environment file run: | - pipx run --python 3.11 --spec . lk-conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml + pip install -e . + python -m lkdev.conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml - id: setup name: 📦 Set up Conda environment uses: mamba-org/setup-micromamba@v1 @@ -236,9 +241,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: 🐍 Setup bootstrap Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' - name: 👢 Generate Conda environment file run: | - pipx run --python 3.11 --spec . lk-conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml lenskit-funksvd/pyproject.toml + pip install -e . + python -m lkdev.conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml lenskit-funksvd/pyproject.toml - id: setup name: 📦 Set up Conda environment uses: mamba-org/setup-micromamba@v1 @@ -333,9 +343,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: 🐍 Setup bootstrap Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' - name: 👢 Generate Conda environment file run: | - pipx run --python 3.11 --spec . lk-conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml lenskit-implicit/pyproject.toml + pip install -e . + python -m lkdev.conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml lenskit-implicit/pyproject.toml - id: setup name: 📦 Set up Conda environment uses: mamba-org/setup-micromamba@v1 @@ -476,9 +491,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: 🐍 Setup bootstrap Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' - name: 👢 Generate Conda environment file run: | - pipx run --python 3.11 --spec . lk-conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml lenskit-funksvd/pyproject.toml lenskit-implicit/pyproject.toml + pip install -e . + python -m lkdev.conda -o ci-environment.yml -e all requirements-test.txt lenskit/pyproject.toml lenskit-funksvd/pyproject.toml lenskit-implicit/pyproject.toml - id: setup name: 📦 Set up Conda environment uses: mamba-org/setup-micromamba@v1 @@ -525,9 +545,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: 🐍 Setup bootstrap Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' - name: 👢 Generate Conda environment file run: | - pipx run --python 3.11 --spec . lk-conda -o ci-environment.yml -e all requirements-test.txt requirements-demo.txt lenskit/pyproject.toml lenskit-funksvd/pyproject.toml lenskit-implicit/pyproject.toml + pip install -e . + python -m lkdev.conda -o ci-environment.yml -e all requirements-test.txt requirements-demo.txt lenskit/pyproject.toml lenskit-funksvd/pyproject.toml lenskit-implicit/pyproject.toml - id: setup name: 📦 Set up Conda environment uses: mamba-org/setup-micromamba@v1 diff --git a/README.md b/README.md index c3d3d6e66..688748fc9 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ We recommend using an Anaconda environment for developing LensKit. We provide a tool to automate setting up Conda environments from the LensKit dependencies; to create a dev environment, checkout LensKit, then run: - pipx ./utils/conda-tool.py --env -n lkpy pyproject.toml dev-requirements.txt + pipx --spec . lk-conda -n lkpy pyproject.toml dev-requirements.txt conda activate lkpy That will create and activate an environment named `lkpy` with all the LensKit diff --git a/lkdev/workflows/test.py b/lkdev/workflows/test.py index 43e667421..2008a6323 100644 --- a/lkdev/workflows/test.py +++ b/lkdev/workflows/test.py @@ -5,6 +5,7 @@ from ..ghactions import GHJob, GHStep, script CODECOV_TOKEN = "5cdb6ef4-e80b-44ce-b88d-1402e4dfb781" +META_PYTHON = "3.11" PYTHONS = ["3.10", "3.11", "3.12"] PLATFORMS = ["ubuntu-latest", "macos-latest", "windows-latest"] PACKAGES = ["lenskit", "lenskit-funksvd", "lenskit-implicit"] @@ -105,21 +106,30 @@ def step_checkout(options: Optional[JobOptions] = None) -> GHStep: def steps_setup_conda(options: JobOptions) -> list[GHStep]: - ctool = ["pipx run --python 3.11 --spec .", "lk-conda", "-o", "ci-environment.yml"] + ctool = ["python -m lkdev.conda", "-o", "ci-environment.yml"] if options.extras: for e in options.extras: ctool += ["-e", e] else: ctool += ["-e", "all"] ctool += options.req_files + [f"{pkg}/pyproject.toml" for pkg in options.required_packages] + conda_prep = " ".join(ctool) pip = ["pip", "install", "--no-deps"] pip += [f"-e {pkg}" for pkg in options.required_packages] return [ + { + "name": "🐍 Setup bootstrap Python", + "uses": "actions/setup-python@v5", + "with": {"python-version": META_PYTHON}, + }, { "name": "👢 Generate Conda environment file", - "run": script.command(ctool), + "run": script(f""" + pip install -e . + {conda_prep} + """), }, { "id": "setup",