New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add types #3085
base: main
Are you sure you want to change the base?
Add types #3085
Conversation
What I don't see in this MR is:
Could you check to see what conventions (e.g. auto tests, makefile, similar) are used by the project and try to throw together the simplest integration you could think of? Ask for help if you can't figure it out yourself, that's fine :) |
As I said here, I was (and still am) waiting for approval from the maintainers of the project. I don't want to add types directly into the project and then see this PR declined because maintainers doesn't want to use them. That's why we are thinking about adding them to |
Signed-off-by: Victorien Plot <65306057+Viicos@users.noreply.github.com> Signed-off-by: Viicos <65306057+Viicos@users.noreply.github.com>
Signed-off-by: Victorien Plot <65306057+Viicos@users.noreply.github.com> Signed-off-by: Viicos <65306057+Viicos@users.noreply.github.com>
Signed-off-by: Viicos <65306057+Viicos@users.noreply.github.com>
Signed-off-by: Viicos <65306057+Viicos@users.noreply.github.com>
.github/workflows/ci.yml
Outdated
- name: Run ruff | ||
run: ruff docker tests | ||
- name: Run mypy | ||
run: mypy docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest putting the files in the config and then only running mypy
.
I'd also suggest copying, for example, this config, to get more in depth checking: https://github.com/aio-libs/aiohttp-jinja2/blob/master/.mypy.ini
Commenting out any options that you don't want to deal with yet, so they can be added in later (note you can also do config options per module).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe we should go with mypy strict in one go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict just enables about half the options listed in that config (there are several other useful ones not enabled by strict), so I'd still look at the whole thing. And if you don't want to resolve everything in 1 PR, then more finegrained settings is going to help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I'll take a look. I'll see if CI passes once I convert this PR as ready to review. But I don't think maintainers will see..
Part of #2796.
api
(probably not in this PR)context
(same)credentials
(same)models
(same)transport
(same)types
(same)utils
(same)auth.py
client.py
constants.py
errors.py
tls.py
version.py
MAKEFILE
, + items described hereI have used
Dict[str, Any]
inauth.py
andclient.py
in some places, we might want to narrow the types usingTypedDict
instead (or other solutions, can be discussed).Notes:
As adding types will add a lot of imports and changes to the code layout,
isort
and a code formatter could be enforced.I suggest we change
json
andbinary
to keyword only arguments. If used as an argument, this could lead to confusion (see here for example).docker-py/docker/api/client.py
Line 272 in 82cf559
config_path
andconfig_dict
can be madeOptional
, as this classmethod is already called with optional arguments here.docker-py/docker/auth.py
Lines 153 to 164 in 82cf559
Before continuing, I'd like to know if:
typing_extensions
is fine (required forLiteral
, introduced in Python3.8)(@aiordache @ulyssessouza @milas; tagging as this is a draft PR).