-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
feat: set project root env #3072
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Why not just inject the env into the pdm/src/pdm/cli/commands/run.py Line 258 in 61657a4
You won't contaminate the global_options in this way. |
Oh, the project root is already exposed via pdm/src/pdm/environments/base.py Line 80 in c190e14
If no objection, i will close this PR. |
Yeah, I may try this approach instead
I didn't knew about But, while invoking directly a script I see that
[tool.pdm.scripts]
_.env_file = ".env"
var1 = { shell = "echo $VAR1" }
var2 = { shell = "echo $VAR2" }
var3 = { shell = "echo $PDM_PROJECT_ROOT" }
VAR1 = "VAL1"
VAR2 = "VAR1=${VAR1}; USER=${USER}; PDM_PROJECT_ROOT=${PDM_PROJECT_ROOT};"
$ pdm run var1
VAL1
$ pdm run var2
VAR1=VAL1; USER=<my username>; PDM_PROJECT_ROOT=;
$ pdm run var3
<current directory
$ it seems that the definition of the Do you think it would be possible to move the |
Not only that, all additional env vars are not injected into |
This is superseded by #3087 thanks anyway |
thanks to you for the update! |
Pull Request Checklist
news/
describing what is new.Describe what you have changed in this PR.
Expose
PROJECT_ROOT
as an env variable during script runsfixes #2993