GenericMappingTools / GenericMappingTools/pygmt

Resetting default GMT parameters - pygmt.config

Offen
#486 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature request help wanted longterm upstream
Vorherrschende Sprache
Python
Sterne
874
Forks
255
Ø Merge
1 T. 21 Std.
Gemergte PRs (30 T.)
40

Beschreibung

**Description of the desired feature**

The `pygmt.config` class/context manager allows the user to permanently or temporarily override default GMT config parameters. If a parameter is set permanently (particularly in a notebook), it would be useful to be able to reset back to the default without having to reset the kernel / use `pygmt.config` as a context manager. Motivated by https://github.com/GenericMappingTools/pygmt/pull/482#issuecomment-647040633

**Are you willing to help implement and maintain this feature?** Yes

I've been able to override and reset everything myself by terminating and restarting the global session:

```python
from pygmt import session_management

session_management.end()
session_management.begin()
```

but this is obviously not ideal, and I fear this may have unintended consequences of which I'm ignorant. I see this feature more as something to facilitate figure _development_ in a notebook, but not so much for finalised figure scripts/notebooks, so it's perhaps not a huge issue?

Ideal usage would be something like:

```python
pygmt.config().reset()
```

I'm still familiarising myself with the inner workings, so I apologise if I've missed/misunderstood something important.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reading the implementation of pygmt.config and the session_management begin/end entry points mentioned in the issue. Determine how permanent and temporary configuration values are tracked, then add coverage showing that reset restores defaults without restarting the global session.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
developer-experience
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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