Skip to content

Commit 165b3ec

Browse files
pieternrauchy
andauthored
Use uv lockfile to pin build and test dependencies (#1360)
## Summary - Switch from pip to uv for dependency management in CI and local development - Add `uv.lock` to pin all transitive dependencies with hashes for reproducible builds - Drop Python 3.7 support (EOL since June 2023) to enable lockfile resolution - Update all GitHub Actions workflows to use `setup-uv` with a pinned version ## Details This is a library, so consumers continue to see flexible version ranges from `pyproject.toml`. The lockfile only governs our own CI and development environments. ### Changes - **Makefile**: `uv sync --locked` / `uv run` replaces manual venv + pip - **test.yml**: `setup-uv` replaces `setup-python`, `make dev test` replaces `make dev install test` - **push.yml**: `setup-uv` added for fmt and check-manifest jobs - **release.yml / release-test.yml**: `uv build` replaces `pip install build && python -m build` - **dependabot.yml**: ecosystem changed from `pip` to `uv` - **pyproject.toml**: `requires-python` bumped to `>=3.8`, `langchain-openai` marker corrected to `>= 3.9`, `check-manifest` added to dev deps - **MANIFEST.in**: excludes `uv.lock` and `tagging.py.lock` from sdist ## Test plan - [ ] CI passes on all Python versions (3.8-3.12) on Ubuntu and Windows - [ ] `make dev fmt` works locally - [ ] `make dev test` works locally - [ ] Release workflow builds wheel successfully This pull request was AI-assisted by Isaac. Co-authored-by: Omer Lachish <289488+rauchy@users.noreply.github.com>
1 parent 7e3ad64 commit 165b3ec

9 files changed

Lines changed: 4830 additions & 48 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "pip"
3+
- package-ecosystem: "uv"
44
directory: "/"
55
schedule:
66
interval: "daily"

.github/workflows/push.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,19 @@ jobs:
2626
with:
2727
os: windows-latest
2828
pyVersion: ${{ matrix.pyVersion }}
29-
29+
3030
fmt:
3131
runs-on: ubuntu-latest
3232

3333
steps:
3434
- name: Checkout
3535
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
3636

37+
- name: Install uv
38+
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
39+
with:
40+
version: "0.6.5"
41+
3742
- name: Format all files
3843
run: make dev fmt
3944

@@ -47,11 +52,10 @@ jobs:
4752
- name: Checkout
4853
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
4954

50-
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
5157
with:
52-
python-version: 3.13
58+
version: "0.6.5"
5359

5460
- name: Check MANIFEST.in
55-
run: |
56-
pip install check-manifest
57-
check-manifest .
61+
run: make dev && uv run check-manifest .

.github/workflows/release-test.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
1919

20-
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
2122
with:
22-
python-version: 3.13
23-
24-
- name: Install build
25-
run: pip install build
23+
version: "0.6.5"
2624

2725
- name: Build wheel
28-
run: python -m build
26+
run: uv build
2927
env:
3028
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3129

.github/workflows/release.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
2222

23-
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
2425
with:
25-
python-version: 3.13
26-
27-
- name: Install build
28-
run: pip install build
26+
version: "0.6.5"
2927

3028
- name: Build wheel
31-
run: python -m build
29+
run: uv build
3230
env:
3331
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3432

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ jobs:
2222
- name: Unshallow
2323
run: git fetch --prune --unshallow
2424

25-
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
2627
with:
28+
version: "0.6.5"
2729
python-version: ${{ inputs.pyVersion }}
2830

2931
- name: Run tests
30-
run: make dev install test
32+
run: make dev test
3133

3234
- name: Publish test coverage
3335
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
3436
env:
35-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
37+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ exclude .readthedocs.yaml
1414
exclude docs-requirements.txt
1515
exclude NEXT_CHANGELOG.md
1616
exclude tagging.py
17+
exclude tagging.py.lock
18+
exclude uv.lock
1719
exclude .package.json
1820
exclude .release_metadata.json
1921

Makefile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,34 @@
11
dev:
2-
python3 -m venv .venv
3-
ifeq ($(OS), Windows_NT)
4-
.venv\Scripts\activate
5-
else
6-
. .venv/bin/activate
7-
endif
8-
pip install '.[dev]'
2+
uv sync --locked --extra dev
93

104
install:
11-
pip install .
5+
uv sync --locked
126

137
fmt:
14-
black databricks tests
15-
autoflake -ri databricks tests
16-
isort databricks tests
8+
uv run black databricks tests
9+
uv run autoflake -ri databricks tests
10+
uv run isort databricks tests
1711

1812
fmte:
19-
black examples
20-
autoflake -ri examples
21-
isort examples
13+
uv run black examples
14+
uv run autoflake -ri examples
15+
uv run isort examples
2216

2317
lint:
24-
pycodestyle databricks
25-
autoflake --check-diff --quiet --recursive databricks
18+
uv run pycodestyle databricks
19+
uv run autoflake --check-diff --quiet --recursive databricks
2620

2721
test:
28-
pytest -m 'not integration and not benchmark' --cov=databricks --cov-report html tests
22+
uv run pytest -m 'not integration and not benchmark' --cov=databricks --cov-report html tests
2923

3024
integration:
31-
pytest -n auto -m 'integration and not benchmark' --reruns 4 --dist loadgroup --cov=databricks --cov-report html tests
25+
uv run pytest -n auto -m 'integration and not benchmark' --reruns 4 --dist loadgroup --cov=databricks --cov-report html tests
3226

3327
benchmark:
34-
pytest -m 'benchmark' tests
28+
uv run pytest -m 'benchmark' tests
3529

3630
coverage: test
3731
open htmlcov/index.html
3832

3933
clean:
40-
rm -fr dist *.egg-info .pytest_cache build htmlcov
34+
rm -fr dist *.egg-info .pytest_cache build htmlcov .venv

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ name = "databricks-sdk"
77
dynamic = ["version"]
88
description = "Databricks SDK for Python (Beta)"
99
readme = "README.md"
10-
requires-python = ">=3.7"
10+
requires-python = ">=3.8"
1111
keywords = ["databricks", "sdk"]
1212
classifiers = [
1313
"Development Status :: 4 - Beta",
1414
"Intended Audience :: Developers",
1515
"Intended Audience :: Science/Research",
1616
"Intended Audience :: System Administrators",
1717
"License :: OSI Approved :: Apache Software License",
18-
"Programming Language :: Python :: 3.7",
1918
"Programming Language :: Python :: 3.8",
2019
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
@@ -53,17 +52,18 @@ dev = [
5352
"databricks-connect",
5453
"pytest-rerunfailures",
5554
"openai",
56-
'langchain-openai; python_version > "3.7"',
55+
'langchain-openai; python_version >= "3.9"',
5756
"httpx",
5857
"build", # some integration tests depend on the databricks-sdk-py wheel
58+
"check-manifest",
5959
]
6060
notebook = [
6161
"ipython>=8,<10",
6262
"ipywidgets>=8,<9",
6363
]
6464
openai = [
6565
"openai",
66-
'langchain-openai; python_version > "3.7"',
66+
'langchain-openai; python_version >= "3.9"',
6767
"httpx",
6868
]
6969

@@ -78,11 +78,11 @@ include = ["databricks", "databricks.*"]
7878

7979
[tool.black]
8080
line-length = 120
81-
target-version = ['py37', 'py38', 'py39', 'py310', 'py311','py312','py313']
81+
target-version = ['py38', 'py39', 'py310', 'py311','py312','py313']
8282

8383
[tool.pyright]
8484
include = ["."]
8585
exclude = ["**/node_modules", "**/__pycache__"]
8686
reportMissingImports = true
8787
reportMissingTypeStubs = false
88-
pythonVersion = "3.7"
88+
pythonVersion = "3.8"

0 commit comments

Comments
 (0)