Skip to content

Export our typing #428

@bluetech

Description

@bluetech

This is an audit of pluggy's public API, from the perspective of typing. The idea is that every type which is reachable transitively through the public API should be exported from pluggy and have a clean documented interface (and without _ prefixes), with possible exceptions.

Note: this is different from the goal of making hook calls themselves typed. That would be great, but is a separate enhancement.

  • _HookRelay - through pm.hook
    • Now pluggy.HookRelay
  • TagTracer - through pm.trace
    • TODO: audit of API and transitive types
  • _Plugin - type alias for a plugin object - just object.
    • Actually no need to export this.
  • _Namespace - type alias for ModuleType | type
    • Actually no need to export this
  • DistFacade - it is compat adapter, probably shouldn't be exported
  • _HookCaller - through pm.get_hookcallers, pm.subset_hook_caller
    • Now pluggy.HookCaller
  • HookSpec - through _HookCaller.spec
  • HookImpl - through _HookCaller.get_hookimpls
  • _HookSpecOpts - through pm.parse_hookspec_opts
    • Now pluggy.HookSpecOpts
  • _HookImplOpts - through pm.parse_hookimpl_opts
    • Now pluggy.HookImplOpts
  • _BeforeTrace, _AfterTrace - type aliases, in pm.add_hookcall_monitoring
    • No need to export
  • _Result - in old-style wrappers
    • Now pluggy.Result

Other tasks are:

  • Update the sphinx version we use in RTD (currently uses <2), need recent one for typing improvements
  • Mark immutable fields as Final
  • Mark non-subclassable classes @final
  • Make private contstructors of public types private/hidden
  • Document all public types in the API reference

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions