GumpacG opened a new pull request, #3469: URL: https://github.com/apache/tinkerpop/pull/3469
# Standardize `gremlin-python` connection options Implements the Python portion of the TinkerPop 4.x GLV connection-options standardization. Renames two options to canonical names (old names kept as deprecated aliases), adds a set of new options, removes two, and raises the minimum `aiohttp` floor. Python driver changes only; the other GLVs follow in separate PRs. **Proposal:** https://lists.apache.org/thread/yqtr2wnb1kq2pqqq4002cz511q5o0bkg ## Renames (deprecated aliases retained) | Old | New | Default | | ------------- | ----------------- | ------------ | | `pool_size` | `max_connections` | 128 (was 8) | | `ssl_options` | `ssl` | - | The old names still work but emit a `DeprecationWarning` (marked "As of release 4.0.0, ...") and should be migrated. `max_connections` is now also applied to the aiohttp `TCPConnector` `limit`, so the transport layer reflects the option in addition to sizing the connection pool. ## Behavior changes (breaking) * **`compression`** is a new option defaulting to `'deflate'` (on); the driver advertises `Accept-Encoding: deflate` by default. Set `compression='none'` to disable, which also suppresses aiohttp's automatic `Accept-Encoding` injection so compression is not silently negotiated. Defaulting on is a deliberate deviation from the proposal's agreed default-off, applied consistently across the GLVs by later agreement. * **`connect_timeout`** defaults to 5s. Combined with the existing `read_timeout`, it is wired into a single aiohttp `ClientTimeout` via the socket-level `sock_connect`/`sock_read` knobs (not a whole-request `total`), so long but legitimate streaming responses are not aborted while a stalled server no longer hangs forever. * The minimum supported **`aiohttp`** is raised to `3.11` (required for the `socket_factory` used by `keep_alive_time`). ## New options * **`connect_timeout`** (5s) - socket-connect timeout (the existing `read_timeout` was rewired into the unified `ClientTimeout`). * **`idle_timeout`** (180s) - mapped to the aiohttp `TCPConnector` keep-alive timeout. * **`keep_alive_time`** (30s) - enables TCP keep-alive probes via the connector socket factory (`TCP_KEEPIDLE`/`TCP_KEEPALIVE`, guarded by platform availability). * **`compression`** (`'none'`/`'deflate'`, default `'deflate'`) - the wire compression negotiated with the server. * **`default_batch_size`** (64) - connection-level default that fills the per-request `batchSize` when unset. * **`proxy`** and **`trust_env`** - explicit HTTP proxy and environment-trust options for the aiohttp transport. * **`auth.sigv4`** gains a credentials-provider variant accepting an optional credentials provider or callable, falling back to the AWS environment variables. ## Removed (breaking) * **`max_content_length`** - previously accepted but discarded. * **`headers`** kwarg on `Client`/`DriverRemoteConnection` - custom headers must now be set via an interceptor. ## Bug fix * Fixed `Client.submit`/`submit_async` mutating a caller-supplied `RequestMessage` in place; the message fields are now cloned before applying `request_options`/`default_batch_size`, so resubmitting the same message no longer accumulates state (matching the no-mutate contract of the .NET/JS drivers). This is required for the new `default_batch_size` to fill safely. ## Testing * `gremlin-python` unit tests pass, including new `test_client_options`, `test_connection_options`, and `test_transport_compression` suites. The compression suite uses an in-process aiohttp loopback server to verify real `Accept-Encoding` negotiation and transparent deflate decompression over a socket. * CHANGELOG, reference config table (`gremlin-variants.asciidoc`), and upgrade guide (`release-4.x.x.asciidoc`) updated for the Python slice. ## Notes * The minimum `aiohttp` is raised from `3.8` to `3.11` (`pyproject.toml`). This is a dependency-floor bump, required for the `TCPConnector(socket_factory=...)` API that backs `keep_alive_time`; users pinned to `aiohttp` 3.8-3.10 must upgrade. Assisted-by: Kiro: Claude Opus 4.8 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
