Metadata-Version: 2.4
Name: gpp-client
Version: 25.5.0a1
Summary: Gemini Program Platform client.
Author: NOIRLab
License: Copyright (c) 2025 Association of Universities for Research in Astronomy, Inc. (AURA)
        All rights reserved.
        
        Unless otherwise stated, the copyright of this software is owned by AURA.
        Redistribution and use in source and binary forms, with or without modification,
        are permitted provided that the following conditions are met:
        
        1) Redistributions of source code must retain the above copyright notice,
          this list of conditions and the following disclaimer.
        2) Redistributions in binary form must reproduce the above copyright notice,
          this list of conditions and the following disclaimer in the documentation
          and/or other materials provided with the distribution.
        3) The names of AURA and its representatives may not be used to endorse or
          promote products derived from this software without specific prior written
          permission.
        
        THIS SOFTWARE IS PROVIDED BY AURA "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
        FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AURA BE
        LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
        GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
        THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project-URL: Homepage, https://github.com/gemini-hlsw/gpp-client
Project-URL: Source, https://github.com/gemini-hlsw/gpp-client
Project-URL: Issues, https://github.com/gemini-hlsw/gpp-client/issues
Project-URL: Documentation, https://gpp-client.readthedocs.io/en/latest/
Keywords: gemini,gpp,client,program,platform
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
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: Topic :: Scientific/Engineering :: Astronomy
Requires-Python: >=3.10.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: toml>=0.10.2
Requires-Dist: typer>=0.15.3
Requires-Dist: click<8.2.0,>=8.0.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic<3,>=2.11.0
Requires-Dist: graphql-core<3.3,>=3.2.0
Requires-Dist: beautifulsoup4<5,>=4.13
Requires-Dist: websockets>=14.2
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-xdist; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-asyncio; extra == "test"
Requires-Dist: pytest-remotedata; extra == "test"
Requires-Dist: pytest-mock; extra == "test"
Requires-Dist: ruff; extra == "test"
Requires-Dist: ariadne-codegen>=0.15.0.dev1; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: sphinx-autobuild; extra == "docs"
Requires-Dist: furo; extra == "docs"
Requires-Dist: sphinxcontrib-typer; extra == "docs"
Provides-Extra: codegen
Requires-Dist: ariadne-codegen>=0.15.0.dev1; extra == "codegen"
Dynamic: license-file

# GPP Client

[![Run Tests](https://github.com/gemini-hlsw/gpp-client/actions/workflows/run_tests.yaml/badge.svg?branch=main)](https://github.com/gemini-hlsw/gpp-client/actions/workflows/run_tests.yaml)
![Docs Status](https://readthedocs.org/projects/gpp-client/badge/?version=latest)

---

_Pain-free python/CLI communication with the Gemini Program Platform (GPP)._

**Documentation**: <a href="https://gpp-client.readthedocs.io/en/latest/" target="_blank">https://gpp-client.readthedocs.io/en/latest/</a>

**Source Code**: <a href="https://github.com/gemini-hlsw/gpp-client" target="_blank">https://github.com/gemini-hlsw/gpp-client</a>

---

Python client and CLI for the GPP. Key features:

- **Type‑safe GraphQL**
  - Pydantic models from the GPP GraphQL schema, so every query, mutation, and input type is validated.
- **Resource Managers**
  - High‑level `Manager` classes (e.g. `GPPClient.program`, `GPPClient.observation`) with convenient `get_by_id`, `get_all`, `create`, `update_by_id`, `delete_by_id`, `restore_by_id` and more methods, no need to write raw GraphQL.
- **Flexible payloads**
  - Create or update via in‑memory Pydantic inputs **or** `from_json` files.
- **`gpp` CLI**
  - Full CRUD surface on the command line: `gpp <resource> list|get|create|update|delete`, with rich table output and JSON export options.

### Requirements

- `python>=3.10`
- `toml`
- `typer`
- `ariadne-codegen`

## Development Status

🚧 Alpha: the library is under heavy development. The public API and CLI flags may change between releases.

## Installation

```bash
pip install gpp-client
```

## Quickstart

```python
from gpp_client import GPPClient

# Initialize with your GraphQL endpoint and credentials.
client = GPPClient(url="YOUR_URL", token="YOUR_TOKEN")

# List the first 5 program notes.
notes = await client.program_note.get_all(limit=5)
for note in notes["matches"]:
    print(f"{note['id']}: {note['title']}")

# Create a new note from a JSON file.
new_note = await client.program_note.create(
    from_json="path/to/program_note_payload.json",
    program_id="p-123"
)
print("Created:", new_note)

# Or create a note from the pydantic model.
from gpp_client.api.enums import Existence
from gpp_client.api.input_types import ProgramNotePropertiesInput

properties = ProgramNotePropertiesInput(
    title="Example",
    text="This is an example.",
    is_private=False,
    existence=Existence.PRESENT
)
another_note = await client.program_note.create(properties=properties, program_id="p-123")

print("Created another:", another_note)
```

## As a CLI

```bash
# Get help.
gpp --help

# Get observation help.
gpp obs --help

# List observations.
gpp obs list --limit 3

# Get details for one.
gpp obs get o-123

# Create via JSON.
gpp obs create --from-json new_obs.json --program-id p-123

# Update by ID via JSON.
gpp obs update --observation-id o-123 --from-json updated_obs.json
```

## Reporting Bugs and Feature Requests

**Jira**: https://noirlab.atlassian.net/jira/software/projects/GPC/boards/162

**NOIRLab Slack channel**: `#gpp-client`

While in heavy development, please file requests or report bugs via our Jira board or Slack channel.

