Search code examples
pythonbundle

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.


Solution

  • Does pinliner do what you need?

    This tool allows you to merge all files that comprise a Python package into a single file and be able to use this single file as if it were a package.