Skip to content

Commit fc94e20

Browse files
committed
github actions workflow to publish into pypi
1 parent 3a30fb7 commit fc94e20

4 files changed

Lines changed: 170 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Run tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v4
19+
with:
20+
version: "latest"
21+
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install dependencies
27+
run: uv sync --group dev
28+
29+
- name: Run tests
30+
run: uv run pytest tests/ -v

.github/workflows/publish.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
publish_to_pypi:
7+
description: 'Publish to PyPI? Type "yes" to confirm'
8+
required: true
9+
default: 'no'
10+
type: choice
11+
options:
12+
- 'no'
13+
- 'yes'
14+
version_tag:
15+
description: 'Version tag (e.g., v0.1.0)'
16+
required: false
17+
type: string
18+
19+
jobs:
20+
test:
21+
name: Run tests
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v4
29+
with:
30+
version: "latest"
31+
32+
- uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.12"
35+
36+
- name: Install dependencies
37+
run: uv sync --group dev
38+
39+
- name: Run tests
40+
run: uv run pytest tests/ -v
41+
42+
build-and-publish:
43+
name: Build and Publish
44+
needs: test
45+
runs-on: ubuntu-latest
46+
permissions:
47+
contents: write
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v4
54+
with:
55+
version: "latest"
56+
57+
- uses: actions/setup-python@v5
58+
with:
59+
python-version: "3.12"
60+
61+
- name: Install build tools
62+
run: pip install twine
63+
64+
- name: Build package
65+
run: uv build
66+
67+
- name: Check package
68+
run: |
69+
twine check dist/*
70+
ls -la dist/
71+
echo "📦 Package version: $(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")"
72+
73+
- name: Confirm before publish
74+
if: github.event.inputs.publish_to_pypi == 'yes'
75+
run: |
76+
echo "⚠️ About to publish to PyPI (PRODUCTION)"
77+
echo "📦 Package contents:"
78+
ls -la dist/
79+
echo "✅ Proceeding with PyPI upload..."
80+
81+
- name: Publish to PyPI
82+
if: github.event.inputs.publish_to_pypi == 'yes'
83+
env:
84+
TWINE_USERNAME: __token__
85+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
86+
run: |
87+
if [ -z "$TWINE_PASSWORD" ]; then
88+
echo "❌ Error: PYPI_TOKEN secret is not configured!"
89+
echo "Please add your PyPI token to GitHub Secrets"
90+
exit 1
91+
fi
92+
twine upload dist/*
93+
echo "✅ Published to PyPI successfully!"
94+
echo "📦 View at: https://pypi.org/project/qql-cli/"
95+
echo "📥 Install: pip install qql-cli"
96+
97+
- name: Skip publish message
98+
if: github.event.inputs.publish_to_pypi != 'yes'
99+
run: |
100+
echo "📦 Package built successfully but NOT published to PyPI"
101+
echo "ℹ️ Test run complete. To publish, re-run with 'yes' selected."

pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,43 @@
22
name = "qql-cli"
33
version = "0.1.0"
44
description = "A SQL-like query language CLI wrapper for Qdrant vector database"
5+
readme = "README.md"
6+
license = { file = "LICENSE" }
57
requires-python = ">=3.12"
8+
authors = [
9+
{ name = "Kameshwara Pavan Kumar Mantha", email = "pavankumarmantha@gmail.com" },
10+
]
11+
keywords = [
12+
"qdrant",
13+
"vector-database",
14+
"cli",
15+
"query-language",
16+
"embeddings",
17+
"semantic-search",
18+
]
19+
classifiers = [
20+
"Development Status :: 3 - Alpha",
21+
"Environment :: Console",
22+
"Intended Audience :: Developers",
23+
"License :: OSI Approved :: MIT License",
24+
"Operating System :: OS Independent",
25+
"Programming Language :: Python :: 3",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
28+
"Topic :: Database :: Front-Ends",
29+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
30+
]
631
dependencies = [
732
"qdrant-client[fastembed]>=1.13.0",
833
"click>=8.1.0",
934
"rich>=13.0.0",
1035
]
1136

37+
[project.urls]
38+
Homepage = "https://github.com/pavanjava/qql"
39+
Repository = "https://github.com/pavanjava/qql"
40+
"Bug Tracker" = "https://github.com/pavanjava/qql/issues"
41+
1242
[project.scripts]
1343
qql = "qql.cli:main"
1444

@@ -23,4 +53,5 @@ packages = ["src/qql"]
2353
dev = [
2454
"pytest>=8.0.0",
2555
"pytest-mock>=3.14.0",
56+
"twine>=6.2.0",
2657
]

src/qql/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
from importlib.metadata import PackageNotFoundError, version
2+
3+
try:
4+
__version__ = version("qql-cli")
5+
except PackageNotFoundError:
6+
__version__ = "0.0.0+unknown"
7+
18
from .config import DEFAULT_MODEL, QQLConfig, load_config
29
from .exceptions import QQLError, QQLRuntimeError, QQLSyntaxError
310
from .executor import ExecutionResult, Executor
411
from .lexer import Lexer
512
from .parser import Parser
613

714
__all__ = [
15+
"__version__",
816
"QQLConfig",
917
"QQLError",
1018
"QQLRuntimeError",

0 commit comments

Comments
 (0)