You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an extremely helpful tool that can be used in loads of contexts!
One context that I've been using it in is as an additional dependency for pre-commit hooks where the hook(s) require environment variables to be defined.
Since pre-commit is a popular tool and setting environment variables for it isn't super obvious (hence lots of the feature requests, such as pre-commit#758), python-dotenv can help with a lot of the headache for Python-based hooks.
I don't expect this to be implemented since it still leaves a fair bit for the user to figure out (and it might be an inappropriate coupling), but on the off chance that this might be useful for other people, I'll add additional details below.
The hook action that the user wants to expose environment variables to is configured with language: python
The user configuring their pre-commit file has replaced the ellipses ... with actual values (which assumes they know how to override the entry property)
The text was updated successfully, but these errors were encountered:
Bilbottom
changed the title
Illustrate usage as a pre-commit hook
Illustrate usage as a pre-commit hook additional dependency
Sep 24, 2023
Summary (documentation)
This is an extremely helpful tool that can be used in loads of contexts!
One context that I've been using it in is as an additional dependency for pre-commit hooks where the hook(s) require environment variables to be defined.
Since pre-commit is a popular tool and setting environment variables for it isn't super obvious (hence lots of the feature requests, such as pre-commit#758), python-dotenv can help with a lot of the headache for Python-based hooks.
I don't expect this to be implemented since it still leaves a fair bit for the user to figure out (and it might be an inappropriate coupling), but on the off chance that this might be useful for other people, I'll add additional details below.
Details
Assuming that this is an appropriate way to use pre-commit and python-dotenv together, it would be awesome to see this documented in the Other Use Cases section of the README.md.
Note that this would not require any source code changes: python-dotenv would just be a dependency for other, already established hooks.
A minimal template for using python-dotenv in this way is:
This expects that:
language: python
...
with actual values (which assumes they know how to override theentry
property)The text was updated successfully, but these errors were encountered: