Skip to content

Commit

Permalink
Use Mamba for refreshing lock-files (#4966)
Browse files Browse the repository at this point in the history
* Temporarily enable lockfile refresh on push - for testing.

* Temporarily enable lockfile refresh on push - for testing.

* Temporarily enable lockfile refresh on push - for testing.

* Use mamba for lock-file generation.

* Simpler package installation.

* Add Mamba warning to update_lockfiles.py.

* Undo temporary testing changes.
  • Loading branch information
trexfeathers authored Sep 15, 2022
1 parent a3e0348 commit 06c8bc6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
print_hash: true
print_hash: true
6 changes: 4 additions & 2 deletions .github/workflows/refresh-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: install conda-lock
- name: install requirements
run: |
source $CONDA/bin/activate base
conda install -y -c conda-forge conda-lock
conda install -y -c conda-forge conda-libmamba-solver conda-lock
- name: generate lockfile
env:
CONDA_EXPERIMENTAL_SOLVER: libmamba
run: |
$CONDA/bin/conda-lock lock -k explicit -p linux-64 -f requirements/ci/${{matrix.python}}.yml
mv conda-linux-64.lock ${{matrix.python}}-linux-64.lock
Expand Down
15 changes: 12 additions & 3 deletions tools/update_lockfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
from pathlib import Path
import subprocess
import sys
from warnings import warn


message = (
"Iris' large requirements may require Mamba to successfully solve. If you "
"don't want to install Mamba, consider using the workflow_dispatch on "
"Iris' GitHub action."
)
warn(message)


try:
Expand All @@ -29,9 +38,9 @@
"Iris Lockfile Generator",
)

parser.add_argument('files', nargs='+',
parser.add_argument('files', nargs='+',
help="List of environment.yml files to lock")
parser.add_argument('--output-dir', '-o', default='.',
parser.add_argument('--output-dir', '-o', default='.',
help="Directory to save output lock files")

args = parser.parse_args()
Expand All @@ -43,7 +52,7 @@
ftype = fname.split('.')[-1]
if ftype.lower() in ('yaml', 'yml'):
fname = '.'.join(fname.split('.')[:-1])

# conda-lock --filename-template expects a string with a "...{platform}..."
# placeholder in it, so we have to build the .lock filname without
# using .format
Expand Down

0 comments on commit 06c8bc6

Please sign in to comment.