Skip to content
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

enhancement env var for extra_template_basedirs #2028

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ndmlny-qs
Copy link

This commit add the following three items.

  • Updates the method _default_extra_template_basedirs in the module templateexporter.py to search for a new environment variable called NBCONVERT_EXTRA_TEMPLATE_BASEDIRS. This environment variable will be added to the basedirs list if it is found, and it exists.
  • Updates the tests to ensure if the new environment variable exists then it is included in the TemplateExporter.template_paths.
  • Adds a context manager method that modifies the os.environ dictionary.

Closes #2026

This commit add the following three items.

- Updates the method `_default_extra_template_basedirs` in the module
  `templateexporter.py` to search for a new environment variable called
  `NBCONVERT_EXTRA_TEMPLATE_BASEDIRS`. This environment variable will be
  added to the basedirs list if it is found, and it exists.
- Updates the tests to ensure if the new environment variable exists
  then it is included in the `TemplateExporter.template_paths`.
- Adds a context manager method that modifies the `os.environ`
  dictionary.

Closes jupyter#2026
@ndmlny-qs ndmlny-qs changed the title env var for extra_template_basedirs enhancement env var for extra_template_basedirs Aug 3, 2023
@ndmlny-qs
Copy link
Author

@Carreau let me know if you'd like additional items added or any changes or more tests. Thanks!

@Carreau
Copy link
Member

Carreau commented Aug 10, 2023

I have two worries:

  1. extra_template_basedirs is already a convenience config on top of extra_template_paths
  2. we're modifying the default value, so if someone also use CLI or config file there will likely be conficts/unexpected behavior.

Let me think about it a bit.

@Carreau
Copy link
Member

Carreau commented Aug 10, 2023

I've posted a followup in #2026 as I'd like to better understand the use case.
I'd like to avoid one-off patches if we can have a general one, and I think the use case is already covered by how traitlets can be configured, so just checking why and seeing if we can offer a more generic solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Env variable for extra_template_basedirs
2 participants