Skip to main content

Install-Preserve

Install-Preserve is a Python library that helps detect already installed packages and removes them from the install_requires list within the setup.py file. This prevents accidentally overwriting hand-compiled libraries such as OpenCV, PyTorch, or TensorFlow.

Usage

from setuptools import setup

try:
    from install_preserve import preserve
except ImportError:
    import pip
    pip.main(['install', 'install-preserve'])
    from install_preserve import preserve
    

requirements = [
    'pyyaml',
    'tqdm',
    'numpy',
    'easydict==1.9.0',
    'scikit-image==0.17.2',
    'scikit-learn==0.24.2',
    'joblib',
    'matplotlib',
    'pandas',
    'albumentations==0.5.2',
    'hydra-core==1.1.0',
    'tabulate',
    'webdataset',
    'packaging',
    'wldhx.yadisk-direct',
    'opencv-python',
    'torch==2.0.0'
]

excludes = [
    'tqdm',
    'opencv-python:cv2',  # Note the colon delimited statement to illustrate <package-name>:<import alias>
    'torch'
]
requirements = preserve(requirements, excludes, verbose=True)

setup(
    name='your_package',
    version='1.0',
    install_requires=requirements,
    # Other setup options...
)

Example Output

excluding package tqdm as it is already installed
excluding package opencv-python as it is already installed
excluding package pytorch as it is already installed

Installation

To install, you can use pip:

pip install install-preserve

License

This library is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues on the GitHub repository.

Metadata

Release files for install-preserve 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for install-preserve 0.1.0
File Size Uploaded Provenance Actions
install-preserve-0.1.0.tar.gz 3.2 kB Without provenance Details for install-preserve-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for install-preserve 0.1.0
File Interpreter ABI Platform Actions
install_preserve-0.1.0-py3-none-any.whl Python 3 none any Details for install_preserve-0.1.0-py3-none-any.whl

Total release size: 7.0 kB

Release files / install-preserve-0.1.0.tar.gz

Download URL install-preserve-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1134fbe844d5e9726d88fb765f4e6f1d153d1e97dae51e87103ac80c9ef92955
BLAKE2b-256 checksum
How to use checksums
2aa485b53a3fc96b5795cc85b20576735fa01d8aa83cf0660f6c20a164061480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / install_preserve-0.1.0-py3-none-any.whl

Download URL install_preserve-0.1.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4287415ebdfb7050fb3a412509dc4ef4e4331f6f03ec0747e97f31d3447532ab
BLAKE2b-256 checksum
How to use checksums
5b4d1ec0e189d8fa29d38028201851006056dba8e696a3817044f37c3cf60c81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Security for install-preserve 0.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page