Metadata-Version: 2.4
Name: labtab
Version: 0.1.0
Summary: Command-line interface for LabTab (Wetware Ltd). Manage your lab from the terminal.
Author-email: Wetware Ltd <support@wetware.ai>
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer[all]>=0.12.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.5
Requires-Dist: pydantic[email]>=2.5
Requires-Dist: rich>=13.7.0
Requires-Dist: tomli>=2.0; python_version < "3.11"
Requires-Dist: tomli-w>=1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-httpx>=0.30; extra == "dev"
Requires-Dist: responses>=0.24; extra == "dev"
Requires-Dist: ruff>=0.1; extra == "dev"
Dynamic: license-file

# labtab

Command-line interface for [LabTab](https://labtab.app) — the lab management
platform for Principal Investigators. Manage grants, papers, meetings, tasks,
projects, and people from your terminal.

Built by [Wetware Ltd](https://wetware.co.uk).

## Install

```bash
pip install labtab
```

Requires Python 3.10+.

## Quickstart

```bash
# Pair your terminal with your LabTab account (opens a browser window)
labtab auth login

# See which labs you belong to
labtab labs list

# List your grants
labtab grants list

# Inspect a single grant
labtab grants show gr_abc123

# Show the next 7 days of meetings
labtab meetings upcoming --days 7

# Get JSON for scripting
labtab papers list --json | jq '.[] | .title'

# Export your whole lab as a zip
labtab export --format zip --lab chen-neuro-lab
```

## Commands

All commands support `--json` for machine-readable output and `--lab <slug>` to
override the default lab from your config.

| Command                        | What it does                              |
| ------------------------------ | ----------------------------------------- |
| `labtab auth login`            | Pair this terminal with your account      |
| `labtab auth logout`           | Forget the local API key                  |
| `labtab auth whoami`           | Show the signed-in user and default lab   |
| `labtab auth set-base-url`     | Update the stored API base URL            |
| `labtab labs list`             | Labs you have membership in               |
| `labtab grants list`           | Grants, filter by `--status`              |
| `labtab grants show <id>`      | Grant detail card                         |
| `labtab papers list`           | Papers, filter by `--year`                |
| `labtab papers show <id>`      | Paper detail with authors, DOI            |
| `labtab meetings upcoming`     | Meetings in the next `--days` (default 7) |
| `labtab meetings show <id>`    | Meeting detail card                       |
| `labtab tasks list`            | Tasks, filter by `--status`               |
| `labtab tasks show <id>`       | Task detail card                          |
| `labtab projects list`         | Projects                                  |
| `labtab projects show <id>`    | Project detail card                       |
| `labtab people list`           | Lab members                               |
| `labtab people show <id>`      | Person detail card                        |
| `labtab export`                | Download a full lab export                |

## Configuration

`labtab` reads and writes its config at `~/.config/labtab/config.toml`.
Override the path with the `LABTAB_CONFIG_FILE` environment variable.

```toml
[api]
base_url = "https://labtab.app/api/v1"

[auth]
api_key = "lab_api_xxxxxxxx"
user_email = "pi@example.com"
default_lab_id = 42
default_lab_slug = "chen-neuro-lab"
```

The config file is written with `0600` permissions so other users on the
machine cannot read your API key.

If you later move the product domain, you can rewrite just the hostname while
preserving the rest of the API path:

```bash
labtab auth set-base-url --host labtab.io
```

## Pydantic models

The package ships two sets of models:

* `labtab.models` (re-exports `labtab.models.api`) — hand-curated, **lenient**
  models the CLI uses internally. They tolerate extra or renamed backend
  fields so a CLI install doesn't break when the server ships new columns.
* `labtab.models.generated` — a **strict**, auto-generated snapshot of the
  backend's OpenAPI schema. Useful if you want to script against the API
  directly with precise types.

### Regenerating the strict snapshot

```bash
# with a running backend at localhost:8000
datamodel-codegen \
  --url http://localhost:8000/api/v1/schema/ \
  --output src/labtab/models/generated.py \
  --output-model-type pydantic_v2.BaseModel \
  --input-file-type openapi

# or from a snapshotted schema
cd backend && python manage.py spectacular --file /tmp/schema.yml
datamodel-codegen --input /tmp/schema.yml \
  --output src/labtab/models/generated.py \
  --output-model-type pydantic_v2.BaseModel \
  --input-file-type openapi
```

## License

MIT. See `LICENSE`.
