Skip to content

Commit 7fec873

Browse files
committed
Enhance dependency installation script and update workflow
- Modify install_dev_deps.py to include 'spice' dependencies in the installation process. - Update GitHub Actions workflow to install the package with 'spice' extras for comprehensive testing.
1 parent 3030f99 commit 7fec873

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Install package
5252
shell: bash -l {0}
5353
run: |
54-
pip install -e .
54+
pip install -e ".[spice]"
5555
5656
- name: Run tests
5757
shell: bash -l {0}

install_dev_deps.py

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,64 @@
11
#!/usr/bin/env python
2+
import sys
23
from pathlib import Path
3-
import tomlkit
4+
45
import sh
5-
import sys
6+
import tomlkit
67

78
# Define packages that should be installed via pip instead of conda
8-
PIP_PACKAGES = {'build', 'pip-tools'}
9+
PIP_PACKAGES = {"build", "pip-tools"}
10+
911

1012
def install_deps():
1113
# Read pyproject.toml
1214
pyproject_path = Path("pyproject.toml")
1315
with open(pyproject_path) as f:
1416
pyproject = tomlkit.load(f)
15-
16-
# Get both main and dev dependencies
17+
18+
# Get main, spice, and dev dependencies
1719
main_deps = pyproject["project"]["dependencies"]
1820
dev_deps = pyproject["project"]["optional-dependencies"]["dev"]
19-
all_deps = main_deps + dev_deps
20-
21+
spice_deps = pyproject["project"]["optional-dependencies"]["spice"]
22+
all_deps = main_deps + dev_deps + spice_deps
23+
2124
# Split dependencies into conda and pip packages
2225
conda_deps = [dep for dep in all_deps if dep not in PIP_PACKAGES]
2326
pip_deps = [dep for dep in all_deps if dep in PIP_PACKAGES]
24-
27+
2528
# Install conda packages
2629
if conda_deps:
2730
try:
28-
print("Installing with mamba:", ' '.join(conda_deps))
29-
sh.mamba("install", "-y", "-c", "conda-forge", *conda_deps,
30-
_err=sys.stderr, _out=sys.stdout)
31+
print("Installing with mamba:", " ".join(conda_deps))
32+
sh.mamba(
33+
"install",
34+
"-y",
35+
"-c",
36+
"conda-forge",
37+
*conda_deps,
38+
_err=sys.stderr,
39+
_out=sys.stdout,
40+
)
3141
print("Conda installation completed successfully!")
3242
except sh.ErrorReturnCode as e:
3343
print("Error installing conda packages!")
3444
print("Exit code:", e.exit_code)
35-
print("Stdout:", e.stdout.decode() if e.stdout else 'No stdout')
36-
print("Stderr:", e.stderr.decode() if e.stderr else 'No stderr')
45+
print("Stdout:", e.stdout.decode() if e.stdout else "No stdout")
46+
print("Stderr:", e.stderr.decode() if e.stderr else "No stderr")
3747
sys.exit(1)
38-
48+
3949
# Install pip packages
4050
if pip_deps:
4151
try:
42-
print("\nInstalling with pip:", ' '.join(pip_deps))
52+
print("\nInstalling with pip:", " ".join(pip_deps))
4353
sh.pip("install", *pip_deps, _err=sys.stderr, _out=sys.stdout)
4454
print("Pip installation completed successfully!")
4555
except sh.ErrorReturnCode as e:
4656
print("Error installing pip packages!")
4757
print("Exit code:", e.exit_code)
48-
print("Stdout:", e.stdout.decode() if e.stdout else 'No stdout')
49-
print("Stderr:", e.stderr.decode() if e.stderr else 'No stderr')
58+
print("Stdout:", e.stdout.decode() if e.stdout else "No stdout")
59+
print("Stderr:", e.stderr.decode() if e.stderr else "No stderr")
5060
sys.exit(1)
5161

62+
5263
if __name__ == "__main__":
53-
install_deps()
64+
install_deps()

0 commit comments

Comments
 (0)