Skip to content

Commit e8e26f5

Browse files
Initial commit
0 parents  commit e8e26f5

21 files changed

Lines changed: 5337 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -e ".[dev]"
24+
25+
- name: Check proto files are up-to-date
26+
run: |
27+
python scripts/compile_protos.py
28+
if ! git diff --exit-code src/altertable_flightsql/generated/; then
29+
echo "❌ Error: Generated proto files are out of date!"
30+
echo "Please run 'python scripts/compile_protos.py' and commit the changes."
31+
exit 1
32+
fi
33+
echo "✅ Generated proto files are up to date."
34+
35+
- name: Lint with ruff
36+
run: |
37+
ruff check src/ tests/ scripts/ examples/
38+
39+
- name: Check formatting with black
40+
run: |
41+
black --check src/ tests/ scripts/ /examples
42+
43+
- name: Check import sorting with isort
44+
run: |
45+
isort --check-only src/ tests/ scripts/ examples/
46+
47+
test:
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
os: [ubuntu-latest]
53+
python-version: ["3.9", "3.10", "3.11", "3.12"]
54+
55+
services:
56+
altertable:
57+
image: ghcr.io/altertable.ai/altertable-mock:latest
58+
ports:
59+
- 15002:15002
60+
env:
61+
ALTERTABLE_MOCK_USERS: altertable-test:lk_test
62+
ALTERTABLE_MOCK_FLIGHT_PORT: 15002
63+
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- name: Set up Python ${{ matrix.python-version }}
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
72+
- name: Install dependencies
73+
run: |
74+
python -m pip install --upgrade pip
75+
pip install -e ".[dev]"
76+
77+
- name: Run integration tests
78+
env:
79+
ALTERTABLE_HOST: altertable
80+
ALTERTABLE_PORT: 15002
81+
ALTERTABLE_USERNAME: altertable-test
82+
ALTERTABLE_PASSWORD: lk_test
83+
run: |
84+
pytest tests/ --no-cov -v
85+
86+
- name: Run client usage examples
87+
env:
88+
ALTERTABLE_HOST: altertable
89+
ALTERTABLE_PORT: 15002
90+
ALTERTABLE_USERNAME: altertable-test
91+
ALTERTABLE_PASSWORD: lk_test
92+
run: |
93+
python examples/client_usage.py
94+
95+
build:
96+
runs-on: ubuntu-latest
97+
needs: [lint, test]
98+
steps:
99+
- uses: actions/checkout@v4
100+
101+
- name: Set up Python
102+
uses: actions/setup-python@v5
103+
with:
104+
python-version: "3.11"
105+
106+
- name: Install build dependencies
107+
run: |
108+
python -m pip install --upgrade pip
109+
pip install build twine
110+
111+
- name: Build package
112+
run: python -m build
113+
114+
- name: Check package
115+
run: twine check dist/*
116+
117+
- name: Upload artifacts
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: dist
121+
path: dist/

.gitignore

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
*.manifest
32+
*.spec
33+
34+
# Unit test / coverage reports
35+
htmlcov/
36+
.tox/
37+
.nox/
38+
.coverage
39+
.coverage.*
40+
.cache
41+
nosetests.xml
42+
coverage.xml
43+
*.cover
44+
*.py,cover
45+
.hypothesis/
46+
.pytest_cache/
47+
48+
# Translations
49+
*.mo
50+
*.pot
51+
52+
# Django stuff:
53+
*.log
54+
local_settings.py
55+
db.sqlite3
56+
db.sqlite3-journal
57+
58+
# Flask stuff:
59+
instance/
60+
.webassets-cache
61+
62+
# Scrapy stuff:
63+
.scrapy
64+
65+
# Sphinx documentation
66+
docs/_build/
67+
68+
# PyBuilder
69+
target/
70+
71+
# Jupyter Notebook
72+
.ipynb_checkpoints
73+
74+
# IPython
75+
profile_default/
76+
ipython_config.py
77+
78+
# pyenv
79+
.python-version
80+
81+
# pipenv
82+
Pipfile.lock
83+
84+
# PEP 582
85+
__pypackages__/
86+
87+
# Celery stuff
88+
celerybeat-schedule
89+
celerybeat.pid
90+
91+
# SageMath parsed files
92+
*.sage.py
93+
94+
# Environments
95+
.env
96+
.venv
97+
env/
98+
venv/
99+
ENV/
100+
env.bak/
101+
venv.bak/
102+
103+
# Spyder project settings
104+
.spyderproject
105+
.spyproject
106+
107+
# Rope project settings
108+
.ropeproject
109+
110+
# mkdocs documentation
111+
/site
112+
113+
# mypy
114+
.mypy_cache/
115+
.dmypy.json
116+
dmypy.json
117+
118+
# Pyre type checker
119+
.pyre/
120+
121+
# IDEs
122+
.vscode/
123+
.idea/
124+
*.swp
125+
*.swo
126+
*~
127+
128+
# OS
129+
.DS_Store
130+
Thumbs.db
131+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 altertable-flightsql contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Include important metadata files
2+
include README.md
3+
include LICENSE
4+
include pyproject.toml
5+
6+
# Include proto files for reference
7+
recursive-include proto *.proto
8+
9+
# Include type stubs
10+
recursive-include src/altertable_flightsql *.pyi
11+
include src/altertable_flightsql/py.typed
12+
13+
# Exclude build artifacts and caches
14+
global-exclude *.py[cod]
15+
global-exclude __pycache__
16+
global-exclude *.so
17+
global-exclude .DS_Store
18+

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
DIRS = src tests scripts examples
2+
3+
gen:
4+
python scripts/compile_protos.py
5+
6+
lint:
7+
@echo "Running isort..."
8+
isort $(DIRS)
9+
10+
@echo "Running black..."
11+
black $(DIRS)
12+
13+
@echo "Running ruff (with fixes)..."
14+
ruff check --fix $(DIRS)
15+
16+
@echo "✓ Linting complete!"
17+
18+
.PHONY: gen lint

0 commit comments

Comments
 (0)