A package that installs and imports a Python package if it's not found.
Project description
Install n' Use
Install n' Use is a Python script designed to automate the installation, upgrade, and management of Python packages. It ensures that required packages are installed and upgraded if necessary, and handles errors gracefully if packages are not found.
Features
- Install packages: Automatically installs a package if it is not found.
- Install specific versions: Installs a specific version of a package.
- Upgrade packages: Upgrades a package to the latest version.
- Upgrade specific versions: Upgrades a package to a specific version.
Functions
install(package)
Installs a package if it is not found on your system.
Arguments:
package(str): The name of the package to install.
Example:
install("tkinter")
install_specific(package, version, name)
Installs a specific version of a package and assigns it to a custom variable name.
Arguments:
package(str): The name of the package to install.version(str): The version of the package to install.name(str): The name to assign the installed package.
Example:
install_specific("numpy", "1.21.0", "np")
upgrade(package)
Upgrades a package to the latest version.
Arguments:
package(str): The name of the package to upgrade.
Example:
upgrade("requests")
upgrade_specific(package, version, name)
Upgrades a package to a specific version and assigns it to a custom variable name.
Arguments:
package(str): The name of the package to upgrade.version(str): The version of the package to upgrade to.name(str): The name to assign the upgraded package.
Example:
upgrade_specific("requests", "2.26.0", "req")
Error Handling
- If a package is not found, the script attempts to install it.
- If the package installation or upgrade fails, an exception will be raised:
PyPIError: Package not Found on PyPI.
Installation
To use Install n' Use, simply download the script and include it in your project.
Requirements
- Python 3.x
pip(Python's package installer)
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file install_n_use-1.0.tar.gz.
File metadata
- Download URL: install_n_use-1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bcb7d2aa326d326e067ba93baf5b7d1807c012101fa2a7f1c5b9bdb3e4cfb63
|
|
| MD5 |
4f06b5bb0c567da87eb965a90609f84d
|
|
| BLAKE2b-256 |
7c90c7fbb7b6b8babb033d4bec8317fd8f7f25c43f84718421b2a12307a68410
|
File details
Details for the file install_n_use-1.0-py3-none-any.whl.
File metadata
- Download URL: install_n_use-1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
161ba46ac1cda544ef33fa03359e49782bbd9d5eea701175ced7706a6c9b1f40
|
|
| MD5 |
98e45152c24068ef77e6be52ee7de0c2
|
|
| BLAKE2b-256 |
f5f202c0ee9898cd2a6b2bce4b6df3f942398fc34309bc75b017f5277ec6bc71
|