Skip to content

xxh/xxh-plugin-prerun-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This plugin contains portable Python 3.8 AppImage which can be used on host without python.

Install

From xxh repo:

xxh +I xxh-plugin-prerun-python

From any repo:

xxh +I xxh-plugin-prerun-python+git+https://github.com/xxh/xxh-plugin-prerun-python

Connect:

xxh myhost +if

Usage

myhost> which python
/home/ubuntu/.xxh/.xxh/plugins/xxh-plugin-prerun-python/build/python/python

myhost> python
Python 3.8.2 
>>>
myhost> pip install pandas
myhost> python 
>>> import pandas

Packages location comply with hermetic principle and the same as used in xxh-shell-xonsh:

xxh command pip packages home user home
xxh myhost +s bash /home/user/.xxh/.local /home/user/.xxh
xxh myhost +s bash +hhh '~' /home/user/.xxh/.local /home/user
xxh myhost +s bash +hhh '~' +hhx '~' /home/user/.local /home/user

Examples

Usage xxh python with xxh sudo to run http server with API

xxh +RI xxh-plugin-prerun-sudo xxh-plugin-prerun-python
xxh myhost +s zsh +if

myhost> pip install fastapi uvicorn && mkdir api && cd api
myhost> echo -e 'from fastapi import FastAPI; app = FastAPI()\n@app.get("/")\ndef read_root():\n return {"xxh": "https://github.com/xxh/xxh"}' > main.py 
myhost> xxh-sudo uvicorn main:app --reload --host 0.0.0.0 --port 80                                                     
INFO: Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
$ curl http://myhost/                                                                                       
{"xxh":"https://github.com/xxh/xxh"}

Releases

No releases published

Languages