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 app=... in favor of explicit WSGITransport/ASGITransport. #3050

Merged
merged 16 commits into from Feb 2, 2024

Conversation

tomchristie
Copy link
Member

@tomchristie tomchristie commented Jan 11, 2024

Deprecate the httpx.Client(app=...) and httpx.AsyncClient(app=...) shortcuts.


Instead of...

client = httpx.Client(app=app)

Use this...

transport = httpx.WSGITransport(app=app)
client = httpx.Client(transport=transport)

Instead of...

client = httpx.AsyncClient(app=app)

Use this...

transport = httpx.ASGITransport(app=app)
client = httpx.AsyncClient(transport=transport)

The rationale for this is described in #947 (comment).

TODO:

@tomchristie tomchristie added the 1.0 proposal Pull requests proposing 1.0 API changes label Jan 11, 2024
@tomchristie tomchristie mentioned this pull request Jan 11, 2024
httpx/_client.py Outdated Show resolved Hide resolved
@tomchristie tomchristie requested a review from a team January 25, 2024 15:58
@Kludex
Copy link
Sponsor Member

Kludex commented Jan 25, 2024

This is not deprecation of app=..., it's a removal directly. Is it ok? We usually raise warnings when deprecating paramters, don't we?

CHANGELOG.md Outdated
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Removed

* The `app=...` shortcut has been removed. Use the explicit style of `transport=httpx.WSGITransport()` or `transport=httpx.ASGITransport()` instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this PR is version 1.0 proposal, why don't you track its changelog in #3069 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@T-256 T-256 Jan 26, 2024

Choose a reason for hiding this comment

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

Then do we need to re-mention it in this PR?
All other open PRs with 1.0 proposal tag don't include changelog independently.

Copy link
Member Author

Choose a reason for hiding this comment

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

They should do before approval.

(We should include CHANGELOG entries with the PRs as usual.)

@tomchristie
Copy link
Member Author

We usually raise warnings when deprecating paramters, don't we?

Yep, so... #3069

There's a proposal for several related changes, that end up with a stricter simpler more consistent API.
We can land these in a 1.0, and need to take a call on what we think is best wrt. hard-change vs. soft deprecation path.

@tomchristie
Copy link
Member Author

tomchristie commented Feb 2, 2024

This is not deprecation of app=..., it's a removal directly. Is it ok? We usually raise warnings when deprecating parameters, don't we?

Thanks @Kludex, based on this I've updated the PR to be just a deprecation at this point.

Once this is merged I'll look at rolling a 0.27 version with the updated docs.

@tomchristie tomchristie merged commit cabd1c0 into master Feb 2, 2024
5 checks passed
@tomchristie tomchristie deleted the deprecate-app branch February 2, 2024 13:29
shepilov-vladislav pushed a commit to shepilov-vladislav/httpx that referenced this pull request Mar 28, 2024
…rt`. (encode#3050)

* Deprecate app=... in favour of explicit WSGITransport/ASGITransport

* Linting

* Linting

* Update WSGITransport and ASGITransport docs

* Deprecate app

* Drop deprecation tests

* Add CHANGELOG

* Deprecate 'app=...' shortcut, rather than removing it.

* Update CHANGELOG

* Fix test_asgi.test_deprecated_shortcut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 proposal Pull requests proposing 1.0 API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants