SIGN IN SIGN UP

Expand `attribute` value type to support complex values everywhere and cleanup surrounding code (#5266)

* Initial changes..

* Make lots of changes

* Fix tests, run precommit

* Fix more tests

* Run precommit

* Fix more tests

* Refactor clean attributes code and tests..

* Add more test coverage.. Still need to get the type checker passing.

* Refactor BoundedAttributes again.. Fix lots of  tests

* Fix lint issues

* Fix lint issues, spellcheck issues, add changelog

* Fix typo

* Fix __iter__

* Remove log warning.. add msg to TypeError

* Clean up BoundedAttributes

* Remove encoding of Bytes. Fix tests..

* Revert lock file

* Fix busted tests

* Add commnet  retrigger CI

* Minor fixes..

* Clarify immutability

* Minor fixes

* Add changelog

* Try to decode bytes to string using utf-8, fallback to return bytes

* Add @overload and @deprecated to the init with extended_attributes

* Typo

* Fix @overload. Delete weird type and very stale .pyi file

* Try and fail to fix docs issue

* Refactor clean attribute value and associated tests after discussion on PR

* Try to fix docs issue

* Address comments

* Revert changes to logging code

* Add TODOs, update changelog

* Minor changes to changelog and envvar wording.

* Use json.dumps to hash attributes. Respond to some comments..

* Update test to capture mutable types..

* Fix lint

* FIx precommit. bunch of minor cleanup

* Clarify params

* Missing import

* Minor changes..

* Add immutable back..

* Fix broken test

* Add comment to Measurement class

* Fix broken test

* Add helper method raise_if_immutable

* update _set_items to check if key is a string

* Fix pre commit

* Respond to some review comments

* Respond to more comments

* Address more comments

* Address failing CI

* Fix CI

* Put dropped behind counter

* Respond to comments

* Add _assert_never for type checking in attributes

* Switch back to _hash_attributes

* Add assert never

* Address remaining comments

* Apply suggestion from @xrmx

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>

* Remove Attributes | None across the po since Attributes includes None

* Correctly type Attributes inside instrument.py

* Clean attributes inside Measurement

* Use AnyValue everywhere

---------

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
D
DylanRussell committed
0a5d76b65094a4bad414e0c0ab68981fc266f0a9
Parent: eee0da6
Committed by GitHub <noreply@github.com> on 8/21/2026, 7:26:53 PM