Support Type Hints

Aperta
#2,794 4 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia esaminando l'attività rimanente non ancora selezionata per abilitare le regole ANN di Ruff e confrontala con il lavoro di Mypy già completato in #2808 e #2812. Completato significa che la politica di type hinting del progetto è stata decisa, i controlli pertinenti sono abilitati e le annotazioni richieste superano tali controlli.

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

Descrizione

longterm typing

This issue is still in draft mode. Type hints are something new to me, so I need to learn more and will keep improving the issue description.

What's Python's Type Hints
Why we should support type hints

Copied from https://vegibit.com/introduction-to-python-type-hints/.

  • Improved code readability: Type hints make it easier for other developers to understand your code. By clearly specifying the types of arguments and return values, you can help others quickly grasp the intent of your code.
  • Improved development speed: With type hints, you can catch potential bugs and errors early in the development process. This can save you time in the long run, as you can fix errors before they cause problems in your code.
  • Improved tooling support: Many tools, such as static analyzers and IDEs, use type hints to provide better support for your code. For example, they can use type hints to catch potential errors, suggest code improvements, or provide better autocompletion.
  • Better auto-completion for parameter values: See #2793 for how Type Hints can affect the way we use PyGMT.
Tasks
  • Use Mypy for static type checking #2808
  • #2812
  • Enable ruff's ANN rules to make sure all parameters are annotated? [Maybe it's unnecessary, because mypy has a strict mode]
References:
Related PEPs
Lingua principale
Python
Stelle
882
Fork
261
Merge medio
1g 3h
PR unite (30g)
29

Preparare l'ambiente

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 GenericMappingTools/pygmt

Tutte le issue di GenericMappingTools/pygmt

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.