theskumar / theskumar/python-dotenv

Do you plan to call os.path.expandvars?

Aperta
#459 0 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

I request to be able to fill in the environment variable name by calling os.path.environmentvars when setting the value in main.py#L98.

An environment variable name is, for example, %TEMP% (in Windows).

[.env]
LOG_DIR=%TEMP%\log

If possible, it would be nice if it could be called recursively. os.path.expandvars will only expand the environment variable name once.

def expandvarsRecursive(value):.
    expanded = os.path.expandvars(value)
    return value if expanded == value else expandvarsRecursive(expanded)

The reason for this is that if it is called recursively, we don't have to keep track of the same values.

[.env]
PROJECT_HOME=C:\project
LOG_DIR=%PROJECT_HOME%\log
TRACE_LOG_DIR=%LOG_DIR%\trace

Please consider this.

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 in src/dotenv/main.py around line 98 and trace how values from .env files are expanded. Check how Windows-style variables and recursive references should behave, then verify the LOG_DIR and TRACE_LOG_DIR examples resolve as requested. No linked tests or further maintainer guidance are provided.

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

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.