Skip to content

Deprecate app=... in favor of explicit WSGITransport/ASGITransport. - #3050

Merged
lovelydinosaur merged 16 commits into
masterfrom
deprecate-app
Feb 2, 2024
Merged

Deprecate app=... in favor of explicit WSGITransport/ASGITransport.#3050
lovelydinosaur merged 16 commits into
masterfrom
deprecate-app

Conversation

@lovelydinosaur

@lovelydinosaurlovelydinosaur commented Jan 11, 2024

Copy link
Copy Markdown
Contributor

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 https://github.com/encode/httpx/issues/947#issuecomment-1727389402.

TODO:

@lovelydinosaurlovelydinosaur added the 1.0 proposal Pull requests proposing 1.0 API changes label Jan 11, 2024
Comment threadhttpx/_client.py Outdated
@lovelydinosaur
lovelydinosaur requested a review from a teamJanuary 25, 2024 15:58
@Kludex

Copy link
Copy Markdown
Contributor

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

Comment threadCHANGELOG.md Outdated

### Removed

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

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@T-256T-256Jan 26, 2024

Copy link
Copy Markdown
Contributor

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.

@lovelydinosaurlovelydinosaurJan 26, 2024

Copy link
Copy Markdown
ContributorAuthor

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.)

@lovelydinosaur

Copy link
Copy Markdown
ContributorAuthor

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.

@lovelydinosaur

lovelydinosaur commented Feb 2, 2024

Copy link
Copy Markdown
ContributorAuthor

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.

@lovelydinosaur
lovelydinosaur merged commit cabd1c0 into masterFeb 2, 2024
@lovelydinosaur
lovelydinosaur 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
@ofer-pd

Copy link
Copy Markdown

There's one more section of docs that needs to be updated - the API reference for Client and AsyncClient don't yet mention that the app param is deprecated.

dispensable added a commit to dispensable/helpdesk that referenced this pull request Apr 3, 2025
dispensable added a commit to douban/helpdesk that referenced this pull request Apr 3, 2025
* Use real task status
* Fix pytest of async client encode/httpx#3050
samclearman pushed a commit to titanmsp/httpx that referenced this pull request Apr 26, 2025
…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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.0 proposalPull requests proposing 1.0 API changes

Development

Successfully merging this pull request may close these issues.

4 participants

@lovelydinosaur@Kludex@ofer-pd@T-256