Skip to content

Using types-lxml types in external code #14

@roblframpton

Description

@roblframpton

This library does a great job of typing the results from lxml functions. I can see, for example, that the XML parse method returns a type _ElementTree[_Element]. However, I cannot see a way to use these types in my own code. For example, I'd like to write a method which takes an ElementTree as an argument:

def my_func(element: _ElementTree[_Element]):
  pass

but I can't work out how to import these types. I tried:

from types_lxml import _ElementTree, _Element

but this didn't work. So:

  1. Is there a way to import these types to use in our own code?
  2. Could this be documented somewhere in the readme?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions