Skip to content

Commit fcf3262

Browse files
Initial commit
0 parents  commit fcf3262

21 files changed

Lines changed: 5139 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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+
permissions:
50+
contents: read
51+
packages: read
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
os: [ubuntu-latest]
56+
python-version: ["3.9", "3.10", "3.11", "3.12"]
57+
58+
services:
59+
altertable:
60+
image: ghcr.io/altertable-ai/altertable-mock:latest
61+
credentials:
62+
username: ${{ github.actor }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
ports:
65+
- 15002:15002
66+
env:
67+
ALTERTABLE_MOCK_USERS: altertable-test:lk_test
68+
ALTERTABLE_MOCK_FLIGHT_PORT: 15002
69+
options: >-
70+
--health-cmd "exit 0"
71+
--health-interval 5s
72+
--health-timeout 3s
73+
--health-retries 3
74+
--health-start-period 10s
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Set up Python ${{ matrix.python-version }}
80+
uses: actions/setup-python@v5
81+
with:
82+
python-version: ${{ matrix.python-version }}
83+
84+
- name: Install dependencies
85+
run: |
86+
python -m pip install --upgrade pip
87+
pip install -e ".[dev]"
88+
89+
- name: Run integration tests
90+
env:
91+
ALTERTABLE_HOST: localhost
92+
ALTERTABLE_PORT: 15002
93+
ALTERTABLE_USERNAME: altertable-test
94+
ALTERTABLE_PASSWORD: lk_test
95+
ALTERTABLE_TLS: false
96+
run: |
97+
pytest tests/ --no-cov -v
98+
99+
- name: Run client usage examples
100+
env:
101+
ALTERTABLE_HOST: localhost
102+
ALTERTABLE_PORT: 15002
103+
ALTERTABLE_USERNAME: altertable-test
104+
ALTERTABLE_PASSWORD: lk_test
105+
ALTERTABLE_TLS: false
106+
run: |
107+
python examples/client_usage.py
108+
109+
build:
110+
runs-on: ubuntu-latest
111+
needs: [lint, test]
112+
steps:
113+
- uses: actions/checkout@v4
114+
115+
- name: Set up Python
116+
uses: actions/setup-python@v5
117+
with:
118+
python-version: "3.11"
119+
120+
- name: Install build dependencies
121+
run: |
122+
python -m pip install --upgrade pip
123+
pip install build twine
124+
125+
- name: Build package
126+
run: python -m build
127+
128+
- name: Check package
129+
run: twine check dist/*
130+
131+
- name: Upload artifacts
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: dist
135+
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)