traits icon indicating copy to clipboard operation
traits copied to clipboard

traits-stubs is missing several definitions

Open mdickinson opened this issue 4 years ago • 3 comments

(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.

mdickinson avatar Jun 09 '20 18:06 mdickinson

(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

rahulporuri avatar Jun 09 '20 19:06 rahulporuri

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.

mdickinson avatar Jun 10 '20 07:06 mdickinson

Bumping; it would still be good to fix this, but it's not a priority for the current release.

mdickinson avatar Sep 30 '21 12:09 mdickinson