Open jakirkham opened 1 year ago
cc @jezdez @wolfv (as we briefly discussed this at today's community call)
It's worth noting there may already be a basis for building this kind of functionality using existing package metadata ( https://github.com/conda/conda/issues/6820#issuecomment-1269581626 ). That said, there is a bug we'd likely want to fix as part of that work ( https://github.com/conda/conda/issues/11726 )
Hi there, thank you for your contribution!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.
If you would like this issue to remain open please:
NOTE: If this issue was closed prematurely, please leave a comment.
Thanks!
(not stale)
Checklist
What is the idea?
Much like we have
script_env
to pass or set environment variables into the package build process, it would be handy to have arun_env
(or similar) to allow setting environment variables during package activation. This could handle backup environment variables and restoring them in a uniform way.Some other things we might consider:
PATH
)Why is this needed?
Many (de)activation scripts do little more than (un)set environment variables. For example here are some (de)activation scripts from conda-forge that mainly manage environment variables. While there can be the occasional (de)activate script that does a bit more (like prepend/append to the
PATH
or run some code). Most (de)activation scripts don't need this.Despite this relatively simple use case (de)activation scripts can wind up becoming quite complicated as they may need to check if a variable is already set before setting it and keep backups of environment variables, which they then need to restore later. As a result of this complexity, relatively simple shell scripts end up with bash-ism or other shell specific behavior making them non-portable ( https://github.com/conda-forge/r-base-feedstock/issues/221 ). This in turn leads to maintenance complexity ( https://github.com/conda/conda-build/issues/3880 ) ( https://github.com/conda/conda-build/issues/4012 ) ( https://github.com/conda/conda/issues/7993 ).
Providing a simple path to set environment variables in a platform and shell agnostic manner would go a long way towards eliminating these kind of pain points before they show up.
What should happen?
No response
Additional Context
No response