Metadata-Version: 2.1
Name: osef
Version: 3.3.0
Summary: Osef python library.
Author-email: Outsight Developpers <support@outsight.tech>
Project-URL: Documentation, https://outsight-tech.gitlab.io/common/osef-python-library/
Project-URL: Support, https://support.outsight.ai
Project-URL: Changes, https://outsight-tech.gitlab.io/common/osef-python-library/CHANGELOG.html
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21.0

# OSEF library

Library containing utilities to read and parse a stream, live or recorded, retrieved from
**Shift**.

The stream is in the **OSEF** format (**O**pen **SE**rialization **F**ormat):
it's an Outsight-defined serialisation binary format used to encode data streaming out of Shift. 
It is based on *TLV-encoding*.

For the full documentation, see: [Developer documentation](https://outsight-tech.gitlab.io/common/osef-python-library/).  
You can contact us @ https://support.outsight.ai

## Installation
Install from PyPi using pip:
```bash
pip install osef
``` 
## Usage

Open and parse an osef file or stream: 

```python
import osef

osef_path = "path/to/my/file.osef"
# or osef_path="tcp://192.168.2.2:11120"

for frame_dict in osef.parse(osef_path):
    print(frame_dict)
```

Additional parameters:
- `first`/`last`: the first and the last frame to parse
- `auto_reconnect`: enable parser auto_reconnection (default: `True`)
- `real_frequency`: If False, parse data as fast as your computer can. If True, process the data as the same pace as the real time stream from Shift (default: `False`)
- `lazy`: If lazy, the dict only unpack the values when they are accessed to save up resources (default: `True`)


To find more code samples, see [Outsight Code Samples repository](https://gitlab.com/outsight-public/outsight-code-samples/-/tree/master).

## Development

1. The repository uses LFS to store some large OSEF samples for the tests. You need to install `git-lfs` and then run the following commands to get the files.
```bash
git lfs pull
```

2. Install project and dependencies.
  - create and activate venv (`python -m venv venv`, then `source venv/bin/activate`)
  - `pip install -e .` to install the project
  - `pip install -r test_requirements.txt` to install dev dependencies (formatter, linter, unit tests dependencies)

3. **Linting**. Code is compatible with python 3.8+, pylint is set to ensure compatibility with python 3.8. To quickly run black + pylint,
```bash
./devops/local_lint.sh
```

4. **Unit tests**. We use pytest. Some tests might take time (about a couple of minutes)
```bash
pytest tests/
```
