From 37a2b17831a443d72ec96bbf93f9f0c914ab41a9 Mon Sep 17 00:00:00 2001 From: Rahim Bhojani Date: Wed, 18 Mar 2026 09:30:59 -0500 Subject: [PATCH] chore: prepare for PyPI as dremio-cli - Rename package to dremio-cli with full metadata (authors, classifiers, urls, keywords) - Add py.typed marker for type-checking consumers - Add CHANGELOG.md for v0.1.0 - Add GitHub Actions: CI (test on 3.11/3.12/3.13) and publish (on tag via trusted publishing) - Update README install instructions with pip install dremio-cli Co-Authored-By: Claude Opus 4.6 --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ .github/workflows/publish.yml | 31 +++++++++++++++++++++++++++++++ CHANGELOG.md | 19 +++++++++++++++++++ README.md | 16 +++++++--------- pyproject.toml | 29 ++++++++++++++++++++++++++++- src/drs/py.typed | 0 6 files changed, 107 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml create mode 100644 CHANGELOG.md create mode 100644 src/drs/py.typed diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..67be08b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + version: "latest" + - run: uv python install ${{ matrix.python-version }} + - run: uv sync --python ${{ matrix.python-version }} + - run: uv run pytest tests/ -q diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c1d903c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + version: "latest" + - run: uv sync + - run: uv run pytest tests/ -q + + publish: + needs: test + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + version: "latest" + - run: uv build + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b436445 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] - 2026-03-18 + +### Added +- **12 command groups** with consistent CRUD verbs: `query`, `folder`, `schema`, `wiki`, `tag`, `reflection`, `job`, `engine`, `user`, `role`, `grant`, `project` +- **Top-level commands**: `search`, `describe` +- **3 output formats**: JSON (default), CSV, pretty table +- **Field filtering** via `--fields` for reduced output +- **Retry with exponential backoff** on timeouts and 429/502/503/504 +- **Config resolution**: CLI flags > env vars > config file +- **Command introspection** via `dremio describe ` for agent self-discovery +- **Input validation** for SQL injection, path traversal, and malformed IDs +- **120 unit tests** with full HTTP mocking diff --git a/README.md b/README.md index abff4ce..554bbb8 100644 --- a/README.md +++ b/README.md @@ -29,17 +29,15 @@ Dremio Cloud has a powerful REST API and rich system tables, but no official CLI ### 1. Install ```bash -# Clone the repo -git clone https://github.com/dremio/cli.git -cd cli - -# Install as a standalone tool (recommended) -uv tool install . +# From PyPI (recommended) +pip install dremio-cli -# Or with pip -pip install . +# Or with uv +uv tool install dremio-cli -# Or for development (editable install) +# Or from source (for development) +git clone https://github.com/dremio/cli.git +cd cli uv sync ``` diff --git a/pyproject.toml b/pyproject.toml index f1c6376..8a99759 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,28 @@ [project] -name = "drs" +name = "dremio-cli" version = "0.1.0" description = "Developer CLI for Dremio Cloud" readme = "README.md" requires-python = ">=3.11" license = "Apache-2.0" +authors = [ + { name = "Dremio", email = "oss@dremio.com" }, +] +keywords = ["dremio", "cli", "data-lakehouse", "sql", "cloud", "iceberg"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Database", + "Topic :: Software Development :: Libraries", + "Typing :: Typed", +] dependencies = [ "typer[all]>=0.9", "httpx>=0.27", @@ -12,6 +30,12 @@ dependencies = [ "pydantic>=2", ] +[project.urls] +Homepage = "https://github.com/dremio/cli" +Repository = "https://github.com/dremio/cli" +Issues = "https://github.com/dremio/cli/issues" +Documentation = "https://docs.dremio.com/dremio-cloud/api/" + [project.scripts] dremio = "drs.cli:app" @@ -22,6 +46,9 @@ build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = ["src/drs"] +[tool.pytest.ini_options] +asyncio_mode = "auto" + [dependency-groups] dev = [ "pytest>=9.0.2", diff --git a/src/drs/py.typed b/src/drs/py.typed new file mode 100644 index 0000000..e69de29