a PIP wrapper to install PyPI packages from inside Python
Project description
py-pip
Install Python packages, from inside a Python environment. e.g. in Blender, Maya, Max, ...
The difference with similar solutions: py-pip passes it's sys.paths to pip, to support dynamicly added paths for e.g. Maya, Blender, ...
(Otherwise any python paths added after startup wont be detected by pip, so it can't uninstall certain installed packages, or it might install an already installed package)
Features
- pass env vars so pip can detect installed modules in different locations (e.g. Blender dynamicaly changes the Python path on startup)
& handle env vars, to prevent non sys.path paths being passed. - use pip from within Python, using the active interpreter
Instructions
import py_pip
# optional
py_pip.default_target_path = "C:/path/to/site-packages" # defaults to no target path
py_pip.python_interpreter = "C:/path/to/python.exe" # defaults to sys.executable
# the core commands
py_pip.install("dummy_test") # install dummy_test
py_pip.uninstall("dummy_test") # uninstall the dummy_test package
use case
Blender doesn't has an external Python interpreter that sets up the Blender environment (Maya has mayapy.exe
).
To use pip and have it correctly detect the installed modules:
- you need to run it from inside Blender.
- or recreate the environment, with same Python version and Python paths.
Else you might install a module that is already by default installed in Blender, because pip failed to detect it.
This can result in clashes and weird bugs.
Alternatives
This might (untested) also be achievable by passing sys.path
to os.environ["PYTHONPATH"]
and then running one of the below modules.
Existing Python pip wrappers, without handling sys paths by default:
- 100⭐ di/pip-api - local
pip.exe
wrapper, lacks documentation (passes env vars, but not sys path, see code) - 004⭐ aescarias/pypiwrap - API wrapper for the PyPI website, not for local
pip.exe
documentation - 130⭐ sjkingo/virtualenv-api - local
pip.exe
wrapper, but for virtual env , nice quickstart docs on README - 7k⭐ pypa/pipx pip wrapper meant for commandline python apps. not really usefull for our use case.
TODO
- add support for pip auto remove - remove unused dependencies https://github.com/invl/pip-autoremove (does this use it s own uninstall, or can we get a list and use py-pip uninstall)
used by
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file py_pip-0.0.12.tar.gz
.
File metadata
- Download URL: py_pip-0.0.12.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9411feae7342c2b6e12a105c2a4d4b667a5c1d3f134e4d898bb0dd869f1c24bb |
|
MD5 | 9ba4c6be651b5a5904991d0a283ebb27 |
|
BLAKE2b-256 | 77e027277a3dcbd6f80d9a4606348720abe89b81fbc8079b7288771cb4f8639b |
File details
Details for the file py_pip-0.0.12-py3-none-any.whl
.
File metadata
- Download URL: py_pip-0.0.12-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72182f5b9a21c5d953fb5c9df4ad9b0de4686ea89834d5287648fa890f37bf22 |
|
MD5 | f7a42a696c4601878fbf26b9d338ef14 |
|
BLAKE2b-256 | be03510be3a48c837e467e50db1276074cc42c5d70e022c74197cc6931fdbcba |