From 6307fb9f0ce05db39c7ed974092f7b05a1038b5c Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Fri, 1 Nov 2024 19:09:57 +0000 Subject: [PATCH] add some instructions to use pip install --- .gitignore | 2 ++ python/README.md | 29 ++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7b8c4c5..5483edf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ /cpp/build/ /python/petsird/ __pycache__/ +build/ +petsird.egg-info/ # Common editor backups /.vscode/ diff --git a/python/README.md b/python/README.md index 4dc83c6..4f682e3 100644 --- a/python/README.md +++ b/python/README.md @@ -1,6 +1,33 @@ # PETSIRD basic Python example -This directory contains some Python example code to read/write PETSIRD data. You need to `yardl generate` in the `model` directory first. +This directory contains some Python example code to read/write PETSIRD data. + +## Pre-installation + +You will need the Python files generated by yardl. You have a few options. + +### Use PyPI + +```sh +python3 -m venv ~/petsirdenv +source ~/petsirdenv/bin/activate +pip install petsird +``` + +### Use the model files from your local clone + +(This option needs the `yardl` binary, either download it, or use our devcontainer or GitHub CodeSpace.) + +You need to `yardl generate` in the `model` directory first. This will create the Python package files in a `petsird` +subfolder. Optionally install those into your venv +```sh +python3 -m venv ~/petsirdenv +source ~/petsirdenv/bin/activate +cd python +pip install . +``` + +## Usage The Python code shows piping the compact binary format to standard out and reading it from standard in. This can be used as follows: