Skip to content

Improve unique value support#2312

Open
Sawy7 wants to merge 1 commit into
joke2k:masterfrom
Sawy7:improve-unique
Open

Improve unique value support#2312
Sawy7 wants to merge 1 commit into
joke2k:masterfrom
Sawy7:improve-unique

Conversation

@Sawy7

@Sawy7 Sawy7 commented Jan 30, 2026

Copy link
Copy Markdown

Hello, I would like to submit these changes aiming to improve unique value generation that was introduced here. The main focus of this PR is to allow accessing every property through Faker().unique and to introduce a mode in which unique values are preferred, but not enforced (Faker().preferred_unique). Full set of changes bellow.

What does this change

  • Allow accessing any property through UniqueProxy
  • Add preferred uniqueness (won't raise if unique values exhausted)
  • Exempt generator methods starting with 'current_' from uniqueness checks and make their values initially unique with multiple locales
  • Modify and add new tests

What was wrong

These are quality-of-life improvements, rather than bugfixes.

How this fixes it

Slight additions to Faker class. Most modifications are in UniqueProxy.

Checklist

  • I have read the documentation about CONTRIBUTING
  • I have read the documentation about Coding style
  • I have run make lint

Thanks for your consideration. Please let me know if there is anything I can change to make this work for inclusion in the project.

- Allow accessing any property through UniqueProxy
- Add preferred uniqueness (won't raise if unique values exhausted)
- Exempt generator methods starting with 'current_' from uniqueness checks and make their values initially unique with multiple locales
- Modify and add new tests
@Sawy7

Sawy7 commented Mar 27, 2026

Copy link
Copy Markdown
Author

Hey @fcurella, sorry to bother you. Just wanted to ask if there is something I could do in order to make the inclusion of my changes possible. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant