https://github.com/xxh/xxh-plugin-prerun-python
python xxh plugin
https://github.com/xxh/xxh-plugin-prerun-python
xxh xxh-plugin
Last synced: about 2 months ago
JSON representation
python xxh plugin
- Host: GitHub
- URL: https://github.com/xxh/xxh-plugin-prerun-python
- Owner: xxh
- Created: 2020-04-11T13:22:22.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-27T08:35:06.000Z (about 3 years ago)
- Last Synced: 2024-11-04T22:37:07.268Z (7 months ago)
- Topics: xxh, xxh-plugin
- Language: Shell
- Homepage:
- Size: 8.79 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This plugin contains portable [Python 3.8 AppImage](https://github.com/niess/python-appimage/releases) 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/pythonmyhost> python
Python 3.8.2
>>>
```
### [PyPi](https://pypi.org/)
```
myhost> pip install pandas
myhost> python
>>> import pandas
```Packages location comply with [hermetic principle](https://github.com/xxh/xxh/wiki#the-ideas-behind-xxh) and the same as used in [xxh-shell-xonsh](https://github.com/xxh/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
```bash
xxh +RI xxh-plugin-prerun-sudo xxh-plugin-prerun-python
xxh myhost +s zsh +ifmyhost> pip install fastapi uvicorn && mkdir api && cd api
myhost> echo -e 'from fastapi import FastAPI; app = FastAPI()\[email protected]("/")\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"}
```