Skip to content

Upgrading Services

This guide covers the steps to modify an existing service so that it works with Nameko 3.

Generally only three areas are affected:

  1. Reading config inside service code.
  2. Reading config inside tests.
  3. Using a custom runner.

Using config inside service code

Optional — Use the global config object rather than Config dependency provider

The built-in Config dependency provider from nameko.dependency_providers has been deprecate. You should instead use the nameko.config global.

Optional — Use the global config object to simplify service setup

The global is available at all stages of the service lifecycle, including import time, which can make it much simpler to configure services.

Required ⚠ — Don’t pass config to ServiceRpcProxy or ClusterRpcProxy

If you are using these standlone RPC clients from the nameko.standalone package, note that they no longer accept config as a parameter.

You must set up config in the global context before using them, for example with nameko.config.patch.

Also note that these have been renamed from:

  • ClusterRpcProxy –> ClusterRpcClient
  • ServiceRpcProxy –> ServiceRpcClient

The old names are preserved for backwards compatibility.

Using config inside tests

Required ⚠ — Read global config rather than any of the x_config fixtures

There is a breaking change to the way that the rabbit_config, test_config and empty_config fixtures work. They no longer return the config dictionary.

If you are using one of these fixtures, see the recommended pattern in the detailed breakdown of these configuration changes.

Optional — Don’t pass config to container_factory or runner_factory.

If you are using these pytest fixtures, note that the config argument is now deprecated.

See the detailed breakdown of these changes for more information.

Using a custom runner

Required ⚠ — Don’t pass config to ServiceContainer or ServiceRunner

In Nameko 3, the ServiceContainer and ServiceRunner classes do not accept a config argument anymore. If you are programmatically creating a service runner, rather than using nameko run in the CLI, you must set up config in the global context before using them, for example with nameko.config.patch.

See the detailed breakdown of these changes for more information.