scrapy / parsel

Parsel lets you extract data from XML/HTML documents using XPath or CSS selectors
BSD 3-Clause "New" or "Revised" License
1.15k stars 146 forks source link

Fix PEP 561 typed package #240

Closed DeviousStoat closed 2 years ago

DeviousStoat commented 2 years ago

As specified by PEP 561, the py.typed file needs to be included in the python package itself.

In this case, if I install the package from the master branch of the project, a static type checker like pyright doesn't find the py.typed file and no type is used.

To reproduce:

$ pip install git+https://github.com/scrapy/parsel.git@master
# t.py
from parsel import Selector

element = Selector("").css("#some_id").get()
reveal_type(element)
$ pyright t.py
...
type of "element" is "Unknown"
...

Expected should be: type of "element" is "str | None"

codecov[bot] commented 2 years ago

Codecov Report

Merging #240 (0c32437) into master (f5f73d3) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #240   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          290       290           
  Branches        59        59           
=========================================
  Hits           290       290           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f5f73d3...0c32437. Read the comment docs.

DeviousStoat commented 2 years ago

Thank you! I see black failed on a file I didn't change, I am not sure why, should I do something about it in this PR?

wRAR commented 2 years ago

I suspect it's a change in the black's behavior since we last ran it. You should ignore it.