Metadata-Version: 2.4
Name: shortwing
Version: 0.2.1
Summary: Lightweight async CLI for Dimensions DSL queries
License: MIT
License-File: LICENSE
Keywords: async,cli,dimensions,dsl,research
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT 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
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: click>=8.3.1
Requires-Dist: httpx>=0.27.0
Description-Content-Type: text/markdown

# Shortwing

[![PyPI version](https://img.shields.io/pypi/v/shortwing)](https://pypi.org/project/shortwing/)
[![Python versions](https://img.shields.io/pypi/pyversions/shortwing)](https://pypi.org/project/shortwing/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<p align="left">
  <img src="shortwing.jpg" alt="Himalayan Shortwing" width="200">
</p>

Lightweight CLI wrapper for Dimensions DSL queries via dimcli.

## Installation

```bash
pip install shortwing
```

## Usage

```bash
# Query as argument
shortwing "search grants for \"malaria\" return researchers"

# Query from stdin
echo 'search grants for "malaria"' | shortwing

# With subcommand
shortwing query "search grants return grants"

# Compact JSON output
shortwing --compact "search grants"

# Use a specific instance from dsl.ini
shortwing --instance test "search grants"
```

## Configuration

Credentials are loaded in the following order of priority:

1. **CLI flags** (`--key`, `--endpoint`)
2. **Environment variables** (`DIMENSIONS_KEY`, `DIMENSIONS_ENDPOINT`)
3. **dsl.ini file** (default)

### Using dsl.ini (Recommended)

Shortwing uses the same `dsl.ini` configuration file as dimcli. Create the file at `~/.dimensions/dsl.ini`:

```ini
[instance.live]
url=https://app.dimensions.ai
login=
password=
key=your-api-key
```

You can define multiple instances and select them with `--instance`:

```ini
[instance.live]
url=https://app.dimensions.ai
key=your-live-key

[instance.test]
url=https://test.dimensions.ai
key=your-test-key
```

```bash
shortwing --instance test "search grants"
```

### Using Environment Variables

```bash
export DIMENSIONS_KEY=your-api-key
export DIMENSIONS_ENDPOINT=https://app.dimensions.ai  # optional
```

### Using CLI Flags

```bash
shortwing --key your-api-key "search grants"
shortwing --key your-api-key --endpoint https://custom.endpoint.com "search grants"
```

### Development

```bash
uv pip install .
```



## Exit Codes

- 0: Success
- 1: Query/API error
- 2: Configuration/authentication error
