Skip to content

grass.script: Add Python type hints to core.py#7130

Merged
echoix merged 1 commit intoOSGeo:mainfrom
Sourish-spc:type-hints-core
Mar 3, 2026
Merged

grass.script: Add Python type hints to core.py#7130
echoix merged 1 commit intoOSGeo:mainfrom
Sourish-spc:type-hints-core

Conversation

@Sourish-spc
Copy link
Contributor

Description

This PR is a small housekeeping contribution to modernize the Python API by adding missing type hints to several utility functions in grass.script.core.

Changes made:

  • Added -> bool to overwrite()
  • Added -> int to verbosity()
  • Added s: str and -> bool to legal_name(s)

These changes improve static analysis and IDE autocomplete support without altering any underlying logic.

Motivation and Context

As part of preparing for GSoC 2026, I am exploring the GRASS GIS codebase. While reviewing the Python API, I noticed that while some functions (like parser()) have been updated with modern type hints, several utility functions at the bottom of core.py have not yet been transitioned.

How Has This Been Tested?

These are strictly non-functional type hint additions. The code has been reviewed to ensure no runtime logic is modified.

@github-actions github-actions bot added Python Related code is in Python libraries labels Mar 3, 2026
@Sourish-spc Sourish-spc changed the title Style: Add Python type hints to overwrite, verbosity, and legal_name in core.py grass.script: Add Python type hints to core.py Mar 3, 2026
@echoix echoix enabled auto-merge (squash) March 3, 2026 10:27
@echoix echoix merged commit 1a3e9e9 into OSGeo:main Mar 3, 2026
26 of 27 checks passed
@github-actions github-actions bot added this to the 8.6.0 milestone Mar 3, 2026
Dasux pushed a commit to Dasux/grass that referenced this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants