Warnings

The following warnings can be emitted by the Globus SDK to indicate a problem, or a future change, which is not necessarily an error.

class globus_sdk.RemovedInV4Warning[source]

Bases: DeprecationWarning

This warning indicates that a feature or usage was detected which will be unsupported in globus-sdk version 4.

Users are encouraged to resolve these warnings when possible.

By default, Python will not display deprecation warnings to end users, but testing frameworks like pytest will enable deprecation warnings for developers.

Enabling deprecation warnings

By default, Python ignores deprecation warnings, so end users of your application will not see warnings.

However, you may want to enable deprecation warnings to help prepare for coming changes in the Globus SDK. Deprecation warnings can be enabled in several ways:

  1. The PYTHONWARNINGS environment variable

  2. The Python executable -W argument

  3. The Python warnings.filterwarnings() function

The PYTHONWARNINGS environment variable

Deprecation warnings can be enabled using this shell syntax:

# POSIX shell example
export PYTHONWARNINGS="error::DeprecationWarning"
python ...

# Inline example
PYTHONWARNINGS="error::DeprecationWarning" python ...
# Powershell example
$env:PYTHONWARNINGS="error::DeprecationWarning"
python ...

The Python executable -W argument

Deprecation warnings can be enabled using this Python executable argument:

python -W "error::DeprecationWarning" ...

The Python warnings.filterwarnings() function

Deprecation warnings can be enabled in Python code:

import warnings

warnings.filterwarnings("error", category=DeprecationWarning)

Disabling deprecation warnings

Python testing frameworks like pytest enable deprecation warnings by default. Deprecation warnings can be disabled in several ways:

  1. The PYTHONWARNINGS environment variable

  2. The pytest executable -W argument

  3. The pytest.ini (or similar) file

The PYTHONWARNINGS environment variable

You can disable deprecation warnings using environment variables:

# POSIX shell example
export PYTHONWARNINGS="ignore::DeprecationWarning"
pytest ...

# Inline example
PYTHONWARNINGS="ignore::DeprecationWarning" pytest ...
# Powershell example
$env:PYTHONWARNINGS="ignore::DeprecationWarning"
pytest ...

The pytest executable -W argument

You can disable deprecation warnings using pytest’s -W argument:

pytest -W "ignore::DeprecationWarning" ...

The pytest.ini (or similar) file

You can disable warnings using a pytest configuration file like pytest.ini:

[pytest]
filterwarnings =
    ignore::DeprecationWarning