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

refactor: Replacing http_requests return type hint #2435

Closed
wants to merge 1 commit into from

Conversation

lmilbaum
Copy link
Collaborator

@lmilbaum lmilbaum commented Dec 19, 2022

http_request() will be deprecated in future release in favor of backend_request(). That is because of the return type change and the need to warn users of the change.

@lmilbaum lmilbaum self-assigned this Dec 19, 2022
@lmilbaum lmilbaum force-pushed the http_request branch 2 times, most recently from b6eedfc to 550263a Compare December 19, 2022 22:33
@lmilbaum lmilbaum marked this pull request as ready for review December 19, 2022 22:46
gitlab/client.py Outdated Show resolved Hide resolved
gitlab/client.py Show resolved Hide resolved
nejch pushed a commit that referenced this pull request Feb 12, 2023
The purpose of this change is to track API changes described in
https://github.com/python-gitlab/python-gitlab/blob/main/docs/api-levels.rst,
for example, for package versioning and breaking change announcements
in case of protocol changes.

This is MVP implementation to be used by #2435.
@lmilbaum
Copy link
Collaborator Author

/rerun-all

@lmilbaum
Copy link
Collaborator Author

@nejch after moving the protocols to the backend, this change will pass because the change is for the front end (client) http_request call. The whole point of the protocol is to identify this kind of change.

@lmilbaum
Copy link
Collaborator Author

/rerun-all

@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2023

Codecov Report

Merging #2435 (7358573) into main (1da7c53) will increase coverage by 0.00%.
The diff coverage is 96.42%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main    #2435   +/-   ##
=======================================
  Coverage   96.15%   96.15%           
=======================================
  Files          87       87           
  Lines        5663     5667    +4     
=======================================
+ Hits         5445     5449    +4     
  Misses        218      218           
Flag Coverage Δ
api_func_v4 82.53% <78.57%> (+0.01%) ⬆️
cli_func_v4 82.98% <64.28%> (+0.01%) ⬆️
unit 87.61% <92.85%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/client.py 98.80% <96.42%> (+<0.01%) ⬆️

@lmilbaum lmilbaum force-pushed the http_request branch 2 times, most recently from 7476d56 to a712dda Compare February 17, 2023 05:05
@lmilbaum
Copy link
Collaborator Author

@nejch @JohnVillalovos Can you please review this PR?

Comment on lines +826 to +828
utils.warn(
"`http_request()` is deprecated and will be removed in a future version.\n"
"Please use `backend_request()` instead.",
category=DeprecationWarning,
)
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit wary of this, it would feel wrong deprecating this after we already had a similar discussion in #1842. What would be the issue with having a http_request in the public client?

Keeping in mind that the user does not care about the backends generally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a breaking change, so this would need to be at least communicated to users via a breaking change trailer (and triger 4.0.0).

I've thought it would make sense using this method and not to trigger 4.0.0 for now.

Copy link
Member

@nejch nejch Mar 10, 2023

Choose a reason for hiding this comment

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

@lmilbaum what I meant was what would be wrong with simply keeping http_backend on the client, while having backend-specific implementations in the backends package?

This way it's quite consistent with the existing http_* methods (there is also some history in the other MR, where we discussed we'd keep it in the public client as it is).

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 not following. http_backend is kept on the client while having backend-specific implementation in the backend package.
I was just trying to address the valid concern you have raised regarding the breaking change.

@lmilbaum lmilbaum requested a review from nejch March 10, 2023 18:33
@lmilbaum lmilbaum force-pushed the http_request branch 2 times, most recently from 5be9523 to c264a12 Compare March 13, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants