Skip to content

Commit

Permalink
FEAT: Support main SQL syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
qinxuye committed Aug 29, 2023
1 parent 6009b57 commit 91defc8
Show file tree
Hide file tree
Showing 25 changed files with 4,339 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xorbits_sql/_version.py export-subst
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: ''
assignees: ''

---

### Describe the bug
A clear and concise description of what the bug is.

### To Reproduce
To help us to reproduce this bug, please provide information below:

1. Your Python version
2. The version of Xorbits and SQLGlot you use
3. Versions of crucial packages, such as numpy, scipy and pandas
4. Full stack of the error.
5. Minimized code to reproduce the error.

### Expected behavior
A clear and concise description of what you expected to happen.

### Additional context
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

### Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like
A clear and concise description of what you want to happen.

### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

### Additional context
Add any other context or screenshots about the feature request here.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Other
about: Submit other issues here.
title: ''
labels: ''
assignees: ''

---

Note that the issue tracker is NOT the place for general support. For
discussions about development, questions about usage, or any general questions,
contact us on https://discuss.xorbits.io/.
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
Thank you for your contribution!
-->

## What do these changes do?

<!-- Please give a short brief about these changes. -->

## Related issue number

<!-- Are there any issues opened that will be resolved by merging this change? -->
Fixes #xxxx

## Check code requirements

- [ ] tests added / passed (if needed)
- [ ] Ensure all linting tests pass
6 changes: 6 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
project:
default:
target: 90%
threshold: 1%
20 changes: 20 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pull_request_rules:
- name: automatic update
conditions:
- -conflict # skip PRs with conflicts
- -draft # filter-out GH draft PRs
actions:
update:
- name: Automatic merge
conditions:
- "#approved-reviews-by>=2"
- check-success=lint (ubuntu-latest, 3.10)
- check-success=build_test_job (ubuntu-latest, 3.8, ray)
- check-success=build_test_job (ubuntu-latest, 3.9, ray)
- check-success=build_test_job (ubuntu-latest, 3.10, ray)
- check-success=build_test_job (ubuntu-latest, 3.11, ray)
- check-success=codecov/project
- base=main
actions:
merge:
method: squash
19 changes: 19 additions & 0 deletions .github/workflows/assign.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Assign
on:
issue_comment:
types: created

permissions:
contents: read

jobs:
issue_assign:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-22.04
steps:
- if: github.event.comment.body == 'take'
run: |
echo "Assigning issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"assignees": ["${{ github.event.comment.user.login }}"]}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
75 changes: 75 additions & 0 deletions .github/workflows/build-wheel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build and upload to PyPI

on:
schedule:
# trigger build every day at 4:30 UTC
- cron: '30 4 * * *'
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheel:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Build wheel
run: python setup.py bdist_wheel --python-tag py3

- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz

upload_pypi:
needs: [build_wheel, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

# if is xprobe repo, upload to pypi
- uses: pypa/[email protected]
if: github.repository == 'xorbitsai/xorbits_sql'
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}

# if is not xorbitsai repo, upload to test
- uses: pypa/[email protected]
if: github.repository != 'xorbitsai/xorbits_sql'
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
verbose: true
repository_url: https://test.pypi.org/legacy/
100 changes: 100 additions & 0 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Python CI

on:
push:
branches:
- '*'
pull_request:
types: ['opened', 'reopened', 'synchronize']

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10" ]

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
path: "xorbits_sql"
args: "--config setup.cfg"
- name: black
uses: psf/black@stable
with:
src: "xorbits_sql"
options: "--check"
- uses: isort/isort-action@master
with:
sortPaths: "xorbits_sql"
configuration: "--check-only --diff --sp setup.cfg"
- name: mypy
run: pip install mypy && mypy xorbits_sql
- name: codespell
run: pip install codespell && codespell xorbits_sql

build_test_job:
runs-on: ${{ matrix.os }}
needs: lint
env:
CONDA_ENV: xorbits_sql-test
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
module: ["xorbits_sql"]

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Set up conda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}

- name: Install dependencies
env:
MODULE: ${{ matrix.module }}
run: |
pip install cython coverage flaky
pip install -e ".[dev]"
working-directory: .

- name: Test with pytest
env:
MODULE: ${{ matrix.module }}
run: |
pytest --cov-config=setup.cfg --cov-report=xml --cov=xorbits_sql --durations=0 \
--log-level=DEBUG --timeout=200 xorbits_sql
working-directory: .

- name: Report coverage data
uses: codecov/codecov-action@v3
with:
working-directory: .
flags: unittests
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
files: xorbits_sql
repos:
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--config, setup.cfg]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--sp, setup.cfg]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.1
hooks:
- id: mypy
additional_dependencies: [tokenize-rt==3.2.0]
args: [--ignore-missing-imports, --follow-imports, skip]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
args: [ --config, setup.cfg]
22 changes: 22 additions & 0 deletions project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
requires = [
"setuptools<64",
"wheel",
"sqlglot>=17.16.0",
"xorbits>=0.5.0"
]
build-backend = "setuptools.build_meta"

[tool.black]
include = '\.pyi?$'
extend-exclude = '''
^/xorbits_sql/(_version.py)
'''

[tool.pytest.ini_options]
asyncio_mode = "auto"

[tool.cibuildwheel]
build = ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
skip = "pp* *musllinux* *i686 cp36* cp310-win32"
manylinux-x86_64-image = "manylinux2014"
Loading

0 comments on commit 91defc8

Please sign in to comment.