Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

feature request: a way to support nested dict input

Offen
#401 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
cli

Rechercherichtung

Beginne damit, das Parsing von Befehlszeilenargumenten in Python Fire und die bestehende Behandlung von kwargs nachzuverfolgen; im Issue werden keine Dateien oder Tests genannt. Vergleiche die vorgeschlagenen dotted-key- und JSON-Formen und lege dann fest, welche Eingabeformen und daraus resultierenden verschachtelten Dictionaries unterstützt werden sollten, bevor du die erforderlichen Tests identifizierst, die den Abschluss nachweisen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement

Background

Hi, I just come into a case that need to allow user to override some default value of a json configuration. The configuration is a nested dict and so is the input. I didn't find fire has good support for such case so here is a proposal.

Feature

Take this as an example

def my_command(config: dict):
  ...

I think fire may support such input to build the actual value of config

my_command --config.pos.x=20 --config.pos.y=10
# or
my_command --config.pos='{"x": 20, "y":10}'
# or
my_command --config='{"pos": {"x": 20, "y":10}}'

And both will end up with the following dict

{
  "pos": { "x": 20, "y": 10}
}

The beauty of this design can avoid a lot of unecessary " and {} (and you need to pair them correctly) input of a JSON data. It's less error prone and comforable to use this style in command line. Currently I can handle this via kwargs, but I think it would be nice to have native support.

Vorherrschende Sprache
Python
Sterne
28.2k
Forks
1.5k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus google/python-fire

Alle Issues in google/python-fire

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.