'Bundle Python package to a single file

I'm in a system where I cannot install any package nor create files/directories, exec shell commands, even from Python, and I don't have anything but Python installed.

I can ONLY copy-paste some code at the top of my script.

I would like to use X library, so I was thinking if there is any way to bundle the library, like in JavaScript, getting all the exports in the global scope, copy-pasting the bundle in my file so I can use them in my code.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source