Declare Command: Difference between revisions
Jump to navigation
Jump to search
PedroLacerda (talk | contribs) |
PedroLacerda (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
==The problem== | ==The problem== | ||
Current PyMOL approach to new plugin commands is outdated. | |||
==The proposal== | ==The proposal== | ||
Introduce a new system based on modern Python with type checking and implicit | Introduce a new system based on modern Python with type checking and implicit type coercion. | ||
==What works right now?== | ==What works right now?== | ||
On PyMOL open-source, but not on Incentive, there's | On PyMOL open-source, but not on Incentive, there's some support. However it isn't working for all possible cases. | ||
<source lang="python"> | <source lang="python"> | ||
@declare_command | @cmd.declare_command | ||
def new_command( | def new_command( | ||
dirname: Path = '.', | dirname: Path = '.', | ||
nullable_point: Optional[Tuple[int, int, int]] = None, | #nullable_point: Optional[Tuple[int, int, int]] = None, | ||
my_var: int | float | my_var: int | float | ||
extended_calculation: bool = True, | extended_calculation: bool = True, | ||
old_style: Any = "Support anything currently not supported" | old_style: Any = "Support anything currently not supported", | ||
) -> IgnoredType: | ) -> IgnoredType: | ||
""" | """ | ||
Line 27: | Line 25: | ||
""" | """ | ||
pass | pass | ||
</source> | |||
Revision as of 09:00, 20 June 2025
The problem
Current PyMOL approach to new plugin commands is outdated.
The proposal
Introduce a new system based on modern Python with type checking and implicit type coercion.
What works right now?
On PyMOL open-source, but not on Incentive, there's some support. However it isn't working for all possible cases.
@cmd.declare_command
def new_command(
dirname: Path = '.',
#nullable_point: Optional[Tuple[int, int, int]] = None,
my_var: int | float
extended_calculation: bool = True,
old_style: Any = "Support anything currently not supported",
) -> IgnoredType:
"""
A cool docstring.
"""
pass