Skip to content

Lazy proxy dict #1

Description

@jankatins

[Continuing the conversation from https://twitter.com/scopatz/status/756544618964004868]

I've built a LazyProxyDict which fetches values on first access. It's only lazy but not self-destructive. Does that still fit?

Isn't this basically LazyDict?

Tried that first, but a) the parent place isn't fixed (assigned to a trait) and b) values is an os.environ, so unknown keys...

For (a) I think if we had the context passed in as None, we could disable it, (b) I don't understand, where is the usage site?

Usage is in the environment kernel manager: It activates a conda env to get the environment variables (mostly for the altered PATH element, but I guess there could be others as well) and passes that on to the notebook server to use as a new environment variables for the started kernel. Before using the lazy proxy, starting up a notebook server took a lot of seconds (and the notebook page showed nothing) due to activating all envs which I had installed. Now it's as fast as usual and the activate only happens when the kernel is used for the first time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions