From 730edd3ae5fc8c6511a896e270f5af70ff81378f Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Thu, 28 Nov 2024 19:37:16 +0000 Subject: [PATCH 1/3] make pycddlib optional --- burnman/classes/polytope.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/burnman/classes/polytope.py b/burnman/classes/polytope.py index c0dcf393..730d48e5 100644 --- a/burnman/classes/polytope.py +++ b/burnman/classes/polytope.py @@ -11,19 +11,28 @@ from scipy.spatial import Delaunay from scipy.special import comb from copy import copy -import cdd as cdd_float from .material import cached_property from ..utils.math import independent_row_indices +# Try to import pycddlib. +# First, try separating the imports into float and +# fractional, then fall back to only using the float +# representation, and finally don't import anything +# (limiting functionality) try: + cdd_float = importlib.import_module("cdd") cdd_fraction = importlib.import_module("cdd.gmp") cdd_gmp_loaded = True except ImportError: - cdd_fraction = importlib.import_module("cdd") - cdd_gmp_loaded = False + try: + cdd_float = importlib.import_module("cdd") + cdd_fraction = importlib.import_module("cdd") + cdd_gmp_loaded = False + except ImportError: + cdd_float = None class SimplexGrid(object): @@ -140,6 +149,11 @@ def __init__( dependent endmembers are defined. :type independent_endmember_occupancies: numpy.array (2D) or None """ + if cdd_float is None: + raise ImportError( + "You need to install pycddlib to create a MaterialPolytope object." + ) + if equalities.dtype != inequalities.dtype: raise Exception( f"The equalities and inequalities arrays should have the same type ({equalities.dtype} != {inequalities.dtype})." From 8175d647be944656039f00d89c779b66a7c847f3 Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Thu, 28 Nov 2024 19:38:25 +0000 Subject: [PATCH 2/3] prepare 2.1 release --- Readme.md | 6 +++--- burnman/__init__.py | 4 ++-- changelog.txt | 4 ++++ docs/index.rst | 4 ++-- pyproject.toml | 7 +++++-- test.sh | 6 +++++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Readme.md b/Readme.md index 7274d2ac..5b7d920f 100644 --- a/Readme.md +++ b/Readme.md @@ -1,4 +1,4 @@ -[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14165625.svg)](https://doi.org/10.5281/zenodo.14165625) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14238360.svg)](https://doi.org/10.5281/zenodo.14238360) [![DOI](https://joss.theoj.org/papers/10.21105/joss.05389/status.svg)](https://doi.org/10.21105/joss.05389) # BurnMan - a Python toolkit for planetary geophysics, geochemistry and thermodynamics @@ -42,8 +42,8 @@ If you use BurnMan in your work, we ask that you cite the following publications - Myhill, R., Cottaar, S., Heister, T., Rose, I., Unterborn, C., Dannberg, J., Gassmoeller, R. and Farla, R. (2024): - BurnMan v2.0.0 [Software]. Computational Infrastructure for Geodynamics. Zenodo. - https://doi.org/10.5281/zenodo.14165625 + BurnMan v2.1.0 [Software]. Computational Infrastructure for Geodynamics. Zenodo. + https://doi.org/10.5281/zenodo.14238360 - Cottaar S., Heister, T., Rose, I., and Unterborn, C., (2014). BurnMan: A lower mantle mineral physics toolkit, Geochemistry, Geophysics, and diff --git a/burnman/__init__.py b/burnman/__init__.py index fd36f559..7d3206f4 100644 --- a/burnman/__init__.py +++ b/burnman/__init__.py @@ -179,8 +179,8 @@ - Myhill, R., Cottaar, S., Heister, T., Rose, I., Unterborn, C., Dannberg, J., Gassmoeller, R. and Farla, R. (2024): - BurnMan v2.0.0 [Software]. Computational Infrastructure for Geodynamics. Zenodo. - `(https://doi.org/10.5281/zenodo.14165625) `_ + BurnMan v2.1.0 [Software]. Computational Infrastructure for Geodynamics. Zenodo. + `(https://doi.org/10.5281/zenodo.14238360) `_ - Cottaar S., Heister, T., Rose, I., and Unterborn, C., (2014). BurnMan: A lower mantle mineral physics toolkit, Geochemistry, Geophysics, and diff --git a/changelog.txt b/changelog.txt index 9b7f2a2b..09fd5239 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ Changelog --------- +Release v2.1.0 (November 28, 2024) includes + - New: Added MACAW and SPOCK Equations of State + - Changed: pycddlib returned to optional dependency as hard to install on Windows. + Release v2.0.0 (November 14, 2024) includes - Compatibility with Python 3.12. - Compatibility with new versions of numpy (1.26.0), scipy (1.14.0), diff --git a/docs/index.rst b/docs/index.rst index 1be66674..e91cdeb3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -35,8 +35,8 @@ If you use BurnMan in your work, we ask that you cite the following publications - Myhill, R., Cottaar, S., Heister, T., Rose, I., Unterborn, C., Dannberg, J., Gassmoeller, R. and Farla, R. (2024): - BurnMan v2.0.0 [Software]. Computational Infrastructure for Geodynamics. Zenodo. - `(https://doi.org/10.5281/zenodo.14165625) `_ + BurnMan v2.1.0 [Software]. Computational Infrastructure for Geodynamics. Zenodo. + `(https://doi.org/10.5281/zenodo.14238360) `_ - Cottaar S., Heister, T., Rose, I., and Unterborn, C. (2014). BurnMan: A lower mantle mineral physics toolkit, Geochemistry, Geophysics, and diff --git a/pyproject.toml b/pyproject.toml index 56057482..a61c403c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "burnman" -version = "2.0.1a0" +version = "2.1.0" description = "A thermoelastic and thermodynamic toolkit for the Earth and planetary sciences" license = "GPL" authors = ["The BurnMan Team ",] @@ -25,12 +25,15 @@ sympy = "^1.12" cvxpy = "^1.3" matplotlib = "^3.7" numba = "^0.59" -pycddlib-standalone = "^3.0" +pycddlib-standalone = {version = "^3.0", optional = true} [tool.poetry.dev-dependencies] ipython = "^8.5" numba = "^0.59" +[tool.poetry.extras] +dev = ["pycddlib-standalone"] + [tool.poetry.group.dev.dependencies] black = "24.1.1" diff --git a/test.sh b/test.sh index 17ae0146..e9a5ff15 100755 --- a/test.sh +++ b/test.sh @@ -20,7 +20,7 @@ fi $PYTHON --version # Quietly install burnman in development mode echo "Installing BurnMan in development mode ..." -$PYTHON -m pip install -q -e . +$PYTHON -m pip install -q -e .[dev] echo "" echo "Dependency tree:" @@ -30,6 +30,10 @@ pycddlib_version=`pip freeze | grep "pycddlib=" | awk -F"==" '{print $2}'` if [ ! -z "${pycddlib_version}" ] then echo "└── pycddlib [optional, installed: ${pycddlib_version}]" fi +pycddlib_version=`pip freeze | grep "pycddlib-standalone=" | awk -F"==" '{print $2}'` +if [ ! -z "${pycddlib_version}" ] +then echo "└── pycddlib-standalone [optional, installed: ${pycddlib_version}]" +fi echo "" # Quietly install optional modules after burnman From c55b5b3a04b731eb0cbcf877a7fc89beca84694e Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Thu, 28 Nov 2024 20:35:13 +0000 Subject: [PATCH 3/3] version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a61c403c..b2e6da5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "burnman" -version = "2.1.0" +version = "2.1.1a" description = "A thermoelastic and thermodynamic toolkit for the Earth and planetary sciences" license = "GPL" authors = ["The BurnMan Team ",]