Metadata-Version: 2.4
Name: qdrive
Version: 0.3.0b2
Summary: Dataset management and measurement library for scientific data
Author: QHarbor team
License-Expression: LicenseRef-Proprietary
Project-URL: Homepage, https://qharbor.nl
Project-URL: Documentation, https://docs.qharbor.nl
Keywords: dataset,qcodes,data-management,hdf5,scientific-data,measurement,xarray
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENCE
Requires-Dist: PyYAML>=6.0.0
Requires-Dist: platformdirs>=4.0.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: xarray>=2024.1.0
Requires-Dist: h5py>=3.0.0
Requires-Dist: h5netcdf>=1.0.0
Requires-Dist: qcodes>=0.44.0
Requires-Dist: packaging>=20.0
Requires-Dist: tabulate>=0.9.0
Requires-Dist: tqdm>=4.0.0
Requires-Dist: prettytable>=3.0.0
Requires-Dist: etiket-client>=0.3.0b2
Requires-Dist: etiket-service-manager>=0.3.0b2
Requires-Dist: etiket-sync-agent-folderbase
Dynamic: license-file

# qdrive

**Dataset management and measurement library for the qHarbor data platform.**

qdrive is the Python interface for creating, managing, and syncing scientific datasets with [qHarbor](https://qharbor.nl).

## Features

- 📦 **Create & manage datasets** — Store measurements with rich metadata (tags, attributes, descriptions)
- 📁 **Multi-file support with versioning** — Attach xarray, NumPy, JSON, HDF5 or any file, with automatic version tracking
- 🔍 **Powerful search** — Filter datasets by attributes, date range, tags, or text
- ☁️ **Cloud sync** — Automatic synchronization via the sync agent
- 📊 **Measurement tools** — Built-in `do0D`, `do1D`, `do2D` sweep functions using native qHarbor format, compatible with QCoDeS parameters

## Installation

```bash
pip install qdrive
```

To install the background services (syncs your data to qHarbor automatically):

```bash
etiket-services install
```

Other useful commands (though the service is managed automatically in the background):

```bash
etiket-services status      # Check service status
etiket-services start       # Start services
etiket-services stop        # Stop services
etiket-services restart     # Restart services
etiket-services update      # Update packages
etiket-services update --no-backends  # Update core packages only
etiket-services uninstall   # Remove services
```

For programmatic control of the sync agent (managing sync sources, viewing sync status, debugging), see the [etiket-sdk](https://pypi.org/project/etiket-sdk/) package. You can also manage the services through the [DataQruiser](https://docs.qharbor.nl/dataqruiser_releases.html) desktop application.

## Quick Start

### Authentication

```python
import qdrive.authenticate as qauth

# See available institutions and login methods
qauth.print_login_methods()

# Log in with SSO (opens browser)
qauth.log_in_with_sso("MyInstitution")

# Check if logged in
qauth.is_logged_in()  # Returns True/False

# Log out
qauth.logout()
```

### Scopes

```python
from qdrive.scopes import get_scopes, set_default_scope

# List available scopes
get_scopes()

# Set default scope (by name or UUID)
set_default_scope("MyScope")
```

### Create a dataset

```python
from qdrive import dataset

ds = dataset.create(
    'Qubit T2* measurement',
    tags=['calibration'],
    attributes={'sample': 'Q7-R3', 'fridge': 'BlueFors-1'}
)
```

### Add files to a dataset

```python
import numpy as np
import xarray as xr

# Add various file types
ds['config.json'] = {'param1': 42, 'param2': 'value'}
ds['raw_data.npz'] = np.random.rand(100, 100)
ds['measurement.hdf5'] = xr.Dataset({'signal': (['time'], np.sin(np.linspace(0, 10, 100)))})
ds['script.py'] = __file__  # Attach the current script
```

### Retrieve and access data

```python
from qdrive import dataset

ds = dataset('59c40af3-cef3-49aa-8747-64707a9b080a')  # Load by UUID

# Access files in multiple formats
xr_data = ds['measurement.hdf5'].xarray
json_data = ds['config.json'].json
```

### Search datasets

```python
from qdrive.dataset.search import search_datasets

results = search_datasets(
    search_query='T2*',
    attributes={'sample': 'Q7-R3'},
    ranking=1
)

for ds in results:
    print(ds.name, ds.uuid)
```

## Documentation

- 📖 [Full Documentation](https://docs.qharbor.nl)
- 🖥️ [DataQruiser App](https://docs.qharbor.nl/dataqruiser_releases.html) — Browse and visualize your data
- 💬 [Support](mailto:support@qharbor.nl)

## License

Proprietary — © 2026 QHarbor B.V. All Rights Reserved.
