Skip to content

Commit 35d2dbe

Browse files
committed
0.8.4 py9 compatability release
1 parent c4161f2 commit 35d2dbe

File tree

7 files changed

+57
-36
lines changed

7 files changed

+57
-36
lines changed

CONTRIBUTORS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Contributors
22

3-
## Release 0.8.2
3+
## Release 0.8.4
4+
Many thanks go to @willigot for their suggestions and code contributions.
45

6+
## Release 0.8.2
57

68
## Release 0.8.1
79

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CBMPy
22
PySCeS Constraint Based Modelling (http://cbmpy.sourceforge.net)
3-
Copyright (C) 2010-2022 Brett G. Olivier, Vrije Universiteit Amsterdam, Amsterdam, The Netherlands
3+
Copyright (C) 2010-2023 Brett G. Olivier, Vrije Universiteit Amsterdam, Amsterdam, The Netherlands
44

55
This program is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -75,4 +75,4 @@ Once you have installed CBMPy it can be easily upgraded.
7575
### Anaconda update
7676
`conda update cbmpy`
7777

78-
(c) Brett G. Olivier, Amsterdam, 2014-2022
78+
(c) Brett G. Olivier, Amsterdam, 2014-2023

RELEASES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Release history
22

3-
## Release 0.8.2 (2021)
3+
## Release 0.8.4 (2023)
4+
Primarily a Python 9.x compatability release
45

56

7+
## Release 0.8.2 (2021)
68
## Release 0.8.1 (2021-07-23)
79

810
Primarily a bugfix release to fix the SymPy compatability issues as well as improved requirements handling.

cbmpy/CBCommon.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,19 @@
7575
try:
7676
import pyparsing
7777
HAVE_PYPARSING = True
78-
print('pyparsing')
78+
print('pyparsing import')
7979
except ImportError:
8080
print('INFO: please install pyparsing to enable chemical balance checking!')
8181

8282

83-
if not HAVE_PYPARSING:
84-
try:
85-
from . import pyparsing
83+
#if not HAVE_PYPARSING:
84+
#if os.sys.version_info[0] == 3 and os.sys.version_info[1] < 9:
85+
#try:
86+
#from . import pyparsing
8687

87-
HAVE_PYPARSING = True
88-
except ImportError:
89-
print('INFO please install pyparsing to enable chemical balance checking!')
88+
#HAVE_PYPARSING = True
89+
#except ImportError:
90+
#print('INFO please install pyparsing to enable chemical balance checking!')
9091

9192
if HAVE_PYPARSING:
9293
pp_caps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

cbmpy/CBGLPK.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
HAVE_SWIGLPK = True
7070
__solver_version__ = '{}.{}'.format(sw.GLP_MAJOR_VERSION, sw.GLP_MINOR_VERSION)
7171
print(
72-
'\n\nCBGLPK based on swiglpk: not all methods implimented yet!',
72+
'CBGLPK based on swiglpk: not all methods implimented yet!',
7373
__solver_version__,
7474
)
7575

cbmpy/CBXML.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,11 @@ def sbml_readSBML2FBA(
326326
F = csio.StringIO()
327327
model_id = M.getId()
328328
model_name = M.getName()
329-
model_description = libsbml.XMLNode_convertXMLNodeToString(M.getNotes())
329+
if libsbml.getLibSBMLVersion() >= 51903:
330+
node_txt = libsbml.XMLNode.convertXMLNodeToString(M.getNotes())
331+
else:
332+
node_txt = libsbml.XMLNode_convertXMLNodeToString(M.getNotes())
333+
model_description = node_txt
330334
model_description = xml_stripTags(model_description).strip()
331335

332336
# print(model_description)
@@ -384,7 +388,10 @@ def sbml_readSBML2FBA(
384388
chemFormula=CF,
385389
)
386390
# process notes field, get rid of <head>, <body> elements
387-
specNotes = libsbml.XMLNode_convertXMLNodeToString(SBSp.getNotes())
391+
if libsbml.getLibSBMLVersion() >= 51903:
392+
specNotes = libsbml.XMLNode.convertXMLNodeToString(SBSp.getNotes())
393+
else:
394+
specNotes = libsbml.XMLNode_convertXMLNodeToString(SBSp.getNotes())
388395
S.annotation = sbml_readCOBRANote(specNotes)
389396

390397
# Note: chemFormula works will have to see about charge GETFROMNAME!!!
@@ -456,8 +463,11 @@ def sbml_readSBML2FBA(
456463
del reagents
457464
if EXREAC:
458465
R.is_exchange = True
459-
# R.setAnnotation('note', libsbml.XMLNode_convertXMLNodeToString(SBRe.getNotes()))
460-
reacNotes = libsbml.XMLNode_convertXMLNodeToString(SBRe.getNotes())
466+
467+
if libsbml.getLibSBMLVersion() >= 51903:
468+
reacNotes = libsbml.XMLNode.convertXMLNodeToString(SBRe.getNotes())
469+
else:
470+
reacNotes = libsbml.XMLNode_convertXMLNodeToString(SBRe.getNotes())
461471
R.annotation = sbml_readCOBRANote(reacNotes)
462472
manot = sbml_getCVterms(SBRe, model=False)
463473
if manot != None:
@@ -472,7 +482,7 @@ def sbml_readSBML2FBA(
472482
if __HAVE_FBA_ANOT__:
473483
# root = ELTree.ElementTree(file=os.path.join(work_dir, _TEMP_XML_FILE_))
474484
root = ELTree.ElementTree(file=F)
475-
root_i = root.getiterator()
485+
root_i = root.iter()
476486
for ri in root_i:
477487
if (
478488
ri.tag
@@ -481,7 +491,7 @@ def sbml_readSBML2FBA(
481491
if __DEBUG__:
482492
print(ri.tag)
483493
rootfba = ELTree.ElementTree(ri)
484-
root_fba_i = rootfba.getiterator()
494+
root_fba_i = rootfba.iter()
485495
constraints = []
486496
for ret in root_fba_i:
487497
if (
@@ -491,8 +501,7 @@ def sbml_readSBML2FBA(
491501
):
492502
if __DEBUG__:
493503
print(ret.tag)
494-
chld = ret.getchildren()
495-
for c in chld:
504+
for c in list(ret):
496505
if __DEBUG__:
497506
print('\t{}'.format(c.tag))
498507
attrib = c.attrib
@@ -524,7 +533,7 @@ def sbml_readSBML2FBA(
524533
activeId = ret.attrib[
525534
'{http://www.sbml.org/sbml/level3/version1/fba/version1}activeObjective'
526535
]
527-
for obj in ret.getchildren():
536+
for obj in list(ret):
528537
## print obj.attrib
529538
if (
530539
'{http://www.sbml.org/sbml/level3/version1/fba/version1}type'
@@ -538,17 +547,17 @@ def sbml_readSBML2FBA(
538547
## raw_input(ftype)
539548
sid = obj.attrib['id']
540549
# multiobj = []
541-
for c_ in obj.getchildren():
550+
for c_ in list(obj):
542551
fo = []
543-
for cc_ in c_.getchildren():
552+
for cc_ in list(c_):
544553
fo.append(cc_.attrib)
545554
multiobj.append(fo)
546555

547556
if __DEBUG__:
548557
print(objfunc_data)
549558
obj_ = multiobj[-1]
550559
for flobj_ in obj_:
551-
for a in flobj_:
560+
for a in tuple(flobj_):
552561
flobj_.update(
553562
{
554563
a.replace(
@@ -1186,7 +1195,10 @@ def sbml_getNotes(obj):
11861195
"""
11871196
notes = ''
11881197
try:
1189-
notes = libsbml.XMLNode_convertXMLNodeToString(obj.getNotes())
1198+
if libsbml.getLibSBMLVersion() >= 51903:
1199+
notes = libsbml.XMLNode.convertXMLNodeToString(obj.getNotes())
1200+
else:
1201+
notes = libsbml.XMLNode_convertXMLNodeToString(obj.getNotes())
11901202
if notes != '' and notes is not None:
11911203
# too aggressive but efficient behaviour removed
11921204
# notes = xml_stripTags(notes).strip()
@@ -3763,9 +3775,11 @@ def __init__(self, pid):
37633775
if LOADANNOT:
37643776
S.annotation = sbml_readKeyValueDataAnnotation(SBSp.getAnnotationString())
37653777
if S.annotation == {}:
3766-
S.annotation = sbml_readCOBRANote(
3767-
libsbml.XMLNode_convertXMLNodeToString(SBSp.getNotes())
3768-
)
3778+
if libsbml.getLibSBMLVersion() >= 51903:
3779+
node_txt = libsbml.XMLNode.convertXMLNodeToString(SBSp.getNotes())
3780+
else:
3781+
node_txt = libsbml.XMLNode_convertXMLNodeToString(SBSp.getNotes())
3782+
S.annotation = sbml_readCOBRANote(node_txt)
37693783
# SBSp.unsetNotes()
37703784
manot = sbml_getCVterms(SBSp, model=False)
37713785
if manot != None:
@@ -4016,10 +4030,12 @@ def __init__(self, pid):
40164030
if LOADANNOT:
40174031
R.annotation = sbml_readKeyValueDataAnnotation(SBRe.getAnnotationString())
40184032
# only dig for ancient annotation if not using V2
4033+
if libsbml.getLibSBMLVersion() >= 51903:
4034+
node_txt = libsbml.XMLNode.convertXMLNodeToString(SBRe.getNotes())
4035+
else:
4036+
node_txt = libsbml.XMLNode_convertXMLNodeToString(SBRe.getNotes())
40194037
if FBCver < 2 and R.annotation == {}:
4020-
R.annotation = sbml_readCOBRANote(
4021-
libsbml.XMLNode_convertXMLNodeToString(SBRe.getNotes())
4022-
)
4038+
R.annotation = sbml_readCOBRANote(node_txt)
40234039
manot = sbml_getCVterms(SBRe, model=False)
40244040
if manot != None:
40254041
R.miriam = manot

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CBMPy: setup.py
33
===============
44
PySCeS Constraint Based Modelling (http://cbmpy.sourceforge.net)
5-
Copyright (C) 2010-2022 Brett G. Olivier, VU University Amsterdam, Amsterdam, The Netherlands
5+
Copyright (C) 2010-2023 Brett G. Olivier, VU University Amsterdam, Amsterdam, The Netherlands
66
77
This program is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -64,9 +64,9 @@
6464
readme = """
6565
PySCeS CBMPy (http://cbmpy.sourceforge.net) is a new platform for constraint
6666
based modelling and analysis. It has been designed using principles developed
67-
in the PySCeS simulation software project: usability, flexibility and accessibility.
68-
Its architecture is both extensible and flexible using data structures that are intuitive to
69-
the biologist (metabolites, reactions, compartments) while transparently translating these into
67+
in the PySCeS simulation software project: usability, flexibility and accessibility.
68+
Its architecture is both extensible and flexible using data structures that are intuitive to
69+
the biologist (metabolites, reactions, compartments) while transparently translating these into
7070
the underlying mathematical structures used in advanced analysis (LP's, MILP's).
7171
7272
PySCeS CBMPy implements popular analyses such as FBA, FVA, element/charge
@@ -97,7 +97,7 @@
9797
# zip_safe = False,
9898
install_requires=install_requires_src,
9999
extras_require=extras_require_src,
100-
tests_require=tests_require_src,
100+
tests_require=tests_require_src,
101101
platforms=["Windows", "Linux", "Mac"],
102102
classifiers=[
103103
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)