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

Allow environment variables to set CLI defaults #755

Merged
merged 5 commits into from
May 10, 2024
Merged

Allow environment variables to set CLI defaults #755

merged 5 commits into from
May 10, 2024

Conversation

bittner
Copy link
Contributor

@bittner bittner commented Mar 30, 2024

Adds a few environment variable getters that allow to override the default value of some CLI options.

Fixes #754

@bittner
Copy link
Contributor Author

bittner commented Mar 30, 2024

@woodruffw I've not yet covered documenting the environment variables. Not sure what the best way would be to do it. A multi-line explanation in argparse.ArgumentParser(description) could be one possibility doesn't work.

@woodruffw woodruffw added the component:cli CLI components label Mar 30, 2024
test/test_cli.py Outdated Show resolved Hide resolved
@woodruffw
Copy link
Member

Thanks @bittner, this looks like a great initial set!

I've not yet covered documenting the environment variables. Not sure what the best way would be to do it.

Hmm, IMO it'd be fine to document it in the README alone, i.e. under the "Usage" section in a new sub-section above the "Exit codes" one: https://github.com/pypa/pip-audit?tab=readme-ov-file#exit-codes

(A short explainer that some flags honor the environment + a bullet list of each of them would be perfect.)

@woodruffw woodruffw added the needs-response Needs response from the reporter. label Apr 8, 2024
@woodruffw woodruffw self-assigned this May 10, 2024
@woodruffw woodruffw removed the needs-response Needs response from the reporter. label May 10, 2024
Signed-off-by: William Woodruff <[email protected]>
@woodruffw woodruffw added the enhancement New feature or request label May 10, 2024
@woodruffw woodruffw enabled auto-merge (squash) May 10, 2024 15:23
@woodruffw woodruffw merged commit 81bcdf1 into pypa:main May 10, 2024
7 checks passed
@bittner bittner deleted the feature/environment-variables branch October 18, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:cli CLI components enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide environment variables for CLI option defaults
2 participants