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
{{ message }}
Repository navigation
Drop dependecy pkg_resources required by kaitaistruct autogenerated code #5401
pkg_resources is used here only to check kaitaistruct installed version. Kaitaistruct by itself doesn't use this package.
But this package also on import do a lot of other stuff, that slows down the code startup time and causes a lot of other problems in my project. So I've dropped it from mitmproxy at my local version.
Also, as I know, you build executable files. This would help to increase startup speed and decrease exe file size.
I know that there were already a lot of topics about this problem. But I don't see anything that stops us from this step (drop pkg_resources).
Starting from the kaitaistruct version 0.10, they've already dropped pkg_resources dependency.
You can read the related issue here: kaitai-io/kaitai_struct#804
Because it's used only to check an installed kaitaistruct version there are some proposals:
Drop this checks and don't check kaitaistruct version at all. In the wheel it said: kaitaistruct (<0.10,>=0.7). So it would be strange if you try to use mitmproxy with some other kaitaistruct versions. For me it's a bit strange why do we check kaitaistruct package version, but don't check other dependencies versions.
Use our own version checker.
It would be better to check the version only once by moving it to the nearest init file. I'm ready to write a simple version checker based on regexp.
I'm ready to create a PR for any chosen alternative.
Additional context
There is only one minor issue. If you decide to recompile these files with an old version kaitaistruct (<0.10), this patch should be applied again. But if we're going to recompile them, shouldn't we use a newer version.
Thanks for raising this! Ideally we'd just wait for a kaitai 0.10 release and then recompile, but not sure when this happens. For now I'd be happy to merge a PR that just removes the checks. As you say, we check the version anyway. We can add a
# manually removed version check, see https://github.com/mitmproxy/mitmproxy/issues/5401
comment instead to make sure it's not inadvertently reintroduced when someone recompiles with 0.9.
Activity
mhils commentedon Jun 6, 2022
Thanks for raising this! Ideally we'd just wait for a kaitai 0.10 release and then recompile, but not sure when this happens. For now I'd be happy to merge a PR that just removes the checks. As you say, we check the version anyway. We can add a
comment instead to make sure it's not inadvertently reintroduced when someone recompiles with 0.9.
Drop pkg_resources dependency used by kaitaistruct version checking (m…
Drop pkg_resources dependency used by kaitaistruct version checking (m…
Drop pkg_resources dependency used by kaitaistruct version checking (m…
Drop pkg_resources dependency used by kaitaistruct version checking (#…
PavelICS commentedon Jun 7, 2022
Closed by #5403