Documentation
The PEP 8 style guide recommends adding docstrings for functions and the main code.
It would be helpful to add a docstring at the top of the code to summarize:
- The purpose of the code: expand upon what you mean by "Rubik's Cube game"
- Its output: how the output file is expected to be used
For example:
""" Rubik's Cube game What the code does... Output file "output.html" ... """ For the functions, again, the docstrings should describe the input and return types as well as what the function does and how it does it. For rigid_perms, it would be helpful to mention that it is recursive.
Also consider using type hints for the functions to make the code more self-documenting.
Naming
The function names are a bit cryptic. rigid_perms could be rigid_permutations (if that is what "Perms""perms" stands for). np2js could be numpy2javascript.
Magic numbers
You could either add comments or create named constants for the numbers 127 and 21.