diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..522c771 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: ["**"] + pull_request: + branches: [main] + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: uv sync --group dev + + - name: Run tests + run: uv run pytest tests/ -v diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..37f792c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,101 @@ +name: Publish to PyPI + +on: + workflow_dispatch: + inputs: + publish_to_pypi: + description: 'Publish to PyPI? Type "yes" to confirm' + required: true + default: 'no' + type: choice + options: + - 'no' + - 'yes' + version_tag: + description: 'Version tag (e.g., v0.1.0)' + required: false + type: string + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: uv sync --group dev + + - name: Run tests + run: uv run pytest tests/ -v + + build-and-publish: + name: Build and Publish + needs: test + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install build tools + run: pip install twine + + - name: Build package + run: uv build + + - name: Check package + run: | + twine check dist/* + ls -la dist/ + echo "đŸ“Ļ Package version: $(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")" + + - name: Confirm before publish + if: github.event.inputs.publish_to_pypi == 'yes' + run: | + echo "âš ī¸ About to publish to PyPI (PRODUCTION)" + echo "đŸ“Ļ Package contents:" + ls -la dist/ + echo "✅ Proceeding with PyPI upload..." + + - name: Publish to PyPI + if: github.event.inputs.publish_to_pypi == 'yes' + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + if [ -z "$TWINE_PASSWORD" ]; then + echo "❌ Error: PYPI_TOKEN secret is not configured!" + echo "Please add your PyPI token to GitHub Secrets" + exit 1 + fi + twine upload dist/* + echo "✅ Published to PyPI successfully!" + echo "đŸ“Ļ View at: https://pypi.org/project/qql-cli/" + echo "đŸ“Ĩ Install: pip install qql-cli" + + - name: Skip publish message + if: github.event.inputs.publish_to_pypi != 'yes' + run: | + echo "đŸ“Ļ Package built successfully but NOT published to PyPI" + echo "â„šī¸ Test run complete. To publish, re-run with 'yes' selected." diff --git a/pyproject.toml b/pyproject.toml index 40fd278..95b98b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,13 +2,43 @@ name = "qql-cli" version = "0.1.0" description = "A SQL-like query language CLI wrapper for Qdrant vector database" +readme = "README.md" +license = { file = "LICENSE" } requires-python = ">=3.12" +authors = [ + { name = "Kameshwara Pavan Kumar Mantha", email = "pavankumarmantha@gmail.com" }, +] +keywords = [ + "qdrant", + "vector-database", + "cli", + "query-language", + "embeddings", + "semantic-search", +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Database :: Front-Ends", + "Topic :: Scientific/Engineering :: Artificial Intelligence", +] dependencies = [ "qdrant-client[fastembed]>=1.13.0", "click>=8.1.0", "rich>=13.0.0", ] +[project.urls] +Homepage = "https://github.com/pavanjava/qql" +Repository = "https://github.com/pavanjava/qql" +"Bug Tracker" = "https://github.com/pavanjava/qql/issues" + [project.scripts] qql = "qql.cli:main" @@ -23,4 +53,5 @@ packages = ["src/qql"] dev = [ "pytest>=8.0.0", "pytest-mock>=3.14.0", + "twine>=6.2.0", ] diff --git a/src/qql/__init__.py b/src/qql/__init__.py index 06e6329..8b3af40 100644 --- a/src/qql/__init__.py +++ b/src/qql/__init__.py @@ -1,3 +1,10 @@ +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version("qql-cli") +except PackageNotFoundError: + __version__ = "0.0.0+unknown" + from .config import DEFAULT_MODEL, QQLConfig, load_config from .exceptions import QQLError, QQLRuntimeError, QQLSyntaxError from .executor import ExecutionResult, Executor @@ -5,6 +12,7 @@ from .parser import Parser __all__ = [ + "__version__", "QQLConfig", "QQLError", "QQLRuntimeError",