diff --git a/CHANGELOG.md b/CHANGELOG.md index 60dc87f..f07c7b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.7.0: Added Function to Install Packages +- Introduced the `install_package` function, allowing packages to be installed directly through the app. + - Useful for optional dependencies that need to be installed separately. This enables installation via the UI. + +--- + ## 0.6.x ### 0.6.1: Classifier - Added Classifier for pypi diff --git a/pyproject.toml b/pyproject.toml index e0c386a..2aeb735 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ readme = "README.md" requires-python = ">=3.8" dependencies = ["requests", "packaging"] classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", diff --git a/src/PyPiUpdater/pypi_updater.py b/src/PyPiUpdater/pypi_updater.py index 4c5b835..3203ddb 100644 --- a/src/PyPiUpdater/pypi_updater.py +++ b/src/PyPiUpdater/pypi_updater.py @@ -146,3 +146,14 @@ class PyPiUpdater: """Write data to JSON log file.""" with open(self.log_path, "w") as f: json.dump(data, f, indent=4) + + @staticmethod + def install_package(package_name): + """Attempts to install a package via pip.""" + try: + subprocess.run([sys.executable, "-m", "pip", "install", package_name], check = True) + print("Successfull") + return [True, f"{package_name} installed successfully!"] + except subprocess.CalledProcessError as e: + print("Failed") + return [False, f"Failed to install {package_name}:\n{e.stderr}"]