Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

AmbiguousEnvVar when setting default runner.env with both lower and uppercase

Aperta
#932 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Reproduce the failure using invoke.yml and tasks.py, or the Python configuration shown, then run the @invoke.task function through ctx.run('env && exit 1'). Trace the environment handling involved in RUN_ENV_NO_PROXY and verify that configuring both uppercase and lowercase variants no longer raises AmbiguousEnvVar while preserving the configured values.

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

Descrizione

Hi,

I think I discovered an issue with the environment system, you can't set default environment variables with both upper and lowercase variants, like for HTTP_PROXY:

import invoke

ns = invoke.Collection()
ns.configure(dict(
    run=dict(
        echo=True,
        env={
            **{
                env_name: "http://my-proxy/"
                for env_name in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY")
            },
            **{
                env_name: "localhost" for env_name in ("no_proxy", "NO_PROXY")
            }
        }
    )
))

@invoke.task
def test(ctx):
    ctx.run('env && exit 1')

ns.add_task(test, "test")

This is also true with the following:

invoke.yml

run:
  env:
    HTTP_PROXY: 1
    http_proxy: 1

tasks.py

import invoke

@invoke.task
def test(ctx):
    ctx.run('env && exit 1')
inv test
[..]
invoke.exceptions.AmbiguousEnvVar: Found >1 source for RUN_ENV_NO_PROXY

I guess only keys with the invoke prefix or only external (not set in config) environment variables should be analyzed? RUN_ENV_ subkeys should be analyzed without case modification?

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Altre issue di pyinvoke/invoke

Tutte le issue di pyinvoke/invoke

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.