Skip to content

Commit 8342ca7

Browse files
authored
[BUGFIX] argilla: allow change default distribution values (#5719)
# Description <!-- Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. --> When creating a `rg.Settings` instance with default distribution, updates on the `min_submitted` attribute do not take effect. ````python settings = rg.Settings(fields=...) settings.distribution.min_submitted= 3 # this not takes effect ```` ~Maybe related to #5718 **Type of change** <!-- Please delete options that are not relevant. Remember to title the PR according to the type of change --> - Bug fix (non-breaking change which fixes an issue) **How Has This Been Tested** <!-- Please add some reference about how your feature has been tested. --> **Checklist** <!-- Please go over the list and make sure you've taken everything into account --> - I added relevant documentation - I followed the style guidelines of this project - I did a self-review of my code - I made corresponding changes to the documentation - I confirm My changes generate no new warnings - I have added tests that prove my fix is effective or that my feature works - I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)
1 parent 9f03df1 commit 8342ca7

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

argilla/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ These are the section headers that we use:
2525
- Added support to webhook listeners. ([#5502](https://github.com/argilla-io/argilla/pull/5502))
2626
- Added support to Python 3.13. ([#5652](https://github.com/argilla-io/argilla/pull/5652))
2727

28+
### Fixed
29+
30+
- Fixed error when update settings.distribution.min_submitted from defaults ([#5719](https://github.com/argilla-io/argilla/pull/5719))
31+
2832
## [2.4.0](https://github.com/argilla-io/argilla/compare/v2.3.0...v2.4.0)
2933

3034
### Added

argilla/src/argilla/settings/_resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(
7373
super().__init__(client=_dataset._client if _dataset else None)
7474

7575
self._dataset = _dataset
76-
self._distribution = distribution
76+
self._distribution = distribution or TaskDistribution.default()
7777
self._mapping = mapping
7878
self.__guidelines = self.__process_guidelines(guidelines)
7979
self.__allow_extra_metadata = allow_extra_metadata
@@ -137,7 +137,7 @@ def allow_extra_metadata(self, value: bool):
137137

138138
@property
139139
def distribution(self) -> TaskDistribution:
140-
return self._distribution or TaskDistribution.default()
140+
return self._distribution
141141

142142
@distribution.setter
143143
def distribution(self, value: TaskDistribution) -> None:

argilla/tests/unit/test_settings/test_settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ def test_settings_with_modified_default_task_distribution(self):
176176
other_settings = rg.Settings(fields=[rg.TextField(name="text", title="title")])
177177
assert other_settings.distribution == TaskDistribution(min_submitted=1)
178178

179+
def test_settings_with_modified_task_distribution_value(self):
180+
settings = rg.Settings(fields=[rg.TextField(name="text", title="title")])
181+
182+
assert settings.distribution == TaskDistribution(min_submitted=1)
183+
settings.distribution.min_submitted = 10
184+
185+
assert settings.distribution == TaskDistribution(min_submitted=10)
186+
179187
def test_compare_equal_settings(self):
180188
settings = rg.Settings(fields=[rg.TextField(name="text", title="title")])
181189
assert settings == settings

0 commit comments

Comments
 (0)