Help users to dynamically manage python package resources
Project description
Dynamic Pip
Photo by David Dibert: https://www.pexels.com/photo/green-and-gray-evergreen-cargo-ship-1117210/
Help users to dynamically manage python package resources and bid farewell to the constraints of the requirements.txt
file.
Build-in pip
Refer: https://pip.pypa.io/en/stable/cli/pip_install/
Dynamic-Pip
Through DynamicPip
class object, dynamically manage (install, delete, etc.) python packages during the execution of the program. In addition, compared to build-in pip
, dynamic-pip
also supports some extended functions.
Example: Install the numpy
package at runtime
from dynamicPip import DynamicPip
dynamic_pip = DynamicPip()
# declare target package
target_package = 'numpy==1.21.6'
# install
print(f'----- install {target_package} test -----')
rtn = dynamic_pip.install_single_package(target_package)
print(f'return result code {rtn}\n')
# check package list
print(f'----- list {target_package} test -----')
rtn = DynamicPip.list_package()
print(f'return result {rtn}\n')
# uninstall single package
print(f'----- uninstall {target_package} test -----')
rtn = DynamicPip.remove_single_package(target_package)
print(f'return result code {rtn}\n')
del dynamic_pip
Example: Build a requirement map
from dynamicPip import DynamicPip
dynamic_pip = DynamicPip()
dynamic_pip.generate_requires_map()
Example: List all installed packages. (pip list
)
# check package as dict. (key = package name, value = version )
rtn = dynamic_pip.list_package()
print(f'return result {rtn}\n')
Example: Generate a requirement map
dynamic_pip.generate_requires_map(target_output_requirements__map_file_name)
Features :point_left:
- support install / uninstall specific package(s) at runtime
- install / uninstall from the given requirements file
- support python test unit
- support multiple index-url, auto-detect fastest PyPI mirror
- export requirements file
- build requires map
Limitations :construction:
- official
inspect
function is still in the experimental stage. - official
--dry-run
function is still in the experimental stage. - official
--report
function is still in the experimental stage.
Future version
- generate a report about all installed packages
- find package exist
- auto-detect packages with custom version from github
- verify hash
- install from local file
- install from compressed file
- install from FTP
- dynamic
import
Build from source code
In some cases, you may want to build this project from code. Consider execute follow command.
rm -rf ./build ./dist ./dynamic_pip.egg-info/ && python setup.py sdist bdist_wheel
Update load to PyPi
twine check ./dist/*
# Checking ./dist/dynamic_pip-1.0-py3-none-any.whl: PASSED
# Checking ./dist/dynamic-pip-1.0.tar.gz: PASSED
twine upload dist/*
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
Hashes for dynamic_pip-1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b37394b8fdedcec777e7870c7273a44152e7a45184552cfa1fccd771325be13e |
|
MD5 | e240cae3616f14b68f91d7d7dec31fae |
|
BLAKE2b-256 | 29f7d53f22a115131bfbf4e43d3a5d7560afc97c77d648b558037303f0a5f833 |