traits
traits copied to clipboard
traits-stubs is missing several definitions
(Reported in another communication channel by @rahulporuri)
it looks like there are a few objects/type declarations missing from the traits.api module
Notably, HasStrictTraits
, Interface
and provides
are missing, but it's likely that these are not the only ones.
As I understand it, completeness was not an initial goal for the stubs, but the three items above are very widely used.
(Sorry for the delay in creating an issue. Given that an issue has been created, I thought i'd just append to the issue) The following object/type declarations are missing -
NOTE : I initially tested this on an internal project but i can see most of these errors when i test traitsui with mypy after installing the traits stubs (there's a lot A LOT of noise but in that noise, you should see a number of errors of the type "traitsui\wx\history_control.py:25: error: Module 'traits.api' has no attribute 'HasPrivateTraits'"
)
- [ ]
traits.api.AdaptationError
- [ ]
traits.api.Adapter
- [ ]
traits.api.Array
- [ ]
traits.api.ArrayOrNone
- [x]
traits.api.BaseTraitHandler
- [ ]
traits.api.CArray
- [x]
traits.api.CTrait
- [x]
traits.api.HasStrictTraits
- [x]
traits.api.HasPrivateTraits
- [x]
traits.api.Interface
- [ ]
traits.api.TraitError
- [ ]
traits.api.TraitDictEvent
- [x]
traits.api.TraitHandler
- [ ]
traits.api.TraitListEvent
- [ ]
traits.api.Undefined
- [ ]
traits.api.adapt
- [x]
traits.api.cached_property
- [x]
traits.api.on_trait_change
- [ ]
traits.api.pop_exception_handler
- [x]
traits.api.provides
- [ ]
traits.api.push_exception_handler
- [ ]
traits.api.register_factory
- [ ]
traits.adaptation.*
module - [ ]
traits.etsconfig.api
module - [ ]
traits.interface_checker
module - [ ]
traits.testing.api
module - [ ]
traits.trait_base
module - [ ]
traits.trait_converters
module - [ ]
traits.trait_errors
module - [ ]
traits.trait_notifiers
module - [ ]
traits.trait_numeric
module - [ ]
traits.util.weakiddict
module
Thanks, @rahulporuri
There's an easy part and a hard part for the fix.
For the easy part, if we're already defining stubs for a function or class but not exposing those stubs in api.pyi
, then we should do that.
The harder part is creating stubs where they don't already exist.
Bumping; it would still be good to fix this, but it's not a priority for the current release.