lxml / lxml-stubs

Type stubs for the lxml package
Other
43 stars 29 forks source link

Add `Pathlike` as valid type for file arguments #60

Closed janssenhenning closed 2 years ago

janssenhenning commented 2 years ago

See https://github.com/lxml/lxml/pull/337

Also created alias _FileSource for valid types for file arguments. I'm not sure how this should be added since it was only added in the newest release of lxml.

scoder commented 2 years ago

Eventually, the typing stubs should probably just be part of the lxml package itself, so that they get properly versioned.

For now, I don't think it hurts. Users will notice it early enough if they pass a Path object and lxml fails to accept it.

scoder commented 2 years ago

Thanks

mcclurem commented 2 years ago

I /just/ ran into this and was trying to figure out why mypy wasn't catching the runtime error I'd created. Any chance the typing stubs are going to get versioned in with lxml soon?

scoder commented 2 years ago

Any chance the typing stubs are going to get versioned in with lxml soon?

I'll include them as soon as they are complete, so that users of older versions (that ship old stubs) don't suffer from missing definitions that are already there in the new stubs.

PRs welcome.