Here's a horrible brute-force approach. I hope someone gives you a better answer!
Assuming the source you want to install is public, its licensing allows this kind of use, and you are willing to deal with the hassle, I imagine you could:
- copy the source
- remove anything unused by your required module
- place that module's source inside your package, and wire it up from there. (This answer proposes a reasonable file structure for vendored software)
Alternately, if the assumptions above hold but you prefer not to vendor directly within your software, you could probably:
- copy the source (e.g. fork the repo)
- remove anything not used by your required module, making sure to leave a working python package
- use
pip
or your environment's native dependency management tools to download and install your package in the virtual env.
Please note that both of these approaches will expose you to a number of risks, including but not limited to:
- breaking the module: what happens to your project if you accidentally created a logical or security flaw?
- loss of currency: how do you plan to keep your new mini-package up to date?
- liability: Does the vendored software's license allow this kind of use? Are you adequately protected if there is something wrong with the software you have modified?