Skip to content

Commit d948970

Browse files
Merge pull request #494 from PEtab-dev/develop
Release 0.1.13
2 parents 4d6d917 + 75a1aed commit d948970

File tree

6 files changed

+14
-22
lines changed

6 files changed

+14
-22
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## 0.1 series
44

5+
### 0.1.13
6+
7+
* Fix for pandas 1.2.0 -- use `get_handle` instead of `get_filepath_or_buffer`
8+
* Fix erroneous `petab_test_suite` symlink (all #493)
9+
510
### 0.1.12
611

712
* Documentation update:

petab/sbml.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Functions for interacting with SBML models"""
22
from warnings import warn
33
import logging
4+
from pandas.io.common import get_handle, is_url, is_file_like
45
import re
56
from typing import Dict, Any, List, Union, Tuple
67
import libsbml
@@ -416,19 +417,10 @@ def get_sbml_model(
416417
File or URL or file handle to read the model from
417418
:return: The SBML document, model and reader
418419
"""
419-
420-
from pandas.io.common import get_filepath_or_buffer, is_url, is_file_like
421-
422420
if is_file_like(filepath_or_buffer) or is_url(filepath_or_buffer):
423-
buffer = get_filepath_or_buffer(filepath_or_buffer, mode='r')[0]
424-
if is_url(filepath_or_buffer):
425-
buffer = ''.join(line.decode('utf-8') for line in buffer)
426-
else:
427-
buffer = ''.join(line for line in buffer)
428-
421+
handle = get_handle(filepath_or_buffer, mode='r').handle
429422
# URL or already opened file, we will load the model from a string
430-
431-
return load_sbml_from_string(buffer)
423+
return load_sbml_from_string(''.join(handle))
432424

433425
return load_sbml_from_file(filepath_or_buffer)
434426

petab/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""PEtab library version"""
2-
__version__ = '0.1.12'
2+
__version__ = '0.1.13'

petab/yaml.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import jsonschema
77
import numpy as np
88
import yaml
9-
from pandas.io.common import get_filepath_or_buffer
9+
from pandas.io.common import get_handle
1010

1111
from .C import * # noqa: F403
1212

@@ -123,13 +123,8 @@ def load_yaml(yaml_config: Union[Dict, str]) -> Dict:
123123
if isinstance(yaml_config, dict):
124124
return yaml_config
125125

126-
filepath_or_buffer = get_filepath_or_buffer(yaml_config, mode='r')[0]
127-
if isinstance(filepath_or_buffer, str):
128-
# a filename
129-
with open(filepath_or_buffer, 'r') as f:
130-
return yaml.safe_load(f)
131-
# a stream
132-
return yaml.safe_load(filepath_or_buffer)
126+
handle = get_handle(yaml_config, mode='r').handle
127+
return yaml.safe_load(handle)
133128

134129

135130
def is_composite_problem(yaml_config: Union[Dict, str]) -> bool:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def absolute_links(txt):
5353
url='https://github.com/PEtab-dev/PEtab',
5454
packages=find_packages(exclude=['doc*', 'test*']),
5555
install_requires=['numpy>=1.15.1',
56-
'pandas>=1.0.1',
56+
'pandas>=1.2.0',
5757
'matplotlib>=2.2.3',
5858
'python-libsbml>=5.17.0',
5959
'sympy',

tests/test_petab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ def test_load_remote():
545545
"""Test loading remote files"""
546546

547547
yaml_url = "https://raw.githubusercontent.com/PEtab-dev/petab_test_suite" \
548-
"/master/cases/0001/_0001.yaml"
548+
"/master/petabtests/cases/0001/_0001.yaml"
549549
petab_problem = petab.Problem.from_yaml(yaml_url)
550550

551551
assert petab_problem.sbml_model is not None

0 commit comments

Comments
 (0)