jazzband / pip-tools

A set of tools to keep your pinned Python dependencies fresh.
https://pip-tools.rtfd.io
BSD 3-Clause "New" or "Revised" License
7.69k stars 610 forks source link

Update types using fresh dependencies #1927

Open atugushev opened 1 year ago

atugushev commented 1 year ago

Since 21.1 pip has py.typed file, hence many updates on type annotations.

Contributor checklist
Maintainer checklist
atugushev commented 1 year ago

@AndydeCleyre

FYI, this is pre-step towards addressing the following comments:

webknjaz commented 1 year ago

FWIW it might be useful to run mypy against several pip and Python versions (like min + max). Just the last one isn't going to cover a lot of stuff..

atugushev commented 1 year ago

FWIW it might be useful to run mypy against several pip and Python versions (like min + max). Just the last one isn't going to cover a lot of stuff..

@webknjaz I wonder if there are any library/apps in wild that do this?

webknjaz commented 1 year ago

Pip itself used to have py3 and py2 runs both in pre-commit, before 2020. I also do so in some places (like Cheroot). One possible strategy is to test every other version or min/max to cover most stuff while still not using too much resources. I think that ansible-test runs mypy under every supported interpreter version (both for the ansible-core itself and the external collections).

webknjaz commented 1 year ago

pre-commit tip: if you add several check invocations, it's important to add aliases because several checks have the same id and there's no way to select a specific check without this.

atugushev commented 1 year ago

I also do so in some places (like Cheroot)

@webknjaz how do you handle type incompatibilities between different versions in the same code?

atugushev commented 1 year ago

FTR: reopened PR because checks were stuck for some reason.

atugushev commented 1 year ago

FWIW it might be useful to run mypy against several pip and Python versions (like min + max). Just the last one isn't going to cover a lot of stuff..

@webknjaz opened a separate issue https://github.com/jazzband/pip-tools/issues/1928 to address the suggestion.