Metadata-Version: 2.4
Name: mlflow-cynex
Version: 0.1.14
Summary: Cynex trajectory viewer integration for MLflow
Project-URL: Homepage, https://github.com/user/cynex
Project-URL: Documentation, https://github.com/user/cynex#readme
Project-URL: Repository, https://github.com/user/cynex
Project-URL: Issues, https://github.com/user/cynex/issues
Author: Cynex Team
License-Expression: MIT
Keywords: cybersecurity,mlflow,reinforcement-learning,trajectories,visualization
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
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
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.9
Requires-Dist: mlflow>=2.0.0
Description-Content-Type: text/markdown

# mlflow-cynex

Cynex trajectory viewer integration for MLflow. Adds a "View in Cynex" button to MLflow's artifact browser for trajectory JSON files.

## Installation

```bash
pip install mlflow-cynex
mlflow-cynex install
```

Then restart your MLflow server.

## Usage

### Logging Trajectories

The package provides a helper function to log trajectories to MLflow:

```python
from mlflow_cynex import log_trajectory
import mlflow

mlflow.set_tracking_uri("http://localhost:5000")

with mlflow.start_run():
    trajectory = {
        "blue_agent_name": "PPO",
        "red_agent_name": "Meander",
        "episode": 0,
        "blue_actions": [...],
        "red_actions": [...],
        "metric_scores": [...],
        "network_topology": {...}
    }
    log_trajectory(trajectory)
```

The trajectory is automatically:
- Validated against the expected schema
- Saved to `trajectories/<name>-trajectory.json` in MLflow artifacts

### Custom Naming

```python
log_trajectory(trajectory, name="my-custom-name")
# Saved as: trajectories/my-custom-name.json
```

### Validation Only

```python
from mlflow_cynex import validate_trajectory, TrajectoryValidationError

try:
    validate_trajectory(data)
except TrajectoryValidationError as e:
    print(f"Invalid trajectory: {e}")
```

## Trajectory Detection

The "View in Cynex" button appears for JSON files that:
- Are in a `trajectories/` folder, OR
- Match `*-trajectory.json` or `*_trajectory.json` pattern

## CLI Commands

```bash
mlflow-cynex install    # Install Cynex viewer into MLflow
mlflow-cynex uninstall  # Remove Cynex viewer from MLflow
mlflow-cynex status     # Check installation status
```

## Development

Build from source:

```bash
cd cynex/mlflow-integration
./scripts/build.sh
pip install dist/mlflow_cynex-*.whl
```

## License

MIT
