theskumar / theskumar/python-dotenv

Illustrate usage as a pre-commit hook additional dependency

オープン
#484 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
8.9k
フォーク
581
PR マージ指標
30日以内にマージされた PR はありません

説明

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:

# .pre-commit-config.yaml
---
repos:
  - repo: ...
    rev: ...
    hooks:
      - id: ...
        entry: dotenv run -- ...
        additional_dependencies: ["python-dotenv[cli]"]

This expects that:

  • 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)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Open README.md and find the Other Use Cases section. Review the pre-commit additional_dependencies and Python hook behavior described in the issue, then add the provided usage example if it fits the project documentation. Done means the README clearly explains this pre-commit configuration without any source-code changes.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
50/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。