This is a huge PR, but hopefully it is not too hard to review.
To type check the code I had to setup mypy and I found it was simpler to also add a pyproject.toml file and bump the minimal python version to 3.8 (3.7 is not supported anymore anyway).
I also set up a ruff workflow in the pyproject.toml file, I find it very useful to lint and format the code.
All tests are passing, mypy and ruff give no errors.
The problem to review this PR is that I modified the python code sometimes, to improve type checking. Maybe I can add comments where the code was modified to make it easier to review. Some examples of things that I modified:
make no_default an Enum sentinel: using the string "__no_default__" do not work anymore
same for no_pad.
split def some_func(*args, ...) in def some_func(func, /, *args, ...) when args needed to be a function followed by its arguments.
use an explicit list of keyword arguments instead of **kwargs in function definitions to be able to type check the arguments.
add missing returns
transform assert to if blocks.
Also, I added a dependency to typing_extensions, that is a backport of typing improvements to older python versions. It can be removed, losing a bit of type checking for functoolz.excepts and functoolz.juxt.
wow, nice! Thanks @getzze! I'm in the process of moving so it may take me some time to properly review this, but know that this is appreciated and likely to go in :)
This is a huge PR, but hopefully it is not too hard to review.
To type check the code I had to setup
mypy
and I found it was simpler to also add apyproject.toml
file and bump the minimal python version to 3.8 (3.7 is not supported anymore anyway). I also set up aruff
workflow in thepyproject.toml
file, I find it very useful to lint and format the code.All tests are passing,
mypy
andruff
give no errors.The problem to review this PR is that I modified the python code sometimes, to improve type checking. Maybe I can add comments where the code was modified to make it easier to review. Some examples of things that I modified:
no_default
anEnum
sentinel: using the string "__no_default__" do not work anymoreno_pad
.def some_func(*args, ...)
indef some_func(func, /, *args, ...)
whenargs
needed to be a function followed by its arguments.**kwargs
in function definitions to be able to type check the arguments.assert
toif
blocks.Also, I added a dependency to
typing_extensions
, that is a backport oftyping
improvements to older python versions. It can be removed, losing a bit of type checking forfunctoolz.excepts
andfunctoolz.juxt
.Related PR: #516 #502 Issue: #496