Skip to content

Commit

Permalink
Pytest fixes, Path fix and faster pip install (#47)
Browse files Browse the repository at this point in the history
* Version numbers are strings not floats

* Change trigger to on pull_request

* We moved away from requirements.txt sometime ago.

* It would be nice to install pytest

* Fixed triple calls from setup.py

Fixes #41

* Added Path for the output_dir

No longer string / string
  • Loading branch information
GijsVermarien authored Oct 19, 2023
1 parent 7783b83 commit 05841ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Run pytest

on:
push:
pull_request:
branches:
- main
- develop # Add the 'develop' branch here
Expand All @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.10 # Specify the Python version you need
python-version: "3.10" # Specify the Python version you need

- name: Install gfortran
run: |
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt # Replace with the path to your requirements file
pip install pytest
- name: Install package in editable mode
run: |
Expand Down
28 changes: 15 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import setuptools # this is the "magic" import
import subprocess
import sys

Expand All @@ -9,17 +8,20 @@

#make clean every time slows things but is needed because users will mostly install after changing networks
#and a make never seems to full update the new network
cwd = os.getcwd()
os.chdir('src/fortran_src/')
result = subprocess.call('make clean', shell=True)
# if result != 0:
# exit(1)
result = subprocess.call('make python', shell=True)
if result != 0:
exit(1)
os.chdir(cwd)

wrap_file = glob("src/fortran_src/uclchemwrap*.so")[0]
move(wrap_file, "src/uclchem/uclchemwrap.so")
# print(f"STAGE: {sys.argv[1]}, full command: {sys.argv}")
if sys.argv[1] in ("editable_wheel"):
cwd = os.getcwd()
os.chdir('src/fortran_src/')
_ = subprocess.call('make clean', shell=True)
result = subprocess.call('make python', shell=True)
if result != 0:
exit(1)
os.chdir(cwd)

wrap_file = glob("src/fortran_src/uclchemwrap*.so")[0]
move(wrap_file, "src/uclchem/uclchemwrap.so")
elif sys.argv[1] in ("bdist_wheel"):
raise RuntimeError("Cannot install UCLCHEM in the site packages, use `pip install -e .`")
else:
pass
setup()
1 change: 1 addition & 0 deletions src/uclchem/makerates/io_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def write_outputs(network: Network, output_dir: str = None) -> None:
output_dir = Path("../src/uclchem")
fortran_src_dir = Path("../src/fortran_src")
else:
output_dir = Path(output_dir)
fortran_src_dir = Path(output_dir)

# Create the species file
Expand Down

0 comments on commit 05841ca

Please sign in to comment.