{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "An isolated singleton registry, activated for a dynamic extent."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "While active ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "with scope():"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "SingletonConfigurable.instance",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "traitlets.config.configurable:SingletonConfigurable.instance"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " on any subclass of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "base"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " resolves within this registry — creating fresh instances on first use — in the current thread/async task. Re-enterable: the registry persists across activations."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "warning",
          "base_type": "warning",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "warning "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "The scope lives in a "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "ContextVar",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "_contextvars",
                    "version": "?",
                    "kind": "module",
                    "path": "_contextvars:ContextVar"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ". On builds where "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "sys.flags.thread_inherit_context",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "sys",
                    "version": "?",
                    "kind": "module",
                    "path": "sys:flags.thread_inherit_context"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " is enabled — the default on the free-threaded build (e.g. "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "3.14t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ") — a "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "threading.Thread",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "threading",
                    "version": "?",
                    "kind": "module",
                    "path": "threading:Thread"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " started while the scope is active inherits a copy of the parent context and resolves "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": ".instance()"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " within the scope instead of the process-global registry. Activating a scope under that flag emits a "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "RuntimeWarning",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "builtins",
                    "version": "?",
                    "kind": "module",
                    "path": "builtins:RuntimeWarning"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ". For per-thread isolation, activate a fresh scope inside each thread rather than relying on non-inheritance."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Scope "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SingletonConfigurable"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " itself for a complete blank slate covering every singleton in the process."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 5.17"
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/traitlets/config/configurable.py",
  "item_line": 548,
  "item_type": "class",
  "aliases": [
    "traitlets.config.SingletonScope"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "base",
        "annotation": "type[SingletonConfigurable]",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": "None",
    "target_name": "SingletonScope"
  },
  "references": null,
  "qa": "traitlets.config.configurable:SingletonScope",
  "arbitrary": [],
  "local_refs": []
}