Skip to content
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

object_property doesn't get the special redefinition treatment from mypy #565

Open
glyph opened this issue Jun 23, 2023 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@glyph
Copy link

glyph commented Jun 23, 2023

Is your feature request related to a problem? Please describe.
I get errors like Name "colorValue" already defined on line 160 [no-redef] when using the recommended style like so:

class MyObject(NSObject):
    colorValue = object_property()
    @colorValue.getter
    def colorValue(self) -> NSColor:
        ...

Describe the solution you'd like
Ideally object_property could pretend to return a property at type time, to inherit the special-cased behavior from mypy? There's an entrypoint to a whole constellation of different attempts at describing this problem here.

Describe alternatives you've considered
I could type:ignore these away, which is tedious, or I could name each of the getters/setters some private name, but that's ugly. Mostly I just want to do what the documentation tells me to so that this is future-proof and supported, so while I'd prefer it if Mypy fixed it so that pyobjc could hook in to a documented exception to no-redef in the type system, I'd also be fine with a documentation tweak.

@glyph glyph added the enhancement New feature or request label Jun 23, 2023
@ronaldoussoren ronaldoussoren added this to the Typing support milestone Aug 8, 2023
@ronaldoussoren
Copy link
Owner

PyObjC does not have mypy support at this time, although this is on my todo-list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants