From 3845c14b5f7ec8af5d4accc75725ce8d4f17978a Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Wed, 27 Nov 2024 14:01:43 +0100 Subject: [PATCH 1/2] fix: Update distribution values when defaults --- argilla/src/argilla/settings/_resource.py | 4 ++-- argilla/tests/unit/test_settings/test_settings.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/argilla/src/argilla/settings/_resource.py b/argilla/src/argilla/settings/_resource.py index 6971db722f..e750a66de1 100644 --- a/argilla/src/argilla/settings/_resource.py +++ b/argilla/src/argilla/settings/_resource.py @@ -73,7 +73,7 @@ def __init__( super().__init__(client=_dataset._client if _dataset else None) self._dataset = _dataset - self._distribution = distribution + self._distribution = distribution or TaskDistribution.default() self._mapping = mapping self.__guidelines = self.__process_guidelines(guidelines) self.__allow_extra_metadata = allow_extra_metadata @@ -137,7 +137,7 @@ def allow_extra_metadata(self, value: bool): @property def distribution(self) -> TaskDistribution: - return self._distribution or TaskDistribution.default() + return self._distribution @distribution.setter def distribution(self, value: TaskDistribution) -> None: diff --git a/argilla/tests/unit/test_settings/test_settings.py b/argilla/tests/unit/test_settings/test_settings.py index 73f69883b9..30ba3ea6a2 100644 --- a/argilla/tests/unit/test_settings/test_settings.py +++ b/argilla/tests/unit/test_settings/test_settings.py @@ -176,6 +176,14 @@ def test_settings_with_modified_default_task_distribution(self): other_settings = rg.Settings(fields=[rg.TextField(name="text", title="title")]) assert other_settings.distribution == TaskDistribution(min_submitted=1) + def test_settings_with_modified_task_distribution_value(self): + settings = rg.Settings(fields=[rg.TextField(name="text", title="title")]) + + assert settings.distribution == TaskDistribution(min_submitted=1) + settings.distribution.min_submitted = 10 + + assert settings.distribution == TaskDistribution(min_submitted=10) + def test_compare_equal_settings(self): settings = rg.Settings(fields=[rg.TextField(name="text", title="title")]) assert settings == settings From ef8522b1a0214d2c5ede112a56f141f2d98e836d Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Wed, 27 Nov 2024 14:06:16 +0100 Subject: [PATCH 2/2] chore: Update CHANGELOG --- argilla/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/argilla/CHANGELOG.md b/argilla/CHANGELOG.md index 620ed69018..3684e9c15b 100644 --- a/argilla/CHANGELOG.md +++ b/argilla/CHANGELOG.md @@ -25,6 +25,10 @@ These are the section headers that we use: - Added support to webhook listeners. ([#5502](https://github.com/argilla-io/argilla/pull/5502)) - Added support to Python 3.13. ([#5652](https://github.com/argilla-io/argilla/pull/5652)) +### Fixed + +- Fixed error when update settings.distribution.min_submitted from defaults ([#5719](https://github.com/argilla-io/argilla/pull/5719)) + ## [2.4.0](https://github.com/argilla-io/argilla/compare/v2.3.0...v2.4.0) ### Added