From 75cb999a32519753ab205cd9257f644e5982009d Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Mon, 19 Sep 2022 09:29:38 -0700 Subject: [PATCH 1/5] Remove dependency on packaging library for pandas version check. Fix #767 --- src/hdmf/common/alignedtable.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/hdmf/common/alignedtable.py b/src/hdmf/common/alignedtable.py index 073b11564..f373440d3 100644 --- a/src/hdmf/common/alignedtable.py +++ b/src/hdmf/common/alignedtable.py @@ -5,7 +5,6 @@ import numpy as np import pandas as pd -from packaging import version from . import register_class from .table import DynamicTable @@ -249,7 +248,7 @@ def to_dataframe(self, **kwargs): names = [self.name, ] + list(self.category_tables.keys()) res = pd.concat(dfs, axis=1, keys=names) # TODO: Once Pandas minimum version has increased to 1.5 drop the if/else and just use the 1.5 approach - if version.parse(pd.__version__) >= version.parse("1.5.0"): + if tuple([int(i) for i in pd.__version__.split(".") if i.isnumeric()]) >= (1, 5, 0): res = res.set_index((self.name, 'id'), drop=True, copy=False) # pragma: no cover else: res.set_index((self.name, 'id'), drop=True, inplace=True) @@ -317,7 +316,7 @@ def get(self, item, **kwargs): names = [self.name, ] + list(self.category_tables.keys()) res = pd.concat(dfs, axis=1, keys=names) # TODO: Once Pandas minimum version has increased to 1.5 drop the if/else and just use the 1.5 approach - if version.parse(pd.__version__) >= version.parse("1.5.0"): + if tuple([int(i) for i in pd.__version__.split(".") if i.isnumeric()]) >= (1, 5, 0): res = res.set_index((self.name, 'id'), drop=True, copy=False) # pragma: no cover else: res.set_index((self.name, 'id'), drop=True, inplace=True) From b843ab3d5d1958536952a01ecc71c8c2bb9428a5 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Mon, 19 Sep 2022 09:30:06 -0700 Subject: [PATCH 2/5] Add fix to tox.ini suggested by @rly --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e5702184d..fa25dfe2e 100644 --- a/tox.ini +++ b/tox.ini @@ -123,7 +123,7 @@ commands = {[testenv:build]commands} # Envs that will test installation from a wheel [testenv:wheelinstall] deps = null -commands = python -c "import hdmf" +commands = python -c "import hdmf; import hdmf.common" # Envs that will execute gallery tests [testenv:gallery] From d68840a7229b43178d1dc68fc90f1cf171c5a9fc Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Mon, 19 Sep 2022 09:33:57 -0700 Subject: [PATCH 3/5] Updated changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73c0c5df0..bc8e162cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # HDMF Changelog +## HDMF 3.4.4 (September 20, 2022) + +### Bug fixes +- Fixed missing dependency "packaging" introduced in 3.4.3. @rly @oruebel ([#770](https://github.com/hdmf-dev/hdmf/pull/770)) + ## HDMF 3.4.3 (September 14, 2022) ### Minor improvements From a5226d2fe5a61a8f5b202524378900220ae24608 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Mon, 19 Sep 2022 12:08:20 -0700 Subject: [PATCH 4/5] Remove pandas version check as the API change was reversed in the release --- src/hdmf/common/alignedtable.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/hdmf/common/alignedtable.py b/src/hdmf/common/alignedtable.py index f373440d3..4a72124f6 100644 --- a/src/hdmf/common/alignedtable.py +++ b/src/hdmf/common/alignedtable.py @@ -247,11 +247,7 @@ def to_dataframe(self, **kwargs): dfs += [category.to_dataframe().reset_index() for category in self.category_tables.values()] names = [self.name, ] + list(self.category_tables.keys()) res = pd.concat(dfs, axis=1, keys=names) - # TODO: Once Pandas minimum version has increased to 1.5 drop the if/else and just use the 1.5 approach - if tuple([int(i) for i in pd.__version__.split(".") if i.isnumeric()]) >= (1, 5, 0): - res = res.set_index((self.name, 'id'), drop=True, copy=False) # pragma: no cover - else: - res.set_index((self.name, 'id'), drop=True, inplace=True) + res.set_index((self.name, 'id'), drop=True, inplace=True) return res def __getitem__(self, item): @@ -315,11 +311,7 @@ def get(self, item, **kwargs): [category[item].reset_index() for category in self.category_tables.values()]) names = [self.name, ] + list(self.category_tables.keys()) res = pd.concat(dfs, axis=1, keys=names) - # TODO: Once Pandas minimum version has increased to 1.5 drop the if/else and just use the 1.5 approach - if tuple([int(i) for i in pd.__version__.split(".") if i.isnumeric()]) >= (1, 5, 0): - res = res.set_index((self.name, 'id'), drop=True, copy=False) # pragma: no cover - else: - res.set_index((self.name, 'id'), drop=True, inplace=True) + res.set_index((self.name, 'id'), drop=True, inplace=True) return res elif isinstance(item, str) or item is None: if item in self.colnames: From 780b7c35303f95a9df21039254608bfbf5f1b227 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Mon, 19 Sep 2022 12:13:43 -0700 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc8e162cb..ab3d3e288 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## HDMF 3.4.4 (September 20, 2022) ### Bug fixes -- Fixed missing dependency "packaging" introduced in 3.4.3. @rly @oruebel ([#770](https://github.com/hdmf-dev/hdmf/pull/770)) +- Fixed missing dependency "packaging" introduced in 3.4.3. The code has been updated to avoid the dependency. @rly @oruebel ([#770](https://github.com/hdmf-dev/hdmf/pull/770)) ## HDMF 3.4.3 (September 14, 2022)