Closed pcorpet closed 3 years ago
Merging #218 (9de2cd2) into master (56bec18) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #218 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 286 291 +5
Branches 51 51
=========================================
+ Hits 286 291 +5
Impacted Files | Coverage Δ | |
---|---|---|
parsel/__init__.py | 100.00% <100.00%> (ø) |
|
parsel/selector.py | 100.00% <100.00%> (ø) |
|
parsel/utils.py | 100.00% <100.00%> (ø) |
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 56bec18...9de2cd2. Read the comment docs.
I was not aware of these pyi
files, but could you instead include the typing hints into the actual files? That’s the way we are doing it in Scrapy, and I think it makes things easier (e.g. if you change a function you only need to edit its file, not also the corresponding type file).
I'm happy to go that way as it's indeed easier to maintain.
Note that it enforces to use python 3
, and I have no clue whether parsel
still support python 2
.
You are right, we still support Python 2 :facepalm:.
Maybe it’s time for us to “fix” that :slightly_smiling_face:
Fixed, please merge/rebase.
Done. Note that the annotations I've added are not enough to type parsel
entirely, it's only typing the public API so that other typed code can depend on it properly.
Note that the annotations I've added are not enough to type
parsel
entirely, it's only typing the public API so that other typed code can depend on it properly.
That’s perfectly fine. It’s definitely an improvement over not having any typing hints at all.
Could you also add mypy to the CI? It should only require editing tox.ini
and .github/workflows/checks.yml
. See similar files in https://github.com/scrapy/itemadapter for reference.
Alright, I've added mypy
. Few things:
isinstance
, but also the one that extends the classes): that is intended
Note that I'm not sure how to correctly add the files in the package. The
*.pyi
files need to be installed, so as the emptypy.typed
file.As for the types, we've been using them for a while, with
scrapy
types as well. They are not complete but it's a start, and there's no reason for those types to live in our repo when they can benefit others.