Skip to content

Conversation

@tdstein
Copy link
Collaborator

@tdstein tdstein commented Sep 5, 2024

Remove all @property annotated methods used for direct field access on concrete resources. To maintain backward compatibility, a new __getattr__ implementation is added to Resource. This implementation invokes __getitem__ when the key exists in self. A noisy deprecation warning alerts users that this functionality will be removed in v1.0.0.

@tdstein tdstein force-pushed the tdstein/262-remove-resource-properties branch from 9561465 to 53ffe59 Compare September 5, 2024 17:46
@github-actions
Copy link

github-actions bot commented Sep 5, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1047 1002 96% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/posit/connect/bundles.py 100% 🟢
src/posit/connect/content.py 100% 🟢
src/posit/connect/env.py 100% 🟢
src/posit/connect/groups.py 39% 🟢
src/posit/connect/metrics/shiny_usage.py 100% 🟢
src/posit/connect/metrics/visits.py 100% 🟢
src/posit/connect/oauth/integrations.py 100% 🟢
src/posit/connect/oauth/oauth.py 100% 🟢
src/posit/connect/oauth/sessions.py 100% 🟢
src/posit/connect/permissions.py 100% 🟢
src/posit/connect/resources.py 100% 🟢
src/posit/connect/tasks.py 100% 🟢
src/posit/connect/users.py 100% 🟢
src/posit/connect/variants.py 100% 🟢
TOTAL 96% 🟢

updated for commit: 4f3098d by action🐍

Base automatically changed from tdstein/uv-tooling to main September 9, 2024 14:13
@tdstein tdstein force-pushed the tdstein/262-remove-resource-properties branch from 53ffe59 to beabe6c Compare September 9, 2024 15:40
@tdstein tdstein marked this pull request as ready for review September 9, 2024 15:41
Copy link
Collaborator

@toph-allen toph-allen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this relate to #271 in terms of scheduling / release?

@tdstein
Copy link
Collaborator Author

tdstein commented Sep 9, 2024

How does this relate to #271 in terms of scheduling / release?

This will be released first. Then, sometime in the future, we will release v1.0.0. Likely once #264 is ready.

Removes all @Property annotated methods used for direct field access on
concrete resources. A new __getattr__ implementation is added to
Resource to maintain backwards compatiblity. This implementation calls
__getitem__ when the key exists in self. A noisy deprecation warning is
issued to alert users that this functionality will be removed in v1.0.0.
@tdstein tdstein force-pushed the tdstein/262-remove-resource-properties branch from beabe6c to 4f3098d Compare September 10, 2024 13:43
@tdstein tdstein requested a review from zackverham September 10, 2024 13:44
@tdstein
Copy link
Collaborator Author

tdstein commented Sep 10, 2024

@zackverham, this includes changes to the OAuth resources you added yesterday.

@tdstein tdstein merged commit 50e78ac into main Sep 10, 2024
@tdstein tdstein deleted the tdstein/262-remove-resource-properties branch September 10, 2024 18:37
tdstein added a commit that referenced this pull request Sep 20, 2024
BREAKING CHANGE: removes support for accessing resource fields using
`__getattr__` (e.g., `user.username`). Use `__getitem__` instead (e.g.,
`user["username"]`.

depends on #265 and #266
closes #262
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.

4 participants