A lightweight opensource package manager and shell
LightPack Package Manager
LightPack is a lightweight package manager that allows you to easily download, install, and run custom Python packages from a remote repository.
Install packages with a simple command.
Run installed packages directly from the LightPack shell.
Automatically fetch required dependencies.
Easy-to-use interactive shell.
Clone the Repository
To use LightPack, clone the repository:
curl -O https://raw.githubusercontent.com/QKing-Official/LightPack/main/package_manager.pyFor the whole repo (with all packages):
git clone https://github.com/QKing-Official/LightPack.gitcd LightPackStart the interactive shell by running:
python package_manager.pyOnce inside the LightPack shell, you can use the following commands:
Install a Package
To install a package, use:
lightpack-shell> installExample:
lightpack-shell> install hello-worldRun an Installed Package
To run an installed package, use:
lightpack-shell> runExample:
lightpack-shell> run hello-worldClear the screen:
lightpack-shell> clearAsk for help:
lightpack-shell> helpUpdate a package:
lightpack-shell> update <packagename>Exit the Shell
To exit LightPack, use:
lightpack-shell> exitFor community packages installation guide scroll down.
Here are some (useful) packages available for installation:
hello-world – Prints "Hello, World!"
network-info - Gives information about your network.
sys-info - Gives information about your system.
These are all official, if you want to make you own or install community packages. Scroll down.
You can create your own packages and host them in the repository.
Package Structure
Each package should have:
A main script: .py
An installer script: install.py
Example structure:
/packages/
/hello-world/
hello-world.py
install.py
Adding Your Package to LightPack (alternative databases for packages comming soon!)
Add your package to the packages/ directory.
Here is the format for making a package.
#my_package.py
def main_functionality():
"""Implement the core functionality of your package."""
print("This is where the main functionality goes.")
if __name__ == "__main__":
main_functionality()#install.py
import os
import sys
import subprocess
def install():
print("Installing My Package...")
# Ensure the package directory exists
package_dir = os.getcwd() # Current directory
script_path = os.path.join(package_dir, "my_package.py")
if not os.path.exists(script_path):
print(f"Error: {script_path} does not exist.")
return
# List of dependencies to install
dependencies = ["requests", "numpy", "pandas"] # Example dependencies
try:
# Install dependencies
for dependency in dependencies:
print(f"Installing {dependency}...")
subprocess.run([sys.executable, "-m", "pip", "install", dependency], check=True)
print(f"{dependency} installed successfully.")
print("My Package installed successfully!")
except Exception as e:
print(f"Error during installation: {e}")
if __name__ == "__main__":
install()Your package is done! (You can install it when you clone whole repo) More on publication on packages in the next part
To make a package repository you need to make a repository on github first. Structure the repository like this:
lightpackages/
│── repo.json
│
└── packages/
├── example/
│ ├── install.py
│ ├── example.py
│
├── another_package/
│ ├── install.py
│ ├── another_package.pyThe repo.json needs to contain basic data of your repository Structure it like this:
{
"name": "Example",
"url": "https://raw.githubusercontent.com/USER/REPOSITORYNAME/main/packages"
}Replace 'Example' with the name you want your repo to be showed as inside Lightpack. Replace 'USER' with your Github username and 'REPOSITORYNAME' with the name of your repository. The packages or put in the packages directory and are structured as explained before.
Now all users can install your packages with the following guide:
Add the repository to the community packages inside Lightpack
lightpack-shell> addrepo REPO_URL_FROM_REPO.JSONReplace 'REPO_URL_FROM_REPO.JSON' with the url of the repository.
Install packages from the repository:
lightpack-shell> install PACKAGENAME:REPONAMEReplace 'PACKAGENAME' with the name of the package you want to install and 'REPONAME' with the name of the repo (from the repo.json).
You can uninstall packages without the need of the :REPONAME section.
If you want to see what repositories you have added. Run the following command inside of Lightpack:
lightpack-shell> listreposIt will show all the names of the repositories you added.
If you want to remove a repository, run the following command:
lightpack-shell> removerepo REPONAMEreplace 'REPONAME' witht the name of the repo (what you saw in the listrepo command).
Contributing Feel free to contribute new packages or improve existing ones. Fork the repo, make your changes, and submit a pull request.