Skip to content

New Alias System: Add the Alias class #3993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

seisman
Copy link
Member

@seisman seisman commented Jul 10, 2025

This PR adds the Alias class. It's the basis of the new alias system (#4000) and class-like parameters (see #3995).

So, please review PRs #3995 and #4000 first.

@seisman seisman added this to the 0.17.0 milestone Jul 10, 2025
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. and removed needs review This PR has higher priority and needs review. labels Jul 10, 2025
@seisman seisman added the needs review This PR has higher priority and needs review. label Jul 21, 2025
@seisman seisman requested a review from Copilot July 22, 2025 06:08
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the Alias class as a dataclass-based wrapper for the existing _to_string function to establish the foundation for a new alias system. The class provides a more structured and object-oriented approach to handling parameter aliasing between PyGMT's long-form arguments and GMT's short-form options.

  • Adds the Alias dataclass with attributes matching _to_string parameters
  • Implements a _value property that delegates to the existing _to_string function
  • Provides comprehensive documentation with usage examples
Comments suppressed due to low confidence (1)

pygmt/alias.py:185

  • [nitpick] The property name '_value' uses a leading underscore which typically indicates a private/internal attribute, but this appears to be the main interface for accessing the converted value. Consider using 'value' or 'converted_value' for better API clarity.
    def _value(self) -> str | list[str] | None:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature needs review This PR has higher priority and needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant