Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ inputs:
runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@6ee6290f1cbc4156c0bdd66691b2c144ef8df19a # v7.4
with:
python-version: ${{ inputs.python_version }}

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- name: Install Dependencies
shell: bash
working-directory: ${{ inputs.workspace_path }}
run: poetry install
run: uv sync --all-groups

- name: Lint
shell: bash
Expand Down
47 changes: 6 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@6ee6290f1cbc4156c0bdd66691b2c144ef8df19a # v7.4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- name: Install requirements
working-directory: packages/sdk/server-ai
run: poetry install

- name: Run tests
run: make -C packages/sdk/server-ai test

Expand Down Expand Up @@ -90,25 +83,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@6ee6290f1cbc4156c0bdd66691b2c144ef8df19a # v7.4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- name: Configure poetry for local virtualenvs
run: poetry config virtualenvs.in-project true

- name: Install server-ai dependency first
working-directory: packages/sdk/server-ai
run: poetry install

- name: Install requirements
working-directory: packages/ai-providers/server-ai-langchain
run: poetry install

- name: Run tests
run: make -C packages/ai-providers/server-ai-langchain test

Expand Down Expand Up @@ -143,24 +122,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@6ee6290f1cbc4156c0bdd66691b2c144ef8df19a # v7.4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- name: Configure poetry for local virtualenvs
run: poetry config virtualenvs.in-project true

- name: Install server-ai dependency first
working-directory: packages/sdk/server-ai
run: poetry install

- name: Install requirements
working-directory: packages/ai-providers/server-ai-openai
run: poetry install

- name: Run tests
run: make -C packages/ai-providers/server-ai-openai test
28 changes: 0 additions & 28 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/ci
with:
workspace_path: packages/sdk/server-ai
Expand Down Expand Up @@ -104,13 +97,6 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/ci
with:
workspace_path: packages/ai-providers/server-ai-langchain
Expand Down Expand Up @@ -141,13 +127,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/ci
with:
workspace_path: ${{ inputs.workspace_path }}
Expand Down Expand Up @@ -210,13 +189,6 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439

- uses: ./.github/actions/ci
with:
workspace_path: packages/ai-providers/server-ai-openai
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ test-packaging-venv
.vscode/
.python-version

# Poetry
poetry.lock
# uv — lock file is not committed for libraries (only for applications)
uv.lock
.venv/
32 changes: 28 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,29 @@ We encourage pull requests and other contributions from the community. Before su

### Setup

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/).
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.

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

To install all packages and dev dependencies into the shared workspace environment:

```shell
make install
# or directly:
uv sync --all-groups
```
poetry install
eval $(poetry env activate)

To activate the shared virtual environment:

```shell
source .venv/bin/activate
```

Alternatively, prefix any command with `uv run` to use the workspace environment without activating it:

```shell
uv run pytest
uv run mypy src/ldai
```

### Testing
Expand All @@ -31,6 +47,14 @@ To run all unit tests:
make test
```

To run tests for a specific package:

```shell
make test-server-ai
make test-openai
make test-langchain
```

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.

### Building documentation
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ help: #! Show this help message
#

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

.PHONY: install-server-ai
install-server-ai: #! Install server-ai package
Expand Down
12 changes: 6 additions & 6 deletions packages/ai-providers/server-ai-langchain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ help: #! Show this help message

.PHONY: install
install: #! Install package dependencies
poetry install
uv sync --group dev

.PHONY: test
test: #! Run unit tests
test: install
poetry run pytest $(PYTEST_FLAGS)
uv run pytest $(PYTEST_FLAGS)

.PHONY: lint
lint: #! Run type analysis and linting checks
lint: install
poetry run mypy src/ldai_langchain
poetry run isort --check --atomic src/ldai_langchain
poetry run pycodestyle src/ldai_langchain
uv run mypy src/ldai_langchain
uv run isort --check --atomic src/ldai_langchain
uv run pycodestyle src/ldai_langchain

.PHONY: build
build: #! Build distribution files
build: install
poetry build
uv build --out-dir dist
52 changes: 28 additions & 24 deletions packages/ai-providers/server-ai-langchain/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[tool.poetry]
[project]
name = "launchdarkly-server-sdk-ai-langchain"
version = "0.3.1"
description = "LaunchDarkly AI SDK LangChain Provider"
authors = ["LaunchDarkly <dev@launchdarkly.com>"]
license = "Apache-2.0"
authors = [{name = "LaunchDarkly", email = "dev@launchdarkly.com"}]
license = {text = "Apache-2.0"}
readme = "README.md"
homepage = "https://docs.launchdarkly.com/sdk/ai/python"
repository = "https://github.com/launchdarkly/python-server-sdk-ai"
requires-python = ">=3.9,<4"
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
Expand All @@ -20,21 +19,32 @@ classifiers = [
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
]
packages = [{ include = "ldai_langchain", from = "src" }]
dependencies = [
"launchdarkly-server-sdk-ai>=0.16.0",
"langchain-core>=0.2.0",
"langchain>=0.2.0",
]

[project.urls]
Homepage = "https://docs.launchdarkly.com/sdk/ai/python"
Repository = "https://github.com/launchdarkly/python-server-sdk-ai"

[dependency-groups]
dev = [
"pytest>=2.8",
"pytest-cov>=2.4.0",
"pytest-asyncio>=0.21.0",
"mypy==1.18.2",
"pycodestyle>=2.11.0",
"isort>=5.12.0",
]

[tool.poetry.dependencies]
python = ">=3.9,<4"
launchdarkly-server-sdk-ai = ">=0.16.0"
langchain-core = ">=0.2.0"
langchain = ">=0.2.0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry.group.dev.dependencies]
pytest = ">=2.8"
pytest-cov = ">=2.4.0"
pytest-asyncio = ">=0.21.0"
mypy = "==1.18.2"
pycodestyle = ">=2.11.0"
isort = ">=5.12.0"
[tool.hatch.build.targets.wheel]
packages = ["src/ldai_langchain"]

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


[tool.pytest.ini_options]
addopts = ["-ra"]
testpaths = ["tests"]
asyncio_mode = "auto"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
13 changes: 6 additions & 7 deletions packages/ai-providers/server-ai-openai/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@ help: #! Show this help message

.PHONY: install
install: #! Install package dependencies
poetry install
uv sync --group dev

.PHONY: test
test: #! Run unit tests
test: install
poetry run pytest $(PYTEST_FLAGS)
uv run pytest $(PYTEST_FLAGS)

.PHONY: lint
lint: #! Run type analysis and linting checks
lint: install
poetry run mypy src/ldai_openai
poetry run isort --check --atomic src/ldai_openai
poetry run pycodestyle src/ldai_openai
uv run mypy src/ldai_openai
uv run isort --check --atomic src/ldai_openai
uv run pycodestyle src/ldai_openai

.PHONY: build
build: #! Build distribution files
build: install
poetry build

uv build --out-dir dist
Loading
Loading