An open API service indexing awesome lists of open source software.

https://github.com/jelmerro/tppr

Tiny Portable Python Runner for hassle-free venv and dep handling
https://github.com/jelmerro/tppr

bash pip python python-venv virtual-env

Last synced: 20 days ago
JSON representation

Tiny Portable Python Runner for hassle-free venv and dep handling

Awesome Lists containing this project

README

          

tppr
====

Tiny Portable Python Runner for hassle-free venv and dep handling

## Features

- Tiny command-line bash script to create and update venv versions
- Check if an existing venv (virtual env) is present and use that to run
- Automatically create/recreate the venv if needed (such as after updating Python)
- Installs dependencies from both requirements.txt and pyproject.toml in the venv
- Runs the provided file as-is within the activated venv without calling cd ever
- Supports the -c Python argument to pass code directly and have it run in the venv

## Install

### Curl

```bash
curl -L https://raw.githubusercontent.com/Jelmerro/tppr/refs/heads/master/tppr -o ~/.local/bin/tppr
chmod +x ~/.local/bin/tppr
```

### [Github](https://github.com/Jelmerro/tppr/releases)

Download a stable installer or executable for your platform from Github.

### [Fedora](https://jelmerro.nl/fedora)

I host a custom Fedora repository that you can use for automatic updates.

```bash
sudo dnf config-manager addrepo --from-repofile=https://jelmerro.nl/fedora/jelmerro.repo
sudo dnf install tppr
```

## Usage

Once installed, simply run `tppr` with a Python script as an argument.
This will make a venv with Python and all the deps, then run the script with it.
With `tppr ~/projects/example/file.py ` you can pass all args to the Python script.
You can also supply options to tppr if you include them before the filename,
please see `tppr -h` for help, advanced usage and additional options.

## Contribute

You can support my work on [ko-fi](https://ko-fi.com/Jelmerro) or [Github sponsors](https://github.com/sponsors/Jelmerro).
Another way to help is to report issues or suggest new features.
Please try to follow recommendations by shellcheck when developing.
For an example vimrc that can auto-format based on the included linters,
you can check out my personal [vimrc](https://github.com/Jelmerro/vimrc).

## Building

To create your own builds you can use [jfpm](https://github.com/Jelmerro/jfpm).
Please clone or download both this repo and jfpm, then run `../jfpm/release_sh_simple.sh`.
This will build releases for various platforms and output them to `dist`.