diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 710f7542..ab00e452 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -2,7 +2,7 @@ name: acceptance on: pull_request: - types: [ opened, synchronize, ready_for_review ] + types: [ opened, synchronize ] permissions: id-token: write @@ -12,27 +12,31 @@ permissions: concurrency: group: single-acceptance-job-per-repo +env: + HATCH_VERBOSE: "2" + HATCH_VERSION: "1.16.5" + jobs: integration: - if: github.event_name == 'pull_request' && github.event.pull_request.draft == false + if: github.event_name == 'pull_request' environment: runtime runs-on: larger steps: - name: Checkout Code - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6 - name: Unshallow run: git fetch --prune --unshallow - name: Install Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: cache: 'pip' cache-dependency-path: '**/pyproject.toml' - python-version: '3.10' + python-version: '3.14' - name: Install hatch - run: pip install hatch==1.9.4 + run: pip install "hatch==${HATCH_VERSION}" - name: Run integration tests uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.2 diff --git a/.github/workflows/downstreams.yml b/.github/workflows/downstreams.yml index 4c8badba..79f54da2 100644 --- a/.github/workflows/downstreams.yml +++ b/.github/workflows/downstreams.yml @@ -20,6 +20,10 @@ permissions: contents: read pull-requests: write +env: + HATCH_VERBOSE: "2" + HATCH_VERSION: '1.16.5' + jobs: compatibility: strategy: @@ -31,20 +35,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6 with: fetch-depth: 0 - name: Install Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: cache: 'pip' cache-dependency-path: '**/pyproject.toml' + # Downstream currently just tests with system python rather than controlling the versions properly. python-version: '3.10' - name: Install toolchain run: | - pip install hatch==1.9.4 + pip install "hatch==${HATCH_VERSION}" + - name: Acceptance uses: databrickslabs/sandbox/downstreams@acceptance/v0.4.2 with: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0f504ff9..c99cbc9a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -14,25 +14,29 @@ permissions: concurrency: group: single-acceptance-job-per-repo +env: + HATCH_VERBOSE: "2" + HATCH_VERSION: "1.16.5" + jobs: integration: environment: runtime runs-on: larger steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 - name: Install Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: cache: 'pip' cache-dependency-path: '**/pyproject.toml' - python-version: '3.10' + python-version: '3.14' - name: Install hatch - run: pip install hatch==1.9.4 + run: pip install "hatch==${HATCH_VERSION}" - name: Run nightly tests uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.2 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 10665e63..bbad814e 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,27 +14,36 @@ on: branches: - main +env: + HATCH_VERBOSE: "2" + HATCH_VERSION: "1.16.5" + jobs: ci: strategy: fail-fast: false matrix: - pyVersion: [ '3.10', '3.11', '3.12' ] + python: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] runs-on: ubuntu-latest + env: + HATCH_ENV: "test.py${{ matrix.python }}" steps: - name: Checkout - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6 - name: Install Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: cache: 'pip' cache-dependency-path: '**/pyproject.toml' - python-version: ${{ matrix.pyVersion }} + # The version under test, as well as Python 3.14 for Hatch. + python-version: | + ${{ matrix.python }} + ${{ matrix.python != '3.14' && '3.14' || '' }} - name: Run unit tests run: | - pip install hatch==1.9.4 + pip install "hatch==${HATCH_VERSION}" make test - name: Publish test coverage @@ -44,18 +53,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6 - - name: Install Python 3.12 - uses: actions/setup-python@v5 + - name: Install Python + uses: actions/setup-python@v6 with: cache: 'pip' cache-dependency-path: '**/pyproject.toml' - python-version: '3.12' + python-version: '3.14' - name: Format all files run: | - pip install hatch==1.9.4 + pip install "hatch==${HATCH_VERSION}" make dev fmt - name: Fail on differences diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 528e0254..51c137b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,10 @@ on: tags: - 'v*' +env: + HATCH_VERBOSE: "2" + HATCH_VERSION: "1.16.5" + jobs: publish: runs-on: @@ -17,17 +21,17 @@ jobs: # Used to attach signing artifacts to the published release. contents: write steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v6 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: cache: 'pip' cache-dependency-path: '**/pyproject.toml' - python-version: '3.10' + python-version: '3.14' - name: Build wheels run: | - pip install hatch==1.9.4 + pip install "hatch==${HATCH_VERSION}" hatch build - name: Draft release diff --git a/.gitignore b/.gitignore index 174f3dc4..dbf79adf 100644 --- a/.gitignore +++ b/.gitignore @@ -129,6 +129,7 @@ venv/ ENV/ env.bak/ venv.bak/ +.venv-*/ # Spyder project settings .spyderproject diff --git a/Makefile b/Makefile index fc70580c..b3b532c8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: clean lint fmt test coverage clean: - rm -fr .venv clean htmlcov .mypy_cache .pytest_cache .ruff_cache .coverage coverage.xml + rm -fr .venv* clean htmlcov .mypy_cache .pytest_cache .ruff_cache .coverage coverage.xml rm -fr **/*.pyc .venv/bin/python: diff --git a/pyproject.toml b/pyproject.toml index 91d6e363..a33634f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "databricks-labs-lsql" dynamic = ["version"] description = "Lightweight stateless SQL execution for Databricks with minimal dependencies" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.10,<3.15" license-files = { paths = ["LICENSE", "NOTICE"] } keywords = [] authors = [ @@ -16,6 +16,8 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] @@ -58,29 +60,59 @@ dependencies = [ "types-requests", ] -# store virtual env as the child of this folder. Helps VSCode (and PyCharm) to run better +python="3.10" + +# Fixed path expected by the `labs` tool to run acceptance tests. path = ".venv" +[tool.hatch.envs.default.env-vars] +MYPY_CACHE_DIR = ".venv/mypy-cache" +PYTEST_ADDOPTS = "-o cache_dir=.venv/pytest-cache" +RUFF_CACHE_DIR = ".venv/ruff-cache" + [tool.hatch.envs.default.scripts] test = "pytest -n 2 --cov src --cov-report=xml --timeout 30 tests/unit --durations 20" coverage = "pytest -n 2 --cov src tests/unit --timeout 30 --cov-report=html --durations 20" integration = "pytest -n 10 --cov src tests/integration --durations 20" -fmt = ["isort .", +fmt = ["isort src tests", "ruff format", "ruff check . --fix", "mypy .", "pylint --output-format=colorized -j 0 src"] -verify = ["isort . --check-only", +verify = ["isort src tests --check-only", "ruff check .", "mypy .", "pylint --output-format=colorized -j 0 src"] +[tool.hatch.envs.test.env-vars] +MYPY_CACHE_DIR = ".venv-py{matrix:python}/mypy-cache" +PYTEST_ADDOPTS = "-o cache_dir=.venv-py{matrix:python}/pytest-cache" +RUFF_CACHE_DIR = ".venv-py{matrix:python}/ruff-cache" + +[tool.hatch.envs.test.overrides] +matrix.python.path = [ + # Sadly no way to interpolate this. + { value = ".venv-py3.10", if = ["3.10" ]}, + { value = ".venv-py3.11", if = ["3.11" ]}, + { value = ".venv-py3.12", if = ["3.12" ]}, + { value = ".venv-py3.13", if = ["3.13" ]}, + { value = ".venv-py3.14", if = ["3.14" ]} +] + +[[tool.hatch.envs.test.matrix]] +python = [ + "3.10", + "3.11", + "3.12", + "3.13", + "3.14", +] + [tool.isort] profile = "black" [tool.pytest.ini_options] addopts = "--no-header" -cache_dir = ".venv/pytest-cache" [tool.black] target-version = ["py310"] @@ -88,7 +120,6 @@ line-length = 120 skip-string-normalization = true [tool.ruff] -cache-dir = ".venv/ruff-cache" target-version = "py310" line-length = 120 @@ -199,10 +230,6 @@ py-version = "3.10" # source root. # source-roots = -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode = true - # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. # unsafe-load-any-extension =