Skip to content

Commit a44172b

Browse files
committed
python entrypoints return (success: bool, message: str)
1 parent f7584ab commit a44172b

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

libvcell/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from libvcell.solver_utils import vcml_to_finite_volume_input, sbml_to_finite_volume_input
2+
3+
__all__ = [
4+
"vcml_to_finite_volume_input",
5+
"sbml_to_finite_volume_input"
6+
]

libvcell/libvcell.py

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

libvcell/solver_utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from pathlib import Path
2+
3+
from libvcell._internal.native_calls import ReturnValue, VCellNativeCalls
4+
5+
6+
def vcml_to_finite_volume_input(vcml_content: str, simulation_name: str, output_dir_path: Path) -> (bool, str):
7+
native = VCellNativeCalls()
8+
return_value: ReturnValue = native.vcml_to_finite_volume_input(vcml_content, simulation_name, output_dir_path)
9+
return return_value.success, return_value.message
10+
11+
def sbml_to_finite_volume_input(sbml_content: str, output_dir_path: Path) -> (bool, str):
12+
native = VCellNativeCalls()
13+
return_value: ReturnValue = native.sbml_to_finite_volume_input(sbml_content, output_dir_path)
14+
return return_value.success, return_value.message

tests/test_libvcell.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
from pathlib import Path
22

3-
from libvcell.libvcell import libvcell
3+
from libvcell import vcml_to_finite_volume_input, sbml_to_finite_volume_input
44

55

66
def test_vcml_to_finite_volume_input(temp_output_dir: Path, vcml_file_path: Path, vcml_sim_name: str) -> None:
77
vcml_content = vcml_file_path.read_text()
8-
libvcell.vcml_to_finite_volume_input(
8+
success, msg = vcml_to_finite_volume_input(
99
vcml_content=vcml_content, simulation_name=vcml_sim_name, output_dir_path=temp_output_dir
1010
)
1111
assert len(list(temp_output_dir.iterdir())) > 0
12+
assert success is True
13+
assert msg == "Success"
1214

1315

1416
def test_sbml_to_finite_volume_input(temp_output_dir: Path, sbml_file_path: Path, vcml_sim_name: str) -> None:
1517
sbml_content = sbml_file_path.read_text()
16-
libvcell.sbml_to_finite_volume_input(sbml_content=sbml_content, output_dir_path=temp_output_dir)
18+
success, msg = sbml_to_finite_volume_input(sbml_content=sbml_content, output_dir_path=temp_output_dir)
1719
assert len(list(temp_output_dir.iterdir())) > 0
20+
assert success is True
21+
assert msg == "Success"

0 commit comments

Comments
 (0)