Skip to content

[python] add support for streaming#12557

Merged
QuiiBz merged 13 commits intomainfrom
python-streaming
Nov 11, 2024
Merged

[python] add support for streaming#12557
QuiiBz merged 13 commits intomainfrom
python-streaming

Conversation

@QuiiBz
Copy link
Copy Markdown
Member

@QuiiBz QuiiBz commented Nov 8, 2024

  • HTTP handler
  • WSGI handler
  • ASGI handler
  • Logs levels
  • Run all tests

Add support for HTTP streaming and other important feature for Python Vercel Functions, opt-in via the VERCEL_FORCE_PYTHON_STREAMING build environment variable for the duration of the migration.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Nov 8, 2024

🦋 Changeset detected

Latest commit: 4166437

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@vercel/python Minor
vercel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@QuiiBz QuiiBz enabled auto-merge November 11, 2024 18:36
@QuiiBz QuiiBz added this pull request to the merge queue Nov 11, 2024
Merged via the queue into main with commit 80c8ec3 Nov 11, 2024
@QuiiBz QuiiBz deleted the python-streaming branch November 11, 2024 18:48
github-merge-queue bot pushed a commit that referenced this pull request Nov 12, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## [email protected]

### Major Changes

- Migrate `vercel certs` subcommands to their own command specifications
([#12463](#12463))

- Migrate `vercel dns` subcommands to their own command specifications
([#12464](#12464))

- Migrate `vercel alias` subcommands to their own command specifications
([#12458](#12458))

- Migrate `vercel projects` subcommands to their own command
specifications ([#12518](#12518))

- Migrate `vercel env` subcommands to their own command specifications
([#12476](#12476))

- Migrate `vercel domains` subcommands to their own command
specifications ([#12526](#12526))

- Migrate `vercel git` subcommands to their own command specifications
([#12524](#12524))

- Migrate `vercel teams` subcommands to their own command specifications
([#12496](#12496))

### Minor Changes

- Migrate `vercel promote` subcommands to their own command
specifications ([#12480](#12480))

- [cli] add telemetry for `vercel teams switch`
([#12493](#12493))

- Support `multiple: true` for variadic arguments in Command spec
([#12515](#12515))

- Migrate `vercel rollback` subcommands to their own command
specifications ([#12519](#12519))

- [cli] add telemetry for --help flag
([#12430](#12430))

- Adds "--target" as a new option for the "redeploy" command.
([#12523](#12523))

- Add strongly typed `subcommands` for Telemetry methods based on
command specification
([#12446](#12446))

- Migrate `vercel telemetry` subcommands to their own command
specifications ([#12460](#12460))

- Migrate `vercel target` subcommands to their own command
specifications ([#12477](#12477))

- [cli] standardize `vercel teams` subcommand routing
([#12473](#12473))

### Patch Changes

- Don't print empty "Options" section in `--help` output (after
filtering) ([#12479](#12479))

- [cli] integration resource was always redacted simplify method
([#12547](#12547))

- [cli] minor fixes in vercel target
([#12510](#12510))

- Show `vercel telemetry` subcommand help output
([#12487](#12487))

- [cli] tidy up command config structure `vercel alias`
([#12438](#12438))

- [cli] Use `getAliases` helper in `vercel certs`
([#12489](#12489))

- [cli] separately track integration-resource command
([#12543](#12543))

- [cli] use getAliases helper in vercel env
([#12491](#12491))

- Don't print empty "Examples" section in `--help` output
([#12475](#12475))

- [cli] create standard method for redacted targets
([#12544](#12544))

- [cli] redacting regions until we determine method to get list
([#12553](#12553))

- [cli] use getAliases helper in vercel integration-resource
([#12505](#12505))

- [cli] redact dns records outside allowed types
([#12548](#12548))

- [cli] remove trackCommandError method - unused
([#12546](#12546))

- [cli] derive `vercel alias` subcommand config from subcommand structs
([#12474](#12474))

- [cli] use getAliases in vercel telemetry
([#12509](#12509))

- [cli] use getAliases helper in vercel integration
([#12504](#12504))

- [cli] fix minor issues vercel pull
([#12512](#12512))

- [cli] use getAliases in vercel target
([#12508](#12508))

- Stabilize Chained Prerenders
([#12507](#12507))

- [cli] use subcommandOriginal in telemetry
([#12549](#12549))

- [cli] fix minor issues vercel project
([#12528](#12528))

- Add telemetry to teams list options
([#12440](#12440))

- Misc adjustments for `vercel bisect --help`
([#12478](#12478))

- [cli] redact Extensions
([#12542](#12542))

- fix small issues in telemetry and whoami
([#12468](#12468))

- Make `command` be an implied argument when `subcommands` array is
defined ([#12456](#12456))

- [cli] derive Map of aliases from Command structs
([#12472](#12472))

- [cli] Add aliases field to Command
([#12462](#12462))

- Include "integration" command name in synopsis line in `vercel
integration <subcommand> --help` output
([#12470](#12470))

- Consistent help output for `--next` option
([#12481](#12481))

- Fix `vercel integration-resource` subcommand help
([#12531](#12531))

- Consistent help output for `--limit` option
([#12482](#12482))

- [cli] rename getAliases helper to nonconflicting name
([#12516](#12516))

- [cli] redact unknown archive formats
([#12550](#12550))

- [cli] use getAliases helper in vercel dns
([#12490](#12490))

- [cli] move scope fetching closer to where its used in `vc bisect`
([#12439](#12439))

- [cli] redact output mode in telemetry method
([#12545](#12545))

- [cli] use subcommandOriginal for help telemetry
([#12552](#12552))

- [cli] fix minor issues vercel alias
([#12539](#12539))

- Fix certs issue to allow domain without subdomain
([#12532](#12532))

- Updated dependencies
\[[`03f02e4ae9d3e9c198584acba4231e763d9eb353`](03f02e4),
[`736f322093ebbb31d576609467d80d89ba9dc250`](736f322),
[`80c8ec3634170c1566a5ce62acf560a9d1926d60`](80c8ec3)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Minor Changes

- Add support for HTTP streaming
([#12557](#12557))

## @vercel/[email protected]

### Patch Changes

- Fix basePath root matching for error pages
([#12559](#12559))

- Stabilize Chained Prerenders
([#12507](#12507))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Nov 14, 2024
)

Follow-up to #12557

Python's `HTTPServer` handles requests sequentially, even if we send
multiple requests at the same time. Switch to `ThreadingHTTPServer` to
handle requests concurrently when using streaming.
@Vrejf Vrejf mentioned this pull request Jan 17, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jan 20, 2025
In #12557, we added support for
response streaming to the Python runtime. However, if a user uses an old
Vercel CLI version (either pinned `@vercel/python` version in
`vercel.json`, using an old build cache, using `--prebuilt`...), we need
to make sure we won't apply streaming capabilities to the function.

This PR adds `supportsResponseStreaming: true` to the build output of
`@vercel/python`, which we'll check before applying streaming
capabilities when deploying a project.
QuietCraftsmanship pushed a commit to QuietCraftsmanship/Vercel that referenced this pull request Jul 6, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## [email protected]

### Major Changes

- Migrate `vercel certs` subcommands to their own command specifications
([#12463](vercel/vercel#12463))

- Migrate `vercel dns` subcommands to their own command specifications
([#12464](vercel/vercel#12464))

- Migrate `vercel alias` subcommands to their own command specifications
([#12458](vercel/vercel#12458))

- Migrate `vercel projects` subcommands to their own command
specifications ([#12518](vercel/vercel#12518))

- Migrate `vercel env` subcommands to their own command specifications
([#12476](vercel/vercel#12476))

- Migrate `vercel domains` subcommands to their own command
specifications ([#12526](vercel/vercel#12526))

- Migrate `vercel git` subcommands to their own command specifications
([#12524](vercel/vercel#12524))

- Migrate `vercel teams` subcommands to their own command specifications
([#12496](vercel/vercel#12496))

### Minor Changes

- Migrate `vercel promote` subcommands to their own command
specifications ([#12480](vercel/vercel#12480))

- [cli] add telemetry for `vercel teams switch`
([#12493](vercel/vercel#12493))

- Support `multiple: true` for variadic arguments in Command spec
([#12515](vercel/vercel#12515))

- Migrate `vercel rollback` subcommands to their own command
specifications ([#12519](vercel/vercel#12519))

- [cli] add telemetry for --help flag
([#12430](vercel/vercel#12430))

- Adds "--target" as a new option for the "redeploy" command.
([#12523](vercel/vercel#12523))

- Add strongly typed `subcommands` for Telemetry methods based on
command specification
([#12446](vercel/vercel#12446))

- Migrate `vercel telemetry` subcommands to their own command
specifications ([#12460](vercel/vercel#12460))

- Migrate `vercel target` subcommands to their own command
specifications ([#12477](vercel/vercel#12477))

- [cli] standardize `vercel teams` subcommand routing
([#12473](vercel/vercel#12473))

### Patch Changes

- Don't print empty "Options" section in `--help` output (after
filtering) ([#12479](vercel/vercel#12479))

- [cli] integration resource was always redacted simplify method
([#12547](vercel/vercel#12547))

- [cli] minor fixes in vercel target
([#12510](vercel/vercel#12510))

- Show `vercel telemetry` subcommand help output
([#12487](vercel/vercel#12487))

- [cli] tidy up command config structure `vercel alias`
([#12438](vercel/vercel#12438))

- [cli] Use `getAliases` helper in `vercel certs`
([#12489](vercel/vercel#12489))

- [cli] separately track integration-resource command
([#12543](vercel/vercel#12543))

- [cli] use getAliases helper in vercel env
([#12491](vercel/vercel#12491))

- Don't print empty "Examples" section in `--help` output
([#12475](vercel/vercel#12475))

- [cli] create standard method for redacted targets
([#12544](vercel/vercel#12544))

- [cli] redacting regions until we determine method to get list
([#12553](vercel/vercel#12553))

- [cli] use getAliases helper in vercel integration-resource
([#12505](vercel/vercel#12505))

- [cli] redact dns records outside allowed types
([#12548](vercel/vercel#12548))

- [cli] remove trackCommandError method - unused
([#12546](vercel/vercel#12546))

- [cli] derive `vercel alias` subcommand config from subcommand structs
([#12474](vercel/vercel#12474))

- [cli] use getAliases in vercel telemetry
([#12509](vercel/vercel#12509))

- [cli] use getAliases helper in vercel integration
([#12504](vercel/vercel#12504))

- [cli] fix minor issues vercel pull
([#12512](vercel/vercel#12512))

- [cli] use getAliases in vercel target
([#12508](vercel/vercel#12508))

- Stabilize Chained Prerenders
([#12507](vercel/vercel#12507))

- [cli] use subcommandOriginal in telemetry
([#12549](vercel/vercel#12549))

- [cli] fix minor issues vercel project
([#12528](vercel/vercel#12528))

- Add telemetry to teams list options
([#12440](vercel/vercel#12440))

- Misc adjustments for `vercel bisect --help`
([#12478](vercel/vercel#12478))

- [cli] redact Extensions
([#12542](vercel/vercel#12542))

- fix small issues in telemetry and whoami
([#12468](vercel/vercel#12468))

- Make `command` be an implied argument when `subcommands` array is
defined ([#12456](vercel/vercel#12456))

- [cli] derive Map of aliases from Command structs
([#12472](vercel/vercel#12472))

- [cli] Add aliases field to Command
([#12462](vercel/vercel#12462))

- Include "integration" command name in synopsis line in `vercel
integration <subcommand> --help` output
([#12470](vercel/vercel#12470))

- Consistent help output for `--next` option
([#12481](vercel/vercel#12481))

- Fix `vercel integration-resource` subcommand help
([#12531](vercel/vercel#12531))

- Consistent help output for `--limit` option
([#12482](vercel/vercel#12482))

- [cli] rename getAliases helper to nonconflicting name
([#12516](vercel/vercel#12516))

- [cli] redact unknown archive formats
([#12550](vercel/vercel#12550))

- [cli] use getAliases helper in vercel dns
([#12490](vercel/vercel#12490))

- [cli] move scope fetching closer to where its used in `vc bisect`
([#12439](vercel/vercel#12439))

- [cli] redact output mode in telemetry method
([#12545](vercel/vercel#12545))

- [cli] use subcommandOriginal for help telemetry
([#12552](vercel/vercel#12552))

- [cli] fix minor issues vercel alias
([#12539](vercel/vercel#12539))

- Fix certs issue to allow domain without subdomain
([#12532](vercel/vercel#12532))

- Updated dependencies
\[[`f581d69becc9d431ba65b952fbaa888809f03e97`](vercel/vercel@f581d69),
[`32b19e6b90cb14a9911557f075dddd27725291bf`](vercel/vercel@32b19e6),
[`6b100c84cb8d02b31f9aee98e3ac689963c24ff6`](vercel/vercel@6b100c8)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Minor Changes

- Add support for HTTP streaming
([#12557](vercel/vercel#12557))

## @vercel/[email protected]

### Patch Changes

- Fix basePath root matching for error pages
([#12559](vercel/vercel#12559))

- Stabilize Chained Prerenders
([#12507](vercel/vercel#12507))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
QuietCraftsmanship pushed a commit to QuietCraftsmanship/Vercel that referenced this pull request Jul 6, 2025
…578)

Follow-up to vercel/vercel#12557

Python's `HTTPServer` handles requests sequentially, even if we send
multiple requests at the same time. Switch to `ThreadingHTTPServer` to
handle requests concurrently when using streaming.
QuietCraftsmanship pushed a commit to QuietCraftsmanship/Vercel that referenced this pull request Jul 6, 2025
In vercel/vercel#12557, we added support for
response streaming to the Python runtime. However, if a user uses an old
Vercel CLI version (either pinned `@vercel/python` version in
`vercel.json`, using an old build cache, using `--prebuilt`...), we need
to make sure we won't apply streaming capabilities to the function.

This PR adds `supportsResponseStreaming: true` to the build output of
`@vercel/python`, which we'll check before applying streaming
capabilities when deploying a project.
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.

2 participants