Skip to content

Commit f54d5cf

Browse files
committed
chore: Migrate from Poetry to uv workspace
1 parent a14761d commit f54d5cf

10 files changed

Lines changed: 166 additions & 136 deletions

File tree

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@ test-packaging-venv
7272
.vscode/
7373
.python-version
7474

75-
# Poetry
76-
poetry.lock
75+
# uv — lock file is not committed for libraries (only for applications)
76+
uv.lock
77+
.venv/

CONTRIBUTING.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,29 @@ We encourage pull requests and other contributions from the community. Before su
1414

1515
### Setup
1616

17-
This project is built using [poetry](https://python-poetry.org/). To learn more about the basics of working with this tool, read [Poetry's basic usage guide](https://python-poetry.org/docs/basic-usage/).
17+
This project is built using [uv](https://docs.astral.sh/uv/). The repo is structured as a uv workspace — a single shared virtual environment at the repo root contains all packages and their dependencies, and cross-package dependencies (e.g. the provider packages depending on `launchdarkly-server-sdk-ai`) are automatically resolved from the local workspace members.
1818

19-
To begin development, ensure your dependencies are installed and (optionally) activate the virtualenv.
19+
To install uv, see the [uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
2020

21+
To install all packages and dev dependencies into the shared workspace environment:
22+
23+
```shell
24+
make install
25+
# or directly:
26+
uv sync --all-groups
2127
```
22-
poetry install
23-
eval $(poetry env activate)
28+
29+
To activate the shared virtual environment:
30+
31+
```shell
32+
source .venv/bin/activate
33+
```
34+
35+
Alternatively, prefix any command with `uv run` to use the workspace environment without activating it:
36+
37+
```shell
38+
uv run pytest
39+
uv run mypy src/ldai
2440
```
2541

2642
### Testing
@@ -31,6 +47,14 @@ To run all unit tests:
3147
make test
3248
```
3349

50+
To run tests for a specific package:
51+
52+
```shell
53+
make test-server-ai
54+
make test-openai
55+
make test-langchain
56+
```
57+
3458
It is preferable to run tests against all supported minor versions of Python (as described in `README.md` under Requirements), or at least the lowest and highest versions, prior to submitting a pull request. However, LaunchDarkly's CI tests will run automatically against all supported versions.
3559

3660
### Building documentation

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ help: #! Show this help message
2323
#
2424

2525
.PHONY: install
26-
install: #! Install all packages
27-
$(MAKE) install-server-ai
28-
$(MAKE) install-langchain
29-
$(MAKE) install-openai
26+
install: #! Install all packages and dev dependencies into the shared workspace environment
27+
uv sync --all-groups
3028

3129
.PHONY: install-server-ai
3230
install-server-ai: #! Install server-ai package

packages/ai-providers/server-ai-langchain/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ help: #! Show this help message
99

1010
.PHONY: install
1111
install: #! Install package dependencies
12-
poetry install
12+
uv sync --group dev
1313

1414
.PHONY: test
1515
test: #! Run unit tests
1616
test: install
17-
poetry run pytest $(PYTEST_FLAGS)
17+
uv run pytest $(PYTEST_FLAGS)
1818

1919
.PHONY: lint
2020
lint: #! Run type analysis and linting checks
2121
lint: install
22-
poetry run mypy src/ldai_langchain
23-
poetry run isort --check --atomic src/ldai_langchain
24-
poetry run pycodestyle src/ldai_langchain
22+
uv run mypy src/ldai_langchain
23+
uv run isort --check --atomic src/ldai_langchain
24+
uv run pycodestyle src/ldai_langchain
2525

2626
.PHONY: build
2727
build: #! Build distribution files
2828
build: install
29-
poetry build
29+
uv build

packages/ai-providers/server-ai-langchain/pyproject.toml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
[tool.poetry]
1+
[project]
22
name = "launchdarkly-server-sdk-ai-langchain"
33
version = "0.3.1"
44
description = "LaunchDarkly AI SDK LangChain Provider"
5-
authors = ["LaunchDarkly <dev@launchdarkly.com>"]
6-
license = "Apache-2.0"
5+
authors = [{name = "LaunchDarkly", email = "dev@launchdarkly.com"}]
6+
license = {text = "Apache-2.0"}
77
readme = "README.md"
8-
homepage = "https://docs.launchdarkly.com/sdk/ai/python"
9-
repository = "https://github.com/launchdarkly/python-server-sdk-ai"
8+
requires-python = ">=3.9,<4"
109
classifiers = [
1110
"Intended Audience :: Developers",
1211
"License :: OSI Approved :: Apache Software License",
@@ -20,21 +19,32 @@ classifiers = [
2019
"Topic :: Software Development",
2120
"Topic :: Software Development :: Libraries",
2221
]
23-
packages = [{ include = "ldai_langchain", from = "src" }]
22+
dependencies = [
23+
"launchdarkly-server-sdk-ai>=0.16.0",
24+
"langchain-core>=0.2.0",
25+
"langchain>=0.2.0",
26+
]
27+
28+
[project.urls]
29+
Homepage = "https://docs.launchdarkly.com/sdk/ai/python"
30+
Repository = "https://github.com/launchdarkly/python-server-sdk-ai"
31+
32+
[dependency-groups]
33+
dev = [
34+
"pytest>=2.8",
35+
"pytest-cov>=2.4.0",
36+
"pytest-asyncio>=0.21.0",
37+
"mypy==1.18.2",
38+
"pycodestyle>=2.11.0",
39+
"isort>=5.12.0",
40+
]
2441

25-
[tool.poetry.dependencies]
26-
python = ">=3.9,<4"
27-
launchdarkly-server-sdk-ai = ">=0.16.0"
28-
langchain-core = ">=0.2.0"
29-
langchain = ">=0.2.0"
42+
[build-system]
43+
requires = ["hatchling"]
44+
build-backend = "hatchling.build"
3045

31-
[tool.poetry.group.dev.dependencies]
32-
pytest = ">=2.8"
33-
pytest-cov = ">=2.4.0"
34-
pytest-asyncio = ">=0.21.0"
35-
mypy = "==1.18.2"
36-
pycodestyle = ">=2.11.0"
37-
isort = ">=5.12.0"
46+
[tool.hatch.build.targets.wheel]
47+
packages = ["src/ldai_langchain"]
3848

3949
[tool.mypy]
4050
python_version = "3.9"
@@ -47,13 +57,7 @@ profile = "black"
4757
known_third_party = ["langchain", "langchain_core", "ldai"]
4858
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
4959

50-
5160
[tool.pytest.ini_options]
5261
addopts = ["-ra"]
5362
testpaths = ["tests"]
5463
asyncio_mode = "auto"
55-
56-
57-
[build-system]
58-
requires = ["poetry-core"]
59-
build-backend = "poetry.core.masonry.api"

packages/ai-providers/server-ai-openai/Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@ help: #! Show this help message
99

1010
.PHONY: install
1111
install: #! Install package dependencies
12-
poetry install
12+
uv sync --group dev
1313

1414
.PHONY: test
1515
test: #! Run unit tests
1616
test: install
17-
poetry run pytest $(PYTEST_FLAGS)
17+
uv run pytest $(PYTEST_FLAGS)
1818

1919
.PHONY: lint
2020
lint: #! Run type analysis and linting checks
2121
lint: install
22-
poetry run mypy src/ldai_openai
23-
poetry run isort --check --atomic src/ldai_openai
24-
poetry run pycodestyle src/ldai_openai
22+
uv run mypy src/ldai_openai
23+
uv run isort --check --atomic src/ldai_openai
24+
uv run pycodestyle src/ldai_openai
2525

2626
.PHONY: build
2727
build: #! Build distribution files
2828
build: install
29-
poetry build
30-
29+
uv build

packages/ai-providers/server-ai-openai/pyproject.toml

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
[tool.poetry]
1+
[project]
22
name = "launchdarkly-server-sdk-ai-openai"
33
version = "0.2.0"
44
description = "LaunchDarkly AI SDK OpenAI Provider"
5-
authors = ["LaunchDarkly <dev@launchdarkly.com>"]
6-
license = "Apache-2.0"
5+
authors = [{name = "LaunchDarkly", email = "dev@launchdarkly.com"}]
6+
license = {text = "Apache-2.0"}
77
readme = "README.md"
8-
homepage = "https://docs.launchdarkly.com/sdk/ai/python"
9-
repository = "https://github.com/launchdarkly/python-server-sdk-ai"
8+
requires-python = ">=3.9,<4"
109
classifiers = [
1110
"Intended Audience :: Developers",
1211
"License :: OSI Approved :: Apache Software License",
@@ -20,20 +19,31 @@ classifiers = [
2019
"Topic :: Software Development",
2120
"Topic :: Software Development :: Libraries",
2221
]
23-
packages = [{ include = "ldai_openai", from = "src" }]
22+
dependencies = [
23+
"launchdarkly-server-sdk-ai>=0.16.0",
24+
"openai>=1.0.0",
25+
]
2426

25-
[tool.poetry.dependencies]
26-
python = ">=3.9,<4"
27-
launchdarkly-server-sdk-ai = ">=0.16.0"
28-
openai = ">=1.0.0"
27+
[project.urls]
28+
Homepage = "https://docs.launchdarkly.com/sdk/ai/python"
29+
Repository = "https://github.com/launchdarkly/python-server-sdk-ai"
30+
31+
[dependency-groups]
32+
dev = [
33+
"pytest>=2.8",
34+
"pytest-cov>=2.4.0",
35+
"pytest-asyncio>=0.21.0,<1.0.0",
36+
"mypy==1.18.2",
37+
"pycodestyle>=2.11.0",
38+
"isort>=5.12.0",
39+
]
2940

30-
[tool.poetry.group.dev.dependencies]
31-
pytest = ">=2.8"
32-
pytest-cov = ">=2.4.0"
33-
pytest-asyncio = ">=0.21.0,<1.0.0"
34-
mypy = "==1.18.2"
35-
pycodestyle = ">=2.11.0"
36-
isort = ">=5.12.0"
41+
[build-system]
42+
requires = ["hatchling"]
43+
build-backend = "hatchling.build"
44+
45+
[tool.hatch.build.targets.wheel]
46+
packages = ["src/ldai_openai"]
3747

3848
[tool.mypy]
3949
python_version = "3.9"
@@ -46,14 +56,7 @@ profile = "black"
4656
known_third_party = ["openai", "ldai"]
4757
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
4858

49-
5059
[tool.pytest.ini_options]
5160
addopts = ["-ra"]
5261
testpaths = ["tests"]
5362
asyncio_mode = "auto"
54-
55-
56-
[build-system]
57-
requires = ["poetry-core"]
58-
build-backend = "poetry.core.masonry.api"
59-

packages/sdk/server-ai/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ help: #! Show this help message
1515

1616
.PHONY: install
1717
install: #! Install package dependencies
18-
poetry install
18+
uv sync --group dev
1919

2020
.PHONY: test
2121
test: #! Run unit tests
2222
test: install
23-
poetry run pytest $(PYTEST_FLAGS)
23+
uv run pytest $(PYTEST_FLAGS)
2424

2525
.PHONY: lint
2626
lint: #! Run type analysis and linting checks
2727
lint: install
28-
poetry run mypy src/ldai
29-
poetry run isort --check --atomic src/ldai
30-
poetry run pycodestyle src/ldai
28+
uv run mypy src/ldai
29+
uv run isort --check --atomic src/ldai
30+
uv run pycodestyle src/ldai
3131

3232
.PHONY: build
3333
build: #! Build distribution files
3434
build: install
35-
poetry build
35+
uv build
3636

3737
.PHONY: docs
3838
docs: #! Generate sphinx-based documentation
39-
poetry install --with docs
40-
poetry run $(SPHINXBUILD) -M html "$(DOCS_DIR)" "$(DOCS_BUILD_DIR)" $(SPHINXOPTS)
39+
uv sync --group docs
40+
uv run $(SPHINXBUILD) -M html "$(DOCS_DIR)" "$(DOCS_BUILD_DIR)" $(SPHINXOPTS)

0 commit comments

Comments
 (0)