Comet Pip Utils
A Python package providing utility functions for pip package management and environment analysis.
Installation
pip install comet-pip-utils
Features
- Get installed pip packages in the current environment
- Parse and analyze frozen requirements
- Check if packages are installed and satisfy version constraints
- Install packages programmatically with custom flags
- Unload packages from memory
- Extract package names from requirement strings
Usage
Get Installed Packages
from comet_pip_utils import get_pip_packages
# Get all installed packages
packages = get_pip_packages()
print(packages)
# Output: ['numpy==1.21.0', 'pandas==1.3.0', ...]
Parse Frozen Requirements
from comet_pip_utils import parse_frozen_requirements
frozen_reqs = ['numpy==1.21.0', 'pandas==1.3.0']
installed = parse_frozen_requirements(frozen_reqs)
print(installed)
# Output: {'numpy': Version('1.21.0'), 'pandas': Version('1.3.0')}
Check Package Installation
from comet_pip_utils import is_pip_installed_package
# Check if a package is installed with version constraint
packages = get_pip_packages()
is_installed = is_pip_installed_package('numpy>=1.20.0', packages)
print(is_installed) # True or False
Install Packages Programmatically
from comet_pip_utils import pip_install_packages
# Install a single package
errors = pip_install_packages('requests')
# Install multiple packages
errors = pip_install_packages(['requests', 'numpy'])
# Install with flags
errors = pip_install_packages('requests', flags=['--user', '--no-deps'])
Unload Packages
from comet_pip_utils import unload_package
# Unload a package from memory
unload_package('numpy==1.21.0')
Extract Package Names
from comet_pip_utils import extract_package_name
# Extract package name from requirement string
package_name = extract_package_name('numpy>=1.20.0')
print(package_name) # 'numpy'
API Reference
Functions
get_pip_packages()- Get list of installed packagesparse_frozen_requirements(frozen_reqs)- Parse frozen requirements into version dictis_pip_installed_package(package_name, packages)- Check if package satisfies requirementpip_install_packages(packages, flags=None)- Install packages with optional flagsunload_package(qualified_name)- Unload package from memoryextract_package_name(package_name)- Extract package name from requirement string
Requirements
- Python 3.7+
- packaging>=21.0
License
Proprietary - Copyright (C) 2015-2023 Comet ML INC
This file can not be copied and/or distributed without the express permission of Comet ML Inc.
Metadata
Release files for comet-pip-utils 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| comet_pip_utils-0.2.0.tar.gz | 9.4 kB | Without provenance | Details for comet_pip_utils-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| comet_pip_utils-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for comet_pip_utils-0.2.0-py3-none-any.whl |
Total release size: 19.6 kB
Release files / comet_pip_utils-0.2.0.tar.gz
| Download URL | comet_pip_utils-0.2.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4000ca348799b70a5183ccde5e3874ee525fb941a3975d67b559143a96f9b843
|
|
BLAKE2b-256 checksum How to use checksums |
527a1002e78a787faf4cd5030072a2f1fdf85f91287f5da5874c6a786b745137
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / comet_pip_utils-0.2.0-py3-none-any.whl
| Download URL | comet_pip_utils-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
609a14c903c66fd6ba6dfb8ff41104a8d31b3c952932df72e523d5f080cee511
|
|
BLAKE2b-256 checksum How to use checksums |
f124748e0f46116b392d6d63ed26395b70150689dd6ef4fe0e6432248a98263a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Security for comet-pip-utils 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.