Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate rest.authorization-url in favor of oauth2-server-uri #962

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

ndrluis
Copy link
Collaborator

@ndrluis ndrluis commented Jul 24, 2024

The purpose of this PR is to follow the OAuth property standard as defined in the Java implementation and the REST Catalog specification: https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L144-L145.

Deprecation message about the oauth tokens behavior:

image

Deprecation message about the property:

image

pyiceberg/catalog/rest.py Outdated Show resolved Hide resolved
@@ -290,7 +293,14 @@ def url(self, endpoint: str, prefixed: bool = True, **kwargs: Any) -> str:

@property
def auth_url(self) -> str:
if url := self.properties.get(AUTH_URL):
if self.properties.get(DEPRECATED_AUTH_URL):
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The initial purpose of this PR was not to warn about the /oauth/tokens endpoint deprecation, it was only to fix the configuration property, but I can add this.

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PyIceberg code here @ndrluis Could you update the docs as well?

@ndrluis
Copy link
Collaborator Author

ndrluis commented Jul 25, 2024

The deprecated decorator adds a message that does not make sense for the properties deprecation. I will add a new function and change where is a property deprecation and are using the deprecated decorator.

@ndrluis
Copy link
Collaborator Author

ndrluis commented Jul 25, 2024

@Fokko Done!

@ndrluis ndrluis requested a review from Fokko July 25, 2024 14:55
Copy link
Contributor

@HonahX HonahX left a comment

Choose a reason for hiding this comment

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

@ndrluis Thanks for working on this! Left some comments about minor stuff. Overall it looks great!

pyiceberg/utils/deprecated.py Outdated Show resolved Hide resolved
mkdocs/docs/how-to-release.md Show resolved Hide resolved


def deprecation_message(deprecated_in: str, removed_in: str, help_message: Optional[str]) -> None:
"""Mark properties as deprecated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently we only use this to deprecate properties. But in the future, we may use it to deprecate other things like parameters. How about just making a general comment here saying that adding this will thrown a deprecation warning?

if not has_oauth_server_uri and (has_init_token or has_credential) and not has_sigv4_enabled:
deprecation_message(
deprecated_in="0.7.0",
removed_in="future Iceberg release",
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a little worried that this may get lost since this is not a version number. How about we remove this in the next major release: 1.0.0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am following what is described in the Java implementation. In the deprecation proposal, it is aimed to be removed in version 1.8.0 or 2.0.0. I believe that 1.8.0 could be released before pyiceberg 1.0.0, but we cannot know if the endpoint will be removed in version 1.8.0.

So, I don't have a strong opinion; I am open to what you think is better.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for pointing this out!

I believe that 1.8.0 could be released before pyiceberg 1.0.0, but we cannot know if the endpoint will be removed in version 1.8.0.

I think we can update the version to a later one (e.g. 1.2.0) in the following releases. So, it looks good to aim for 1.0.0 now.

Another concern is that "future iceberg release" may add confusion since this could mean any version after 0.7.0. So, I prefer to at least include a version number in the removed_in message.

Would love to hear your thoughts on this!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed in 6e253c2

@ndrluis
Copy link
Collaborator Author

ndrluis commented Jul 27, 2024

We have already started the vote for release 0.7.0. I believe we need to change the deprecated_in to 0.8.0.

Thoughts, @HonahX @sungwy?

@sungwy
Copy link
Collaborator

sungwy commented Jul 27, 2024

We have already started the vote for release 0.7.0. I believe we need to change the deprecated_in to 0.8.0.

Thoughts, @HonahX @sungwy?

Hi @ndrluis - that sounds like a good idea.

We have been working on making the release for 0.7.0 for a while, which already comes with many exciting features users have been waiting on. For the last few weeks, I have been mostly working on introducing critical bug fixes into this release so we can finally make it onto the other side 🙂

If it’s alright with you, could we update this and target this change for 0.8.0 as you suggested?

@sungwy sungwy added this to the PyIceberg 0.8.0 release milestone Jul 27, 2024
@ndrluis
Copy link
Collaborator Author

ndrluis commented Jul 27, 2024

Updated deprecated version in commit 1039ac3

@ndrluis ndrluis force-pushed the fix-oauth-uri branch 2 times, most recently from 8cfd954 to 913ee61 Compare August 2, 2024 14:14
Copy link
Collaborator

@sungwy sungwy left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for working on this @ndrluis

Copy link
Contributor

@HonahX HonahX left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @ndrluis !

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @ndrluis

And thanks @sungwy and @HonahX for the review 🚀

return func(*args, **kwargs)

return new_func

return decorator


def deprecation_message(deprecated_in: str, removed_in: str, help_message: Optional[str]) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice addition, I like it a lot 👍

@Fokko Fokko merged commit 50077af into apache:main Aug 8, 2024
7 checks passed
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