diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb07fc1..276fe72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: cppVersion: [17] environment: pypi permissions: {id-token: write} - name: Validate Python and C++${{ matrix.cppVersion }} + name: Validate Python and C++${{ matrix.cppVersion }} and deploy to PyPI runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 7b8c4c5..ee6a3b1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ /cpp/build/ /python/petsird/ __pycache__/ +/python/build/ +/python/petsird.egg* # Common editor backups /.vscode/ diff --git a/README.md b/README.md index 6db6314..7806c18 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PETSIRD draft data model and examples -The purpose of this repo is to have a simple working example of a data model for PET imaging (list mode data). This is **not complete**, and aspects do not follow the actual proposal of PETSIRD yet. +The purpose of this repo is to have a working example of a data model for PET imaging (list mode data). This is **not complete**, and aspects do not follow the actual proposal of PETSIRD yet. ## Background @@ -9,9 +9,13 @@ is working towards establishing a standard for PET Raw Data, called PETSIRD ("PE The specification uses the [yardl](https://aka.ms/yardl) tool to define the model. `yardl` can be used to read the specification (in the `model` directory) and -generate an SDK for both C++ and API to read/write PETSIRD data. +generate an SDK for both C++ and Python to read/write PETSIRD data. -## To get started quickly: +## To get started as a Python user: + +If you don't want to modify the yardl model, clone this repository and follow instructions in the [`python/README.md`](python/README.md). + +## To get started quickly as a developer: 1. Open this repo in [GitHub Codespaces](https://code.visualstudio.com/docs/remote/codespaces) or in a [VS Code devcontainer](https://code.visualstudio.com/docs/devcontainers/containers). @@ -26,3 +30,5 @@ This codespace/container will contain all necessary tools, including `yardl` its 4. Have a look at (and try!) the examples in the [`cpp`](cpp/README.md) and/or [`python`](python/README.md) directories. + + diff --git a/python/README.md b/python/README.md index 4dc83c6..e4eba3f 100644 --- a/python/README.md +++ b/python/README.md @@ -1,6 +1,31 @@ # 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. + +## Install + +Some python code is generated by `yardl` and included in the PyPI distribution. + +```sh +python3 -m venv ~/petsirdenv +source ~/petsirdenv/bin/activate +pip install petsird +``` + +## Local Development + +(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. + +```sh +cd ../model +yardl generate +pip install --editable ../python +``` + +## 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: diff --git a/python/README.pypi.md b/python/README.pypi.md new file mode 100644 index 0000000..6cd14cb --- /dev/null +++ b/python/README.pypi.md @@ -0,0 +1,10 @@ +# PETSIRD Python SDK + +The [Emission Tomography Standardization Initiative (ETSI)](https://etsinitiative.org/) +is working towards establishing a standard for PET Raw Data, called PETSIRD ("Positron Emission Tomography Standardization Initiative Raw Data"). + +Read & write PETSIRD data in Python. + +## Examples + +See [ETSInitiative/PETSIRD:python](https://github.com/ETSInitiative/PETSIRD/tree/main/python). diff --git a/python/pyproject.toml b/python/pyproject.toml index b15f89a..8c292b9 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "petsird" dynamic = ["version"] description = "Library and tools for working with PET Emission Tomography Standardization Initiative Raw Data (PETSIRD) data" -readme = "README.md" +readme = "README.pypi.md" authors = [ # TODO {name = "Kris Thielemans", email = "k.thielemans@ucl.ac.uk"}, @@ -28,7 +28,9 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3 :: Only"] + "Programming Language :: Python :: 3 :: Only", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering :: Medical Science Apps."] [tool.setuptools.packages.find] include = ["petsird", "petsird.*"]