Skip to content

fix: allow IdentityDict to be assigned IdentityAccess#2628

Open
tonyandrewmeyer wants to merge 2 commits into
canonical:mainfrom
tonyandrewmeyer:rainy/1977-identity-access-typeddict
Open

fix: allow IdentityDict to be assigned IdentityAccess#2628
tonyandrewmeyer wants to merge 2 commits into
canonical:mainfrom
tonyandrewmeyer:rainy/1977-identity-access-typeddict

Conversation

@tonyandrewmeyer

Copy link
Copy Markdown
Collaborator

Allow the access field of IdentityDict to be the enum or the string literals.

Fixes #1977

@tonyandrewmeyer

Copy link
Copy Markdown
Collaborator Author

The issue has a bunch of discussion copied from somewhere else that makes me wonder if this is too simple a fix, but it seems to solve the type: ignore at the heart of that, and the code still works since we handle the enum, and this should be backwards compatible since we're expanding not contracting. But maybe I am missing something?

@tonyandrewmeyer tonyandrewmeyer marked this pull request as ready for review July 6, 2026 02:58
@james-garner-canonical

Copy link
Copy Markdown
Contributor

I think this technically runs into backwards compatibility issues with Identity.to_dict. We still convert access to a string, but the type checker doesn't know that. Previously a user could know at type checking time that identity.to_dict('access') was a str, but now the type checker will think it might be an enum member instead.

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.

Improve type hints for Pebble identities

2 participants