diff --git a/.github/neptune_client_pyproject.toml b/.github/neptune_client_pyproject.toml index 67dd813c2..45c9fbe8f 100644 --- a/.github/neptune_client_pyproject.toml +++ b/.github/neptune_client_pyproject.toml @@ -9,7 +9,7 @@ style = "semver" pattern = "default-unprefixed" [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" # Python lack of functionalities from future versions importlib-metadata = { version = "*", python = "<3.8" } @@ -42,7 +42,7 @@ pandas = "*" # Additional integrations kedro-neptune = { version = "*", optional = true, python = "<3.11" } -neptune-detectron2 = { version = "*", optional = true, python = ">=3.7"} +neptune-detectron2 = { version = "*", optional = true, python = ">=3.8"} neptune-fastai = { version = "*", optional = true } neptune-lightgbm = { version = "*", optional = true } pytorch-lightning = { version = "*", optional = true } diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index 47560ebe4..91992a080 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -17,8 +17,8 @@ jobs: > Command | Description > --- | --- > /pre-commit-apply | Commit a pre-commit suggestions - > /run-unit | Run unittests on full matrix *(win, mac, linux x py3.7-3.12) - > /run-e2e | Run E2E tests on full matrix *(win, mac, linux x py3.7-3.12) - > /run-integrations | Run Client integrations on full matrix *(win, mac, linux x py3.7-3.12) - > /run-all-test | Run all tests on full matrix *(win, mac, linux x py3.7-3.12) + > /run-unit | Run unittests on full matrix *(win, mac, linux x py3.8-3.12) + > /run-e2e | Run E2E tests on full matrix *(win, mac, linux x py3.8-3.12) + > /run-integrations | Run Client integrations on full matrix *(win, mac, linux x py3.8-3.12) + > /run-all-test | Run all tests on full matrix *(win, mac, linux x py3.8-3.12) reaction-type: hooray diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fb3845ce..2d2e87f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## neptune 1.12.0 + +### Changes +- Dropped support for Python 3.7 ([#1864](https://github.com/neptune-ai/neptune-client/pull/1864)) + +### Fixes +- Fixed support for additional Seaborn figure types ([#1864](https://github.com/neptune-ai/neptune-client/pull/1864)) + ## neptune 1.11.1 ### Fixes diff --git a/codecov.yml b/codecov.yml index 1c45809cd..3fdecafe1 100644 --- a/codecov.yml +++ b/codecov.yml @@ -29,11 +29,6 @@ flags: - src/neptune carryforward: true - py3.7: - paths: - - src/neptune - carryforward: true - py3.8: paths: - src/neptune diff --git a/pyproject.toml b/pyproject.toml index 6c62ebbc1..c2da0ff4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,10 +9,9 @@ style = "semver" pattern = "default-unprefixed" [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" # Python lack of functionalities from future versions -importlib-metadata = { version = "*", python = "<3.8" } typing-extensions = ">=3.10.0" # Missing compatibility layer between Python 2 and Python 3 @@ -43,7 +42,7 @@ pandas = "*" # Additional integrations kedro-neptune = { version = "*", optional = true, python = ">=3.9,<3.12" } -neptune-detectron2 = { version = "*", optional = true, python = ">=3.7"} +neptune-detectron2 = { version = "*", optional = true, python = ">=3.8"} neptune-fastai = { version = "*", optional = true } neptune-lightgbm = { version = "*", optional = true } pytorch-lightning = { version = "*", optional = true } diff --git a/src/neptune/internal/utils/images.py b/src/neptune/internal/utils/images.py index 8657c54da..e928a9280 100644 --- a/src/neptune/internal/utils/images.py +++ b/src/neptune/internal/utils/images.py @@ -249,6 +249,8 @@ def _get_pil_image_data(image: PILImage) -> bytes: def _get_figure_image_data(figure) -> bytes: + if figure.__class__.__name__ == "Axes": + figure = figure.figure with io.BytesIO() as image_buffer: figure.savefig(image_buffer, format="png", bbox_inches="tight") return image_buffer.getvalue() @@ -283,7 +285,7 @@ def is_pil_image(image) -> bool: def is_matplotlib_figure(image): - return image.__class__.__module__.startswith("matplotlib.") and image.__class__.__name__ == "Figure" + return image.__class__.__module__.startswith("matplotlib.") and image.__class__.__name__ in ["Figure", "Axes"] def is_plotly_figure(chart): diff --git a/src/neptune/legacy/internal/utils/image.py b/src/neptune/legacy/internal/utils/image.py index 4faf520d8..21f6b4145 100644 --- a/src/neptune/legacy/internal/utils/image.py +++ b/src/neptune/legacy/internal/utils/image.py @@ -68,6 +68,8 @@ def get_image_content(image): def _get_figure_as_image(figure): + if figure.__class__.__name__ == "Axes": + figure = figure.figure with io.BytesIO() as image_buffer: figure.savefig(image_buffer, format="png", bbox_inches="tight") return image_buffer.getvalue() diff --git a/tests/unit/neptune/new/internal/utils/test_images.py b/tests/unit/neptune/new/internal/utils/test_images.py index 5a568f7f5..4de88dfe2 100644 --- a/tests/unit/neptune/new/internal/utils/test_images.py +++ b/tests/unit/neptune/new/internal/utils/test_images.py @@ -49,7 +49,6 @@ class TestImage(unittest.TestCase): - TEST_DIR = "/tmp/neptune/{}".format(uuid4()) def setUp(self): @@ -143,6 +142,12 @@ def test_get_image_content_from_seaborn_figure(self): # then self.assertEqual(get_image_content(grid), self._encode_figure(grid)) + # given + figure = sns.lineplot(x=[1, 2, 3], y=[4, 5, 6]) + + # then + self.assertEqual(get_image_content(figure), self._encode_figure(figure)) + def test_get_html_from_matplotlib_figure(self): # given fig = pyplot.figure() @@ -262,6 +267,8 @@ def _encode_pil_image(image: Image) -> bytes: @staticmethod def _encode_figure(fig: Figure) -> bytes: + if fig.__class__.__name__ == "Axes": + fig = fig.figure with io.BytesIO() as image_buffer: fig.savefig(image_buffer, format="PNG", bbox_inches="tight") return image_buffer.getvalue()