There was some early thinking on dependency metadata fields in this Jupyter notebook thread: https://github.com/jupyter/nbformat/pull/60
I’m sure I’ve seen some other similar treatments over last few months but can’t find them offhand… Hmm… [Ah, this is maybe one of them: ipydeps
]
One way round the hugely bloated kernel option is to provide multiple kernels with slightly different dependencies in each (although that can still result in a large image). JupyterWith takes that approach, I think?
See also a recent post on this forum which considers a “proxy kernel” that mediates specific kernel requirements: Guix-Jupyter: Towards self-contained, reproducible notebooks
By the by, the repo2docker github action to autobuild a docker image and push it to DockerHub also reminds me of this CircleCI recipe to do a similar thing: binder-examples/continuous-build