theskumar / theskumar/python-dotenv

Feature Request: Unloading function unload_dotenv()

Aperta
#594 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
8.9k
Fork
581
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Once load_dotenv() has run, variables are set. To remove them again for unit testing, I need a function, because tests should be independent. I coded this function already, but I think it would be nice to have it included in dotenv. I guess, I'm not the only one with the described problem. But maybe I'm wrong. I stepped over this more than once now. That's why I'm suggesting adding this function:

def unload_dotenv():
    """Remove all dotenv variables from environment."""

    dotenv_vars = set(dotenv_values().keys())
    for key in dotenv_vars:
        os.environ.pop(key, None)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Start by locating the existing load_dotenv() and dotenv_values() entry points and their tests. Check how dotenv-loaded variables are identified and verify that the proposed unload_dotenv() behavior is covered, including removing variables without affecting unrelated environment variables.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.