Skip to content

Provide an API to return the custom environments variables #20621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DonJayamanne opened this issue Feb 1, 2023 · 2 comments
Closed

Provide an API to return the custom environments variables #20621

DonJayamanne opened this issue Feb 1, 2023 · 2 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality info-needed Issue requires more information from poster needs proposal Need to make some design decisions partner ask

Comments

@DonJayamanne
Copy link

DonJayamanne commented Feb 1, 2023

The current API getEnvironmentVariables does not return just the custom variables, it returns the resolved environment variables. My assumption was that this returns just the custom env variables.

The Jupyter extension needs a way to get just the custom env variables (not all of the env variables from the process)
E.g. if there is no .env file, then undefined would be returned, if there is just one env variable in the env file, then we get back a JS object with just that key and the corresopnding value.
This is required as we need to merge these with the activated environment variables

E.g.g assume we want to run Python, then we get the activated env variables for an env, then we merge that with the custom env variables. However this is no longer possible as the custom env variables contains everything (as I assumed the api would return only the custom vars).

The merging needs to happen in Jupyter extension as users could have a kernel spec that has custom env variables as well,
& the Jupyter extension today merges the env variables from the following 3 sources:

  • Python Env
  • Kernel Env
  • .env file

Happy to have a chat about this.

@DonJayamanne DonJayamanne added the feature-request Request for new features or functionality label Feb 1, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 1, 2023
@DonJayamanne DonJayamanne reopened this Feb 1, 2023
@karthiknadig karthiknadig added needs proposal Need to make some design decisions partner ask area-environments Features relating to handling interpreter environments and removed triage-needed Needs assignment to the proper sub-team labels Feb 2, 2023
@karrtikr karrtikr added the triage-needed Needs assignment to the proper sub-team label Feb 2, 2023
@karrtikr
Copy link

karrtikr commented Feb 2, 2023

getEnvironmentVariables returns a merge of process env vars and custom vars as you stated.

This is required as we need to merge these with the activated environment variables

Activated environment variables (assuming you get this from the Python extension) already contains both the process env and custom vars as well, as acquiring it requires printing all env vars anyways. So explicit merge with .env file isn't even required.

Lastly, we're not sure why merge cannot happen even if the list of env vars contain everything, can you clarify?

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Feb 2, 2023
@DonJayamanne
Copy link
Author

Activated environment variables (assuming you get this from the Python extension) already contains both the process env and custom vars as well, as acquiring it requires printing all env vars anyways. So explicit merge with .env file isn't even required.

Thanks that addresses one problem

Thanks I think I can work with this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2023
@eleanorjboyd eleanorjboyd removed the triage-needed Needs assignment to the proper sub-team label Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality info-needed Issue requires more information from poster needs proposal Need to make some design decisions partner ask
Projects
None yet
Development

No branches or pull requests

4 participants