Metadata-Version: 2.1
Name: simvue
Version: 1.0.0.dev4
Summary: Simulation tracking and monitoring
License: Apache v2
Author: Simvue Development Team
Author-email: info@simvue.io
Requires-Python: >=3.9,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: dataset
Provides-Extra: plot
Provides-Extra: torch
Requires-Dist: PyJWT (>=2.8.0,<3.0.0)
Requires-Dist: colorama (>=0.4.6,<0.5.0)
Requires-Dist: dill (>=0.3.7,<0.4.0)
Requires-Dist: matplotlib (>=3.8.2,<4.0.0) ; extra == "plot"
Requires-Dist: msgpack (>=1.0.7,<2.0.0)
Requires-Dist: numpy (>=1.26.3,<2.0.0) ; extra == "dataset"
Requires-Dist: pandas (>=2.2.0,<3.0.0) ; extra == "dataset"
Requires-Dist: plotly (>=5.18.0,<6.0.0) ; extra == "plot"
Requires-Dist: psutil (>=5.9.8,<6.0.0)
Requires-Dist: pydantic (>=2.5.3,<3.0.0)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: tenacity (>=8.2.3,<9.0.0)
Requires-Dist: toml (>=0.10.2,<0.11.0)
Requires-Dist: torch (>=2.1.2,<3.0.0) ; (python_version < "3.12") and (extra == "torch")
Description-Content-Type: text/markdown

# Simvue Python client

<br/>

<p align="center">
  <img src="simvue-black.png" width="500" alt="Simvue" />
</p>  
 
<p align="center"> 
Collect metadata, metrics and artifacts from simulations, processing and AI/ML training tasks running on any platform, in real time.
</p>

<div align="center">
<a href="https://github.com/simvue-io/client/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/github/license/simvue-io/client"/></a>
<a href="https://pypi.org/project/simvue/" target="_blank"><img src="https://img.shields.io/pypi/v/simvue.svg"/></a>
<a href="https://pepy.tech/project/simvue"><img src="https://static.pepy.tech/badge/simvue"/></a>
<a href="https://github.com/simvue-io/client/actions/workflows/python-app.yml"><img src="https://github.com/simvue-io/client/actions/workflows/python-app.yml/badge.svg"/></a>
</div>

<h3 align="center">
 <a href="https://simvue.io"><b>Website</b></a>
  •
  <a href="https://docs.simvue.io"><b>Documentation</b></a>
</h3>

## Configuration
The service URL and token can be defined as environment variables:
```
export SIMVUE_URL=...
export SIMVUE_TOKEN=...
```
or a file `simvue.ini` can be created containing:
```
[server]
url = ...
token = ...
```
The exact contents of both of the above options can be obtained directly by clicking the **Create new run** button on the web UI. Note that the environment variables have preference over the config file.

## Usage example
```
from simvue import Run

...

if __name__ == "__main__":

    ...

    # Using a context manager means that the status will be set to completed automatically,
    # and also means that if the code exits with an exception this will be reported to Simvue
    with Run() as run:

        # Specify a run name, metadata (dict), tags (list), description, folder
        run.init('example-run-name',
                 {'learning_rate': 0.001, 'training_steps': 2000, 'batch_size': 32}, # Metadaata
                 ['tensorflow'],                                                     # Tags
                 'This is a test.',                                                  # Description
                 '/Project-A/part1')                                                 # Folder full path

        # Set folder details if necessary
        run.set_folder_details('/Project-A/part1',                     # Folder full path
                               metadata={},                            # Metadata
                               tags=['tensorflow'],                    # Tags
                               description='This is part 1 of a test') # Description

        # Upload the code
        run.save('training.py', 'code')

        # Upload an input file
        run.save('params.in', 'input')

        # Add an alert (the alert definition will be created if necessary)
        run.add_alert(name='loss-too-high',   # Name
                      source='metrics',       # Source
                      rule='is above',        # Rule
                      metric='loss',          # Metric
                      frequency=1,            # Frequency
                      window=1,               # Window
                      threshold=10,           # Threshold
                      notification='email')   # Notification type

        ...

        while not converged:

            ...

            # Send metrics inside main application loop
            run.log({'loss': 0.5, 'density': 34.4})

            ...

        # Upload an output file
        run.save('output.cdf', 'output')

        # If we weren't using a context manager we'd need to end the run
        # run.close()
```

## License

Released under the terms of the [Apache 2](https://github.com/simvue-io/client/blob/main/LICENSE) license.

