---
title: "Python SDK v.1.6.0"
description: "This release improves workflow management: safe eviction, customizable failure types. Adds HTTP CONNECT proxy support, worker client replacement, API key option. Float-based metrics, counting workflows optimized. LogRecord changes for better compatibility."
canonical: "https://temporal.io/changelog/python-sdk-v-1-6-0.md"
source: "https://temporal.io/changelog/python-sdk-v-1-6-0"
date: "2024-05-07"
product_areas:
  - "Python SDK"
---

# Python SDK v.1.6.0

Get from [PyPI](https://pypi.org/project/temporalio/)

## Highlights

### Safe Eviction

The internal eviction logic has been overhauled to make sure that asyncio tasks are completed before a workflow is removed from the cache and garbage collected. For all properly running workflows this should not cause any issues. However, workflows that may have been developed in invalid ways in the past could have a problem being evicted from cache and will log as such. Users should keep an eye out for logs when upgrading to this version.

### Experimental Workflow Failure Type Customization

When a workflow raises an exception that wasn't `ApplicationError`or bubbled from a Temporal call (e.g. activity failure), it would be a "task failure" which puts the workflow in a suspended state retrying the task until a code fix is deployed. An experimental feature is now available that lets users set which exception types should instead fail the workflow instead of suspending it. Users can now set the per-workflow `failure_exception_types`on the `@workflow.defn`decorator or set the worker-level `workflow_failure_exception_types`when creating the `Worker`. If an exception extends from one of these when raised, it will fail the workflow when raised.

### HTTP CONNECT Proxy Support

Python clients now officially support HTTP CONNECT proxies. The `http_connect_proxy_config`argument can now be set when connecting a `Client`.

### Worker Client Replacement

Workers can now have the client they use replaced without shutting down the worker. The `client`property on the `Worker`can be set to a different connected client. This is useful for users that need to change options like mTLS client certificate without worker downtime. The worker will not interrupt any polling calls but will start using the new client for subsequent calls.

### API Key Client Option

If you use API keys in your Temporal server (i.e. `Bearer`tokens on `Authorization`headers), you can now set `api_key`when connecting a `Client`or set the `api_key`property on an existing client to update it.

### Floats and Durations in Metrics

Users using `metric_meter()`directly to create metrics (off of runtime, activity, or workflow) can now create float-based histograms and gauges, and duration-based histograms. Similarly users using `MetricBuffer`to retrieve metrics can say how they want to retrieve durations (float seconds, int milliseconds, or `timedelta`). A `durations_as_seconds`option was added to telemetry options for users that prefer seconds as float-based durations to OpenTelemetry and Prometheus instead of the default of integer milliseconds.

### Counting Workflows

A new `count_workflows`call has been added to the `Client`that takes the same query as `list_workflows`but is optimized just to perform counts.

### 💥 Activity/Workflow `extra`on `LogRecord`Changed

Activity logs and workflow logs used to set `activity_info`and `workflow_info`on `LogRecord`respectively as the full info dataclasses by default. This was not usable by many third-party logging tools that can only work with `dict`s and not `dataclass`es. Therefore the default was changed to set `temporal_activity`and `temporal_workflow`on the respective log records to `dict`s of commonly needed information. `temporalio.activity.logger.full_activity_info_on_extra`and/or `temporalio.workflow.logger.full_workflow_info_on_extra`can be set to `True`to put those info entries back on `extra`.

This only affects those using advanced log handlers that leverage contextual state. The log messages themselves are unaffected.

## Specific Changes

2024-03-04 - [477aa31](https://github.com/temporalio/sdk-python/commit/477aa31afeae65a0d0facb8a85662736168dba23) - Fix execute\_child\_workflow apidoc ([#483](https://github.com/temporalio/sdk-python/pull/483))
2024-03-13 - [f3d1b85](https://github.com/temporalio/sdk-python/commit/f3d1b8511a3ef33b36fa806a9fc56f96a4a70b84) - API key client option ([#486](https://github.com/temporalio/sdk-python/pull/486))
2024-03-26 - [36fe961](https://github.com/temporalio/sdk-python/commit/36fe9613891618ef6c86d1c8f0109e1e2084d55d) - Remove experimental flag from start\_delay ([#492](https://github.com/temporalio/sdk-python/pull/492))
2024-04-01 - [13d18ca](https://github.com/temporalio/sdk-python/commit/13d18ca7ae590e1fa1026f20829322db38f0b898) - Update core and add durations-as-seconds metric option ([#498](https://github.com/temporalio/sdk-python/pull/498))
2024-04-02 - [b07e75e](https://github.com/temporalio/sdk-python/commit/b07e75ee124c7d5e7bf1fc5e587963549189cca6) - Change default "extra" contents of activity/workflow logs ([#490](https://github.com/temporalio/sdk-python/pull/490))
2024-04-05 - [1001653](https://github.com/temporalio/sdk-python/commit/1001653280235f73afd61a3cc4cc5fe9d3521504) - HTTP CONNECT proxy support ([#501](https://github.com/temporalio/sdk-python/pull/501))
2024-04-05 - [466da16](https://github.com/temporalio/sdk-python/commit/466da16f98cd980fb988915813d2f929a84a6bbf) - Safe Eviction ([#499](https://github.com/temporalio/sdk-python/pull/499))
2024-04-12 - [b45447e](https://github.com/temporalio/sdk-python/commit/b45447e271b078189adb449c50888fa41375b6b4) - Add macOS ARM runner ([#506](https://github.com/temporalio/sdk-python/pull/506))
2024-04-12 - [cf4c7cb](https://github.com/temporalio/sdk-python/commit/cf4c7cbff5553b3187226a7d92903d2094c59d31) - Ensure extra data on task fail logs ([#502](https://github.com/temporalio/sdk-python/pull/502))
2024-04-18 - [50c2033](https://github.com/temporalio/sdk-python/commit/50c20334295223bae12ba71c8410a0557149da34) - Support float and duration metrics ([#508](https://github.com/temporalio/sdk-python/pull/508))
2024-04-19 - [ecd703d](https://github.com/temporalio/sdk-python/commit/ecd703dc8fce1ad4aaf9ecbeac4714b077db69ba) - Add Client.count\_workflows ([#510](https://github.com/temporalio/sdk-python/pull/510))
2024-04-30 - [0bb94f8](https://github.com/temporalio/sdk-python/commit/0bb94f84b1d2a1f3f25471df707eaf92a077a449) - Ability for certain task failure types to fail workflow ([#516](https://github.com/temporalio/sdk-python/pull/516))
2024-05-03 - [0687151](https://github.com/temporalio/sdk-python/commit/068715138a9813335756fa530cc49bd8c548b1cd) - Worker client replacement ([#517](https://github.com/temporalio/sdk-python/pull/517))

- [Release notes](https://github.com/temporalio/sdk-python/releases/tag/1.6.0)
