So i've been using githubkit in a lambda function and ran into the size limit pretty quick. The package is about ~108 MB installed, and like 90% of that is generated code under githubkit/versions/.
here's roughly where the space goes:
$ ncdu ...
--- /private/tmp/lambda-build/processor-deps/python/githubkit/versions
/..
25.5 MiB [###################################] /ghec_v2022_11_28
25.4 MiB [################################## ] /ghec_v2026_03_10
22.6 MiB [############################### ] /v2022_11_28
22.6 MiB [############################### ] /v2026_03_10
1.7 MiB [## ] /latest
20.0 KiB [ ] versions.lock
4.0 KiB [ ] rest.py
4.0 KiB [ ] webhooks.py
4.0 KiB [ ] __init__.py
The types/ directories alone are ~41 MB of TypedDict stubs that are never actually used at runtime — every import is behind TYPE_CHECKING or is_lazy_disabled(). Thats a lot of dead weight for production deployments.
proposal
Option 1: extract type stubs into githubkit-types
Split the TypedDict stubs into a seperate githubkit-types package using PEP420 implicit namespace packages. Fully backward compatible, i think that no code changes needed.
main package (githubkit):
- Exclude
githubkit/versions/*/types/ and githubkit/versions/latest/types.py from the wheel via source-exclude
- Add a
[types] optional dependency
- Update
[all] extra to include githubkit-types
- No runtime code changes — type imports are already behind
TYPE_CHECKING
new package (githubkit-types):
- Only the
types/ directories
- Uses
uv_build with namespace = true to overlay into githubkit.versions.*.types
- Only depends on
typing-extensions
install options:
pip install githubkit
pip install githubkit[types]
Option 2: optional API version extras
taking it further, could also make individual API versions optional:
pip install githubkit[v2026_03_10] # core + only 2026-03-10
pip install githubkit[ghec_v2022_11_28] # core + only GHEC 2022-11-28
pip install githubkit[all-versions] # everything (current behaviour)
This one is more work tho since models and rest modules are used at runtime, so it would need:
- Runtime fallback with clear
ImportError mesages when a version isn't installed
- Codegen changes to output each version as a seperate sub-package
Option 3:
Option 1 + Option 2
For now i will try to remove some folders from the wheel, and cross one's fingers, xD
If you're open to any of these changes, i'd be happy to help with the implementation
So i've been using githubkit in a lambda function and ran into the size limit pretty quick. The package is about ~108 MB installed, and like 90% of that is generated code under
githubkit/versions/.here's roughly where the space goes:
The
types/directories alone are ~41 MB of TypedDict stubs that are never actually used at runtime — every import is behindTYPE_CHECKINGoris_lazy_disabled(). Thats a lot of dead weight for production deployments.proposal
Option 1: extract type stubs into
githubkit-typesSplit the TypedDict stubs into a seperate
githubkit-typespackage using PEP420 implicit namespace packages. Fully backward compatible, i think that no code changes needed.main package (
githubkit):githubkit/versions/*/types/andgithubkit/versions/latest/types.pyfrom the wheel viasource-exclude[types]optional dependency[all]extra to includegithubkit-typesTYPE_CHECKINGnew package (
githubkit-types):types/directoriesuv_buildwithnamespace = trueto overlay intogithubkit.versions.*.typestyping-extensionsinstall options:
Option 2: optional API version extras
taking it further, could also make individual API versions optional:
This one is more work tho since models and rest modules are used at runtime, so it would need:
ImportErrormesages when a version isn't installedOption 3:
Option 1 + Option 2
For now i will try to remove some folders from the wheel, and cross one's fingers, xD
If you're open to any of these changes, i'd be happy to help with the implementation