gpp-client


Namegpp-client JSON
Version 25.7.1 PyPI version JSON
download
home_pageNone
SummaryGemini Program Platform client.
upload_time2025-07-08 17:51:55
maintainerNone
docs_urlNone
authorNOIRLab
requires_python>=3.10.0
licenseCopyright (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.
keywords gemini gpp client program platform
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

# Developer Notes

To update the GPP GraphQL schema and generate client code, run the scripts from the project’s top-level directory located in `scripts/`.

This project uses [uv](https://github.com/astral-sh/uv) to manage dependencies and execute scripts.

When using `uv run`, a temporary virtual environment is created with only the dependencies required to run the script, based on the groups defined in `pyproject.toml`.

There’s no need to manually create or activate a virtual environment, `uv` handles everything.

## Set Up `pre-commit`

To install `pre-commit` using `uv`, run:

```bash
uv tool install pre-commit --with pre-commit-uv
```

You may be prompted to add `.local/bin` to your `PATH`, `uv` installs tools there by default.

Next, install the hooks defined in `.pre-commit-config.yaml`:

```bash
pre-commit install
```

Once installed, `pre-commit` will automatically run the configured hooks each time you make a commit. This helps catch formatting issues, docstring violations, and other problems before code is committed.

To manually run all `pre-commit` hooks on the entire codebase:

```bash
pre-commit run --all-files
```

## Download the Schema

This script downloads the latest GPP GraphQL schema to `schema.graphql`. You must have `GPP_URL` and `GPP_TOKEN` env variables set for downloading to work.

```bash
uv run --group schema python scripts/download_schema.py
```

## Run Codegen

This script regenerates the client code based on the updated schema.

```bash
uv run --group codegen python scripts/run_codegen.py
```

## Creating and Deploying a Release

Releases are managed using GitHub Actions. When you’re ready to publish a new version of the package, use the **Create Release** workflow.

1. Go to the **Actions** tab on GitHub.
2. Select the **Create Release** workflow from the sidebar.
3. Click **Run workflow**.
4. Enter the release version (e.g., `25.6.0`).
   **Note:** Do **not** include a leading `v` or unnecessary zero padding.
5. Click **Run workflow** to trigger the release.

This workflow performs the following steps:

- Updates the `version` field in `pyproject.toml`.
- Updates the `uv.lock` file to reflect the new version.
- Commits and pushes the changes to the repository.
- Creates a Git tag.
- Drafts a GitHub release.

### Finalizing the Release

After the workflow completes:

1. Go to the **Releases** section on GitHub.
2. Locate the newly created **draft release**.
3. Click **Publish release**.

Once published, the package will be automatically uploaded to [PyPI](https://pypi.org/project/gpp-client/). It may take a few minutes for the release to appear.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gpp-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10.0",
    "maintainer_email": null,
    "keywords": "gemini, gpp, client, program, platform",
    "author": "NOIRLab",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/36/53/678eca542505d47e3a67f7ed23d0be1e73cf43d45662d5236e2ad9ae99de/gpp_client-25.7.1.tar.gz",
    "platform": null,
    "description": "# GPP Client\n\n[![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)\n![Docs Status](https://readthedocs.org/projects/gpp-client/badge/?version=latest)\n\n---\n\n_Pain-free python/CLI communication with the Gemini Program Platform (GPP)._\n\n**Documentation**: <a href=\"https://gpp-client.readthedocs.io/en/latest/\" target=\"_blank\">https://gpp-client.readthedocs.io/en/latest/</a>\n\n**Source Code**: <a href=\"https://github.com/gemini-hlsw/gpp-client\" target=\"_blank\">https://github.com/gemini-hlsw/gpp-client</a>\n\n---\n\nPython client and CLI for the GPP. Key features:\n\n- **Type\u2011safe GraphQL**\n  - Pydantic models from the GPP GraphQL schema, so every query, mutation, and input type is validated.\n- **Resource Managers**\n  - High\u2011level `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.\n- **Flexible payloads**\n  - Create or update via in\u2011memory Pydantic inputs **or** `from_json` files.\n- **`gpp` CLI**\n  - Full CRUD surface on the command line: `gpp <resource> list|get|create|update|delete`, with rich table output and JSON export options.\n\n### Requirements\n\n- `python>=3.10`\n- `toml`\n- `typer`\n- `ariadne-codegen`\n\n## Development Status\n\n\ud83d\udea7 Alpha: the library is under heavy development. The public API and CLI flags may change between releases.\n\n## Installation\n\n```bash\npip install gpp-client\n```\n\n## Quickstart\n\n```python\nfrom gpp_client import GPPClient\n\n# Initialize with your GraphQL endpoint and credentials.\nclient = GPPClient(url=\"YOUR_URL\", token=\"YOUR_TOKEN\")\n\n# List the first 5 program notes.\nnotes = await client.program_note.get_all(limit=5)\nfor note in notes[\"matches\"]:\n    print(f\"{note['id']}: {note['title']}\")\n\n# Create a new note from a JSON file.\nnew_note = await client.program_note.create(\n    from_json=\"path/to/program_note_payload.json\",\n    program_id=\"p-123\"\n)\nprint(\"Created:\", new_note)\n\n# Or create a note from the pydantic model.\nfrom gpp_client.api.enums import Existence\nfrom gpp_client.api.input_types import ProgramNotePropertiesInput\n\nproperties = ProgramNotePropertiesInput(\n    title=\"Example\",\n    text=\"This is an example.\",\n    is_private=False,\n    existence=Existence.PRESENT\n)\nanother_note = await client.program_note.create(properties=properties, program_id=\"p-123\")\n\nprint(\"Created another:\", another_note)\n```\n\n## As a CLI\n\n```bash\n# Get help.\ngpp --help\n\n# Get observation help.\ngpp obs --help\n\n# List observations.\ngpp obs list --limit 3\n\n# Get details for one.\ngpp obs get o-123\n\n# Create via JSON.\ngpp obs create --from-json new_obs.json --program-id p-123\n\n# Update by ID via JSON.\ngpp obs update --observation-id o-123 --from-json updated_obs.json\n```\n\n## Reporting Bugs and Feature Requests\n\n**Jira**: https://noirlab.atlassian.net/jira/software/projects/GPC/boards/162\n\n**NOIRLab Slack channel**: `#gpp-client`\n\nWhile in heavy development, please file requests or report bugs via our Jira board or Slack channel.\n\n# Developer Notes\n\nTo update the GPP GraphQL schema and generate client code, run the scripts from the project\u2019s top-level directory located in `scripts/`.\n\nThis project uses [uv](https://github.com/astral-sh/uv) to manage dependencies and execute scripts.\n\nWhen using `uv run`, a temporary virtual environment is created with only the dependencies required to run the script, based on the groups defined in `pyproject.toml`.\n\nThere\u2019s no need to manually create or activate a virtual environment, `uv` handles everything.\n\n## Set Up `pre-commit`\n\nTo install `pre-commit` using `uv`, run:\n\n```bash\nuv tool install pre-commit --with pre-commit-uv\n```\n\nYou may be prompted to add `.local/bin` to your `PATH`, `uv` installs tools there by default.\n\nNext, install the hooks defined in `.pre-commit-config.yaml`:\n\n```bash\npre-commit install\n```\n\nOnce installed, `pre-commit` will automatically run the configured hooks each time you make a commit. This helps catch formatting issues, docstring violations, and other problems before code is committed.\n\nTo manually run all `pre-commit` hooks on the entire codebase:\n\n```bash\npre-commit run --all-files\n```\n\n## Download the Schema\n\nThis script downloads the latest GPP GraphQL schema to `schema.graphql`. You must have `GPP_URL` and `GPP_TOKEN` env variables set for downloading to work.\n\n```bash\nuv run --group schema python scripts/download_schema.py\n```\n\n## Run Codegen\n\nThis script regenerates the client code based on the updated schema.\n\n```bash\nuv run --group codegen python scripts/run_codegen.py\n```\n\n## Creating and Deploying a Release\n\nReleases are managed using GitHub Actions. When you\u2019re ready to publish a new version of the package, use the **Create Release** workflow.\n\n1. Go to the **Actions** tab on GitHub.\n2. Select the **Create Release** workflow from the sidebar.\n3. Click **Run workflow**.\n4. Enter the release version (e.g., `25.6.0`).\n   **Note:** Do **not** include a leading `v` or unnecessary zero padding.\n5. Click **Run workflow** to trigger the release.\n\nThis workflow performs the following steps:\n\n- Updates the `version` field in `pyproject.toml`.\n- Updates the `uv.lock` file to reflect the new version.\n- Commits and pushes the changes to the repository.\n- Creates a Git tag.\n- Drafts a GitHub release.\n\n### Finalizing the Release\n\nAfter the workflow completes:\n\n1. Go to the **Releases** section on GitHub.\n2. Locate the newly created **draft release**.\n3. Click **Publish release**.\n\nOnce published, the package will be automatically uploaded to [PyPI](https://pypi.org/project/gpp-client/). It may take a few minutes for the release to appear.\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2025 Association of Universities for Research in Astronomy, Inc. (AURA)\n        All rights reserved.\n        \n        Unless otherwise stated, the copyright of this software is owned by AURA.\n        Redistribution and use in source and binary forms, with or without modification,\n        are permitted provided that the following conditions are met:\n        \n        1) Redistributions of source code must retain the above copyright notice,\n          this list of conditions and the following disclaimer.\n        2) Redistributions in binary form must reproduce the above copyright notice,\n          this list of conditions and the following disclaimer in the documentation\n          and/or other materials provided with the distribution.\n        3) The names of AURA and its representatives may not be used to endorse or\n          promote products derived from this software without specific prior written\n          permission.\n        \n        THIS SOFTWARE IS PROVIDED BY AURA \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n        FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AURA BE\n        LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n        CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n        GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n        HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n        LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF\n        THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n        ",
    "summary": "Gemini Program Platform client.",
    "version": "25.7.1",
    "project_urls": {
        "Documentation": "https://gpp-client.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/gemini-hlsw/gpp-client",
        "Issues": "https://github.com/gemini-hlsw/gpp-client/issues",
        "Source": "https://github.com/gemini-hlsw/gpp-client"
    },
    "split_keywords": [
        "gemini",
        " gpp",
        " client",
        " program",
        " platform"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f0a984e06df948b42304b3880c77b5f292062fa7d0c83eaca7ac4454844916ab",
                "md5": "df3b43e38d604ce928729ede7e519683",
                "sha256": "8cfd3c2badab75fb624e04f88bf8818d06ba8e14f461560848fed3eef417bf4d"
            },
            "downloads": -1,
            "filename": "gpp_client-25.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "df3b43e38d604ce928729ede7e519683",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10.0",
            "size": 110162,
            "upload_time": "2025-07-08T17:51:54",
            "upload_time_iso_8601": "2025-07-08T17:51:54.571723Z",
            "url": "https://files.pythonhosted.org/packages/f0/a9/84e06df948b42304b3880c77b5f292062fa7d0c83eaca7ac4454844916ab/gpp_client-25.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3653678eca542505d47e3a67f7ed23d0be1e73cf43d45662d5236e2ad9ae99de",
                "md5": "c130f0c084a0655057139e8c46009e07",
                "sha256": "8691679effeaac510c2fc374b00d9e5b0104502ab0d63b623e35349fad58d499"
            },
            "downloads": -1,
            "filename": "gpp_client-25.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c130f0c084a0655057139e8c46009e07",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10.0",
            "size": 91632,
            "upload_time": "2025-07-08T17:51:55",
            "upload_time_iso_8601": "2025-07-08T17:51:55.749794Z",
            "url": "https://files.pythonhosted.org/packages/36/53/678eca542505d47e3a67f7ed23d0be1e73cf43d45662d5236e2ad9ae99de/gpp_client-25.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-08 17:51:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gemini-hlsw",
    "github_project": "gpp-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gpp-client"
}
        
Elapsed time: 0.42146s