Skip to content

Commit 091eb1b

Browse files
authored
fix pip check for optional dependencies (#405)
* fix pip check for optional dependencies * install optional dependencies * Update pipeline.yml * add new line * Update check.py * Update pipeline.yml * Update environment-mace.yml
1 parent 39a63ac commit 091eb1b

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

.ci_support/check.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import tomlkit
2+
3+
4+
if __name__ == "__main__":
5+
with open("pyproject.toml", "r") as f:
6+
data = tomlkit.load(f)
7+
8+
lst = []
9+
for sub_lst in data["project"]["optional-dependencies"].values():
10+
for el in sub_lst:
11+
lst.append(el)
12+
13+
data["project"]["dependencies"] += [el for el in set(lst) if not el.startswith("pwtools")]
14+
15+
with open("pyproject.toml", "w") as f:
16+
f.writelines(tomlkit.dumps(data))

.ci_support/environment-mace.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ channels:
22
- conda-forge
33
dependencies:
44
- pymace =0.3.6
5+
- pytorch =2.5.1

.ci_support/environment-qe.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ channels:
22
- conda-forge
33
dependencies:
44
- qe =7.2
5-
- pwtools =1.2.3
5+
- pwtools =1.2.3

.github/workflows/pipeline.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,24 @@ jobs:
134134
steps:
135135
- uses: actions/checkout@v4
136136
- name: Conda config
137-
run: echo -e "channels:\n - conda-forge\n" > .condarc
137+
run: |
138+
cp .ci_support/environment.yml environment.yml
139+
tail --lines=+4 .ci_support/environment-lammps.yml >> environment.yml
140+
tail --lines=+4 .ci_support/environment-gpaw.yml >> environment.yml
141+
echo -e "channels:\n - conda-forge\n" > .condarc
138142
- name: Setup Mambaforge
139143
uses: conda-incubator/setup-miniconda@v3
140144
with:
141145
python-version: '3.12'
142146
miniforge-version: latest
143147
condarc-file: .condarc
144-
environment-file: .ci_support/environment.yml
148+
environment-file: environment.yml
145149
- name: Pip check
146150
shell: bash -l {0}
147151
run: |
148-
pip install versioneer[toml]==0.29
152+
pip install versioneer[toml]==0.29 tomlkit
153+
python .ci_support/check.py
154+
cat pyproject.toml
149155
pip install . --no-deps --no-build-isolation
150156
pip check
151157

0 commit comments

Comments
 (0)