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

Add ability to declare default values for env vars in pyproject.toml #30

Merged
merged 1 commit into from
Jun 13, 2021

Conversation

nat-n
Copy link
Owner

@nat-n nat-n commented Jun 5, 2021

This is something I found necessary for my own use case. It allows similar semantics to ?= variable assignment in make.

Setting an env var to a table with key default means the variable will only be set if not already provided by a lower precedence source such as the host shell or an env file. e.g.

[tool.poe.env]
PORT.default = "9001"

This PR build on top of #29

Documentation done, feature test TODO.

@nat-n nat-n force-pushed the feature/env_default branch from b172b1f to 5a022d6 Compare June 5, 2021 20:42
@nat-n nat-n force-pushed the feature/envfile branch 4 times, most recently from 26b34e0 to 5bd5b01 Compare June 12, 2021 22:00
@nat-n nat-n changed the base branch from feature/envfile to development June 13, 2021 18:28
@nat-n nat-n force-pushed the feature/env_default branch 2 times, most recently from 56153b1 to b6b1765 Compare June 13, 2021 21:02
For example setting:

[tool.poe.env]
PORT.default = "9000"

Will set the PORT variable on the environment, only if it isn't already set.

Also replace dependency on more lightweight a complete toml parser: tomli
@nat-n nat-n force-pushed the feature/env_default branch from b6b1765 to c482179 Compare June 13, 2021 21:09
@nat-n nat-n merged commit 985b1cc into development Jun 13, 2021
@nat-n nat-n deleted the feature/env_default branch June 13, 2021 21:16
ThatXliner pushed a commit to ThatXliner/poethepoet that referenced this pull request Dec 24, 2021
…at-n#30)

For example setting:

[tool.poe.env]
PORT.default = "9000"

Will set the PORT variable on the environment, only if it isn't already set.

Also replace dependency on more lightweight a complete toml parser: tomli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant