Cross compile, python, ccache

I've never tried to install a complete, functional build chain on an OpenWRT device, due to flash-size constraints and knowing how terribly slow it is to compile anything on an older Raspberry Pi (which is likely faster than most home routers).

The instructions for installing the build chain on a Linux machine can be found at https://openwrt.org/docs/guide-developer/build-system/start

For a Makefile for your package, I'd look at a similar Python 3 package already "working" and adapt it to your needs. There is some documentation at https://openwrt.org/docs/guide-developer/packages and I also found Packaging guidelines to be very valuable.