Skip to main content

Help users to dynamically manage python package resources

Project description

Dynamic Pip

logo

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.

valid for python3.7/3.8/3.9 license

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_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_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)
%%{ init: { 'flowchart': { 'curve': 'monotoneX' } } }%%
graph LR
MyProject([MyProject]):::header
%% ---- BODY
pkg_resources[name: pkg_resources<br/>version: 0.0.0<br/>summary: UNKNOWN<br/>license: UNKNOWN<br/>]:::mynode
joblib[name: joblib<br/>version: 1.1.0<br/>summary: Lightweight pipelining with Python functions<br/>license: BSD<br/>]:::mynode
threadpoolctl[name: threadpoolctl<br/>version: 3.1.0<br/>summary: threadpoolctl<br/>license: BSD-3-Clause<br/>]:::mynode
icmplib[name: icmplib<br/>version: 3.0.3<br/>summary: The power to forge ICMP packets and do ping and traceroute.<br/>license: GNU Lesser General Public License v3.0<br/>]:::mynode
python-dateutil{{name: python-dateutil<br/>version: 2.8.2<br/>summary: Extensions to the standard Python datetime module<br/>license: Dual License<br/>+six}}:::mynode
numpy[name: numpy<br/>version: 1.21.6<br/>summary: NumPy is the fundamental package for array computing with Python.<br/>license: BSD<br/>]:::mynode
pandas{{name: pandas<br/>version: 1.3.5<br/>summary: Powerful data structures for data analysis, time series, and statistics<br/>license: BSD-3-Clause<br/>+python-dateutil<br>+pytz<br>+numpy}}:::mynode
scipy{{name: scipy<br/>version: 1.7.3<br/>summary: SciPy: Scientific Library for Python<br/>license: BSD<br/>+numpy}}:::mynode
six[name: six<br/>version: 1.16.0<br/>summary: Python 2 and 3 compatibility utilities<br/>license: MIT<br/>]:::mynode
pytz[name: pytz<br/>version: 2022.2.1<br/>summary: World timezone definitions, modern and historical<br/>license: MIT<br/>]:::mynode
%% ---- LINK
MyProject --> pkg_resources
MyProject --> joblib
MyProject --> threadpoolctl
MyProject --> icmplib
MyProject --> python-dateutil
python-dateutil --> six
MyProject --> numpy
MyProject --> pandas
pandas --> python-dateutil
pandas --> pytz
pandas --> numpy
MyProject --> scipy
scipy --> numpy
MyProject --> six
MyProject --> pytz
%% ---- STYLE
classDef header fill:#FFCC99;
classDef mynode text-align:left;

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
  • support extra-index-url
  • export requirements file
  • build requires map
  • install from local file
  • find package exist

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
  • verify hash
  • dynamic import

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynamic-pip-1.1.2.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynamic_pip-1.1.2-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file dynamic-pip-1.1.2.tar.gz.

File metadata

  • Download URL: dynamic-pip-1.1.2.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for dynamic-pip-1.1.2.tar.gz
Algorithm Hash digest
SHA256 c85260235a8b3c4ce85949864c9625e94de132e5e7bdc8491a8befc4f9f6f99e
MD5 449d41980af09634a14a86a38fee2414
BLAKE2b-256 c6a1b5784c85e5eb308101797a65e7e4386adb56b52270cab991a0e97e827258

See more details on using hashes here.

File details

Details for the file dynamic_pip-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: dynamic_pip-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for dynamic_pip-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b4c92670578c4f04fbdd5fc489b7ef3b211f22e1109404463771170216a0af2
MD5 8d1b22eeaf93efe6544826bfa4f8d21a
BLAKE2b-256 975b8f8f33a600713b96faa7ad5f6f9f4ed0da5bcb9592e539c98f861dffc21b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page