Skip to content

Instantly share code, notes, and snippets.

@PatrykGala
Last active September 26, 2024 18:25
Show Gist options
  • Save PatrykGala/b2ab8eec064199f61ee0c60e41139755 to your computer and use it in GitHub Desktop.
Save PatrykGala/b2ab8eec064199f61ee0c60e41139755 to your computer and use it in GitHub Desktop.

Update: Upcoming Plan to Deprecate Bravado

jsonschema.RefResolver deprecation warnings can be safely ignored, as they don’t impact Neptune’s operation.

  • neptune-client uses bravado, which imports jsonschema.
  • jsonschema.RefResolver is imported but not used because we disabled Swagger file validation.
  • Swagger file validation is not necessary and is a cpu-intensive operation.

Future Plans

  • We plan to release neptune-client 2.0 without bravado in the future.
  • Until jsonschema.RefResolver is removed from jsonschema, we won’t be making any changes to the 1.x client.
  • Our focus is on developing neptune-client 2.0 to deliver a fully enhanced neptune-client.

Findings

Import Order Affects Warnings

When importing libraries in this order:

import torchrl
import neptune

Several deprecation warnings appear, related to jsonschema.RefResolver:

/core/.venv/lib/python3.10/site-packages/swagger_spec_validator/validator12.py:18: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.
  from jsonschema import RefResolver

However, changing the import order eliminates these warnings:

import neptune
import torchrl

Deprecation Warnings in Python

By default, deprecation warnings are disabled in Python:

import warnings
warnings.filters
# Output includes: ('ignore', None, <class 'DeprecationWarning'>, None, 0)

torchrl enables deprecation warnings with this code:

RL_WARNINGS = strtobool(os.environ.get("RL_WARNINGS", "1"))
if RL_WARNINGS:
    warnings.simplefilter("once", DeprecationWarning)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment