Skip to content

Commit f8e5d67

Browse files
authored
Add version field to config.yaml; gate on version 2 recipes (#223)
1 parent 7faa0fb commit f8e5d67

13 files changed

Lines changed: 82 additions & 59 deletions

File tree

.flake8

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/lint.yaml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
name: lint
22

3-
on:
4-
pull_request:
5-
branches: [main]
3+
on: [push, pull_request]
64

75
jobs:
86
lint:
97
runs-on: ubuntu-latest
108
steps:
119
- uses: actions/checkout@v3
12-
- name: Set up Python
13-
uses: actions/setup-python@v4
14-
with:
15-
python-version: "3.10"
16-
- name: Install Tools
10+
- name: Install uv
1711
run: |
18-
python -m pip install --upgrade pip
19-
python -m pip install black flake8 mypy
20-
- name: Black
12+
curl -LsSf https://astral.sh/uv/install.sh | sh
13+
- name: ruff
2114
run: |
22-
black --check --verbose stackinator unittests
23-
- name: flake8
24-
run: |
25-
flake8 --count --show-source --statistics .
15+
uvx ruff format --check
16+
uvx ruff check

.github/workflows/main.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,13 @@ name: Stackinator CI
33
on: [push, pull_request]
44

55
jobs:
6-
unittestpy36:
7-
runs-on: ubuntu-20.04
8-
strategy:
9-
matrix:
10-
python-version: ['3.6']
6+
unittestpy:
7+
runs-on: ubuntu-latest
118
steps:
129
- uses: actions/checkout@v3
13-
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v4
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
- name: Bootstrap
10+
- name: Install uv
1811
run: |
19-
./bootstrap.sh
12+
curl -LsSf https://astral.sh/uv/install.sh | sh
2013
- name: Generic Unittests
2114
run: |
2215
./test_stackinator.py

docs/readme.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
The documentation for Stackinator is built from the markdown files in this path using MkDocs and MkDocs-material.
22
You can view the latest documentation online at [github.io](https://eth-cscs.github.io/stackinator/)
33

4-
To build a copy locally, first install `mkdocs-material`, e.g.:
4+
To view work in progress docs, run the serve script and follow the link it provides to view a local copy of the docs in your browser.
55
```bash
6-
python3 -m venv docs-env
7-
source docs-env/bin/activate
8-
pip install mkdocs-material
6+
./serve
97
```
108

11-
Then in the root of this project, build the docs and view them with your favourite browser:
12-
```bash
13-
mkdocs build
14-
firefox site/index.html
15-
```
9+
> [!IMPORTANT]
10+
> to run the serve script, you need to first install [uv](https://docs.astral.sh/uv/getting-started/installation/).
11+

docs/recipes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,32 @@ spack:
2525
commit: releases/v0.20
2626
modules: true
2727
description: "HPC development tools for building MPI applications with the GNU compiler toolchain"
28+
version: 2
2829
```
2930
3031
* `name`: a plain text name for the environment
3132
* `store`: the location where the environment will be mounted.
3233
* `spack`: which spack repository to use for installation.
3334
* `modules`: _optional_ enable/diasble module file generation (default `true`).
3435
* `description`: _optional_ a string that describes the environment (default empty).
36+
* `version`: _default = 1_ the version of the uenv recipe (see below)
37+
38+
!!! note "uenv recipe versions"
39+
Stackinator 6 introduces breaking changes to the uenv recipe format, introduced to support Spack v1.0.
40+
41+
We have started versioning uenv recipes:
42+
43+
* **version 1**: original uenv recipes for Spack v0.23 and earlier, supported by Stackinator version 5.
44+
* **version 2**: uenv recipes for Spack v1.0 and later, supported by Stackinator version 6.
45+
46+
The default version is 1, so that old recipes that do not set a version are supported.
47+
48+
!!! warning "You must set version 2 explicitly to use Spack v1.0"
49+
50+
!!! warning "Version 1 recipes must be configured using Stackinator v5"
51+
Version 5 of Stackinator is maintained in the `releases/v5` branch of stackinator.
52+
53+
You must also use the `releases/v5` branch of [Alps cluster config](https://github.com/eth-cscs/alps-cluster-config).
3554

3655
## Compilers
3756

lint

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
uvx ruff format
4+
uvx ruff check --fix

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
requires = ["setuptools", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.black]
6-
line-length = 120
7-
8-
[tool.isort]
9-
profile = "black"
10-
skip = ["external/"]
11-
125
[tool.ruff]
136
line-length = 120
147
extend-exclude = ["external/", "unittests/recipes"]
8+
exclude = ["unittests/recipes/with-repo/repo/packages"]
9+
10+
[tool.ruff.lint]
11+
select = ["E", "F"]
12+
ignore = ["E203"]

stackinator/builder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def generate(self, recipe):
183183

184184
# Clone the spack repository if it has not already been checked out
185185
if not (spack_path / ".git").is_dir():
186-
self._logger.info(f'spack: clone repository {spack["repo"]}')
186+
self._logger.info(f"spack: clone repository {spack['repo']}")
187187

188188
# clone the repository
189189
capture = subprocess.run(
@@ -195,12 +195,12 @@ def generate(self, recipe):
195195
self._logger.debug(capture.stdout.decode("utf-8"))
196196

197197
if capture.returncode != 0:
198-
self._logger.error(f'error cloning the repository {spack["repo"]}')
198+
self._logger.error(f"error cloning the repository {spack['repo']}")
199199
capture.check_returncode()
200200

201201
# Fetch the specific branch
202202
if spack["commit"]:
203-
self._logger.info(f'spack: fetch branch/commit {spack["commit"]}')
203+
self._logger.info(f"spack: fetch branch/commit {spack['commit']}")
204204
capture = subprocess.run(
205205
["git", "-C", spack_path, "fetch", "origin", spack["commit"]],
206206
shell=False,
@@ -210,12 +210,12 @@ def generate(self, recipe):
210210
self._logger.debug(capture.stdout.decode("utf-8"))
211211

212212
if capture.returncode != 0:
213-
self._logger.debug(f'unable to change to the fetch {spack["commit"]}')
213+
self._logger.debug(f"unable to change to the fetch {spack['commit']}")
214214
capture.check_returncode()
215215

216216
# Check out a branch or commit if one was specified
217217
if spack["commit"]:
218-
self._logger.info(f'spack: checkout branch/commit {spack["commit"]}')
218+
self._logger.info(f"spack: checkout branch/commit {spack['commit']}")
219219
capture = subprocess.run(
220220
["git", "-C", spack_path, "checkout", spack["commit"]],
221221
shell=False,
@@ -225,7 +225,7 @@ def generate(self, recipe):
225225
self._logger.debug(capture.stdout.decode("utf-8"))
226226

227227
if capture.returncode != 0:
228-
self._logger.debug(f'unable to change to the requested commit {spack["commit"]}')
228+
self._logger.debug(f"unable to change to the requested commit {spack['commit']}")
229229
capture.check_returncode()
230230

231231
# get the spack commit

stackinator/etc/add-compiler-links.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def has_prefix(path, prefix):
6969
for c in compilers:
7070
local_paths = set([os.path.dirname(v) for k, v in c["paths"].items() if v is not None])
7171
paths += local_paths
72-
print(f'adding compiler {c["spec"]} -> {[p for p in local_paths]}')
72+
print(f"adding compiler {c['spec']} -> {[p for p in local_paths]}")
7373

7474
# find unique paths and concatenate them
7575
pathstring = ":".join(set(paths))

stackinator/etc/envvars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __repr__(self):
161161
return f'envvars.ListEnvVar("{self.name}", {self._updates})'
162162

163163
def __str__(self):
164-
return f"(\"{self.name}\": [{','.join([str(u) for u in self._updates])}])"
164+
return f'("{self.name}": [{",".join([str(u) for u in self._updates])}])'
165165

166166

167167
class ScalarEnvVar(EnvVar):
@@ -453,7 +453,7 @@ def view_impl(args):
453453
for c in compilers:
454454
local_paths = set([os.path.dirname(v) for _, v in c["paths"].items() if v is not None])
455455
compiler_paths += local_paths
456-
print(f'adding compiler {c["spec"]} -> {[p for p in local_paths]}')
456+
print(f"adding compiler {c['spec']} -> {[p for p in local_paths]}")
457457

458458
envvars.set_list("PATH", compiler_paths, EnvVarOp.PREPEND)
459459

0 commit comments

Comments
 (0)