You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I just wanted to suggest adding a 'stub' for this library for static typing using the library mypy (no need to change code, the stub can go in a separate file).
I have my own version here (incomplete)
For example, here is part of the code related to ConfigObj constructor
Because the minimal Python version is now 3.8 the type hints can easily be added to the source code. I can make an PR if you are interested. It is also possible to a CI stage to verify that the type hints don't regress.
I wasn't entirely sure which functions and attributes are expected to be used by the end user so I started adding type hints everywhere and checking them with mypy. I think there is one bug I found where an exception is initialised with wrong number of arguments.
Activity
Vykstorm commentedon May 21, 2019
It would be usefull for mypy to infer the types of the values returned by the methods as_bool(), as_int(), ... in the Section class
mypy (not python) will raise an error when executing the next code:
davetapley commentedon Sep 5, 2021
I started something to do this: https://github.com/JEFuller/dataclasses-configobj
robdennis commentedon Jan 8, 2023
I think this is a good idea and typing support in my IDE is generally an important thing for me as a developer.
I don't think that I'm capable of doing anything with this for 5.1.0, but I hope someone is able to take something like this on
jelmer commentedon Sep 17, 2024
@Vykstorm / @davetapley can you add this to the repo in a PR?
[-]Suggestion: mypy stub for ConfigObj [/-][+]mypy stub for ConfigObj [/+]igorp-collabora commentedon Jul 31, 2025
Because the minimal Python version is now 3.8 the type hints can easily be added to the source code. I can make an PR if you are interested. It is also possible to a CI stage to verify that the type hints don't regress.
jelmer commentedon Jul 31, 2025
igorp-collabora commentedon Aug 1, 2025
@jelmer I start in this PR: #267
I wasn't entirely sure which functions and attributes are expected to be used by the end user so I started adding type hints everywhere and checking them with mypy. I think there is one bug I found where an exception is initialised with wrong number of arguments.