Skip to content

Commit 0291abf

Browse files
committed
chore: Migrate from Poetry to uv for dependency management
1 parent 2b77ff8 commit 0291abf

10 files changed

Lines changed: 94 additions & 107 deletions

File tree

.github/actions/build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ runs:
66
steps:
77
- name: Build distribution files
88
shell: bash
9-
run: poetry build
9+
run: uv build --out-dir dist

.github/workflows/ci.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,8 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323

24-
- name: Install poetry
25-
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
26-
with:
27-
poetry-version: "1.8.5"
28-
29-
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v5
24+
- name: Set up uv
25+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
3126
with:
3227
python-version: ${{ matrix.python-version }}
3328

@@ -69,18 +64,13 @@ jobs:
6964
steps:
7065
- uses: actions/checkout@v4
7166

72-
- name: Install poetry
73-
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
74-
with:
75-
poetry-version: "1.8.5"
76-
77-
- name: Set up Python ${{ matrix.python-version }}
78-
uses: actions/setup-python@v5
67+
- name: Set up uv
68+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
7969
with:
8070
python-version: ${{ matrix.python-version }}
8171

8272
- name: Install requirements
83-
run: poetry install
73+
run: uv sync --all-extras
8474

8575
- uses: ./.github/actions/build
8676
- uses: ./.github/actions/build-docs

.github/workflows/manual-publish-docs.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313

14-
- uses: actions/setup-python@v5
14+
- name: Set up uv
15+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
1516
with:
16-
python-version: 3.9
17-
18-
- name: Install poetry
19-
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
17+
python-version: "3.12"
2018

2119
- uses: ./.github/actions/build-docs
2220

.github/workflows/manual-publish.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20-
- uses: actions/setup-python@v5
20+
- name: Set up uv
21+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
2122
with:
22-
python-version: 3.9
23-
24-
- name: Install poetry
25-
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439 # v3.0.0
23+
python-version: "3.12"
2624

2725
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
2826
name: "Get PyPI token"

.github/workflows/release-please.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ jobs:
2121
with:
2222
fetch-depth: 0 # Full history is required for proper changelog generation
2323

24-
- uses: actions/setup-python@v4
24+
- name: Set up uv
2525
if: ${{ steps.release.outputs.releases_created == 'true' }}
26+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
2627
with:
27-
python-version: 3.9
28-
29-
- name: Install poetry
30-
if: ${{ steps.release.outputs.releases_created == 'true' }}
31-
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439 # v3.0.0
28+
python-version: "3.12"
3229

3330
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
3431
name: "Get PyPI token"

.gitignore

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

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

.readthedocs.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
version: 2
22

3-
build:
4-
os: "ubuntu-22.04"
5-
tools:
6-
python: "3.12"
7-
jobs:
8-
post_create_environment:
9-
- python -m pip install poetry
10-
post_install:
11-
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
12-
133
sphinx:
144
builder: html
155
configuration: docs/conf.py
166
fail_on_warning: true
7+
8+
build:
9+
os: ubuntu-24.04
10+
tools:
11+
python: "3.12"
12+
jobs:
13+
pre_create_environment:
14+
- asdf plugin add uv
15+
- asdf install uv latest
16+
- asdf global uv latest
17+
create_environment:
18+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
19+
install:
20+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --group docs

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ This project should be developed against its minimum compatible version as descr
1919
To install the runtime and test requirements:
2020

2121
```
22-
poetry install
23-
eval $(poetry env activate)
22+
uv sync
23+
source .venv/bin/activate
2424
```
2525

2626
To also install the optional async dependencies (required to use `AsyncSSEClient`):
2727

2828
```
29-
poetry install --extras async
29+
uv sync --extra async
3030
```
3131

3232
### Testing

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ help: #! Show this help message
1818

1919
.PHONY: install
2020
install:
21-
poetry install
21+
@uv sync --all-extras
2222

2323
#
2424
# Quality control checks
@@ -27,36 +27,36 @@ install:
2727
.PHONY: test
2828
test: #! Run unit tests
2929
test: install
30-
poetry run pytest $(PYTEST_FLAGS)
30+
@uv run pytest $(PYTEST_FLAGS)
3131

3232
.PHONY: lint
3333
lint: #! Run type analysis and linting checks
3434
lint: install
35-
@poetry run mypy ld_eventsource
36-
@poetry run isort --check --atomic ld_eventsource contract-tests
37-
@poetry run pycodestyle ld_eventsource contract-tests
35+
@uv run mypy ld_eventsource
36+
@uv run isort --check --atomic ld_eventsource contract-tests
37+
@uv run pycodestyle ld_eventsource contract-tests
3838

3939
#
4040
# Documentation generation
4141
#
4242

4343
.PHONY: docs
4444
docs: #! Generate sphinx-based documentation
45-
poetry install --with docs
45+
@uv sync --group docs
4646
cd docs
47-
poetry run $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
47+
@uv run $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
4848

4949
#
5050
# Contract test service commands
5151
#
5252

5353
.PHONY: install-contract-tests-deps
5454
install-contract-tests-deps:
55-
poetry install --with contract-tests
55+
uv sync --all-extras --group contract-tests
5656

5757
.PHONY: start-contract-test-service
5858
start-contract-test-service:
59-
@cd contract-tests && poetry run python service.py
59+
@cd contract-tests && uv run python service.py
6060

6161
.PHONY: start-contract-test-service-bg
6262
start-contract-test-service-bg:
@@ -74,7 +74,7 @@ contract-tests: install-contract-tests-deps start-contract-test-service-bg run-c
7474

7575
.PHONY: start-async-contract-test-service
7676
start-async-contract-test-service:
77-
@cd contract-tests && poetry run python async_service.py 8001
77+
@cd contract-tests && uv run python async_service.py 8001
7878

7979
.PHONY: start-async-contract-test-service-bg
8080
start-async-contract-test-service-bg:

pyproject.toml

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
[tool.poetry]
1+
[project]
22
name = "launchdarkly-eventsource"
33
version = "1.6.0"
44
description = "LaunchDarkly SSE Client"
5-
authors = ["LaunchDarkly <dev@launchdarkly.com>"]
5+
authors = [
6+
{name = "LaunchDarkly", email = "dev@launchdarkly.com"}
7+
]
68
license = "Apache-2.0"
79
readme = "README.md"
8-
homepage = "https://docs.launchdarkly.com/sdk/server-side/python"
9-
repository = "https://github.com/launchdarkly/python-eventsource"
10-
documentation = "https://launchdarkly-sse-client-library.readthedocs.io/en/latest/"
10+
requires-python = ">=3.9"
1111
classifiers = [
1212
"Intended Audience :: Developers",
1313
"License :: OSI Approved :: Apache Software License",
@@ -21,63 +21,62 @@ classifiers = [
2121
"Topic :: Software Development",
2222
"Topic :: Software Development :: Libraries",
2323
]
24-
packages = [ { include = "ld_eventsource" } ]
25-
exclude = [
26-
{ path = "ld_eventsource/testing", format = "wheel" }
24+
dependencies = [
25+
"urllib3>=1.26.0,<3",
2726
]
2827

29-
[tool.poetry.dependencies]
30-
python = ">=3.9"
31-
urllib3 = ">=1.26.0,<3"
32-
aiohttp = { version = ">=3.8.0,<4", optional = true }
33-
34-
[tool.poetry.extras]
35-
async = ["aiohttp"]
36-
37-
[tool.poetry.group.dev.dependencies]
38-
mock = ">=2.0.0"
39-
pytest = ">=2.8"
40-
pytest-asyncio = ">=0.21"
41-
aiohttp = ">=3.8.0,<4"
42-
mypy = "^1.4.0"
43-
pycodestyle = "^2.12.1"
44-
isort = "^5.13.2"
45-
46-
47-
[tool.poetry.group.contract-tests]
48-
optional = true
49-
50-
[tool.poetry.group.contract-tests.dependencies]
51-
Flask = ">=3.0"
28+
[project.urls]
29+
Homepage = "https://docs.launchdarkly.com/sdk/server-side/python"
30+
Repository = "https://github.com/launchdarkly/python-eventsource"
31+
Documentation = "https://launchdarkly-sse-client-library.readthedocs.io/en/latest/"
5232

33+
[project.optional-dependencies]
34+
async = ["aiohttp>=3.8.0,<4"]
5335

54-
[tool.poetry.group.docs]
55-
optional = true
56-
57-
[tool.poetry.group.docs.dependencies]
58-
sphinx = ">=6,<8"
59-
sphinx-autodoc-typehints = "^1.3.0"
60-
sphinx-rtd-theme = ">=1.3,<4.0"
61-
backoff = ">=1.4.3"
62-
expiringdict = ">=1.1.4"
63-
pyrfc3339 = ">=1.0"
64-
jsonpickle = ">1.4.1"
65-
semver = ">=2.7.9"
66-
urllib3 = ">=1.26.0"
67-
jinja2 = ">=3.1.2"
36+
[dependency-groups]
37+
dev = [
38+
"mock>=2.0.0",
39+
"pytest>=2.8",
40+
"pytest-asyncio>=0.21",
41+
"aiohttp>=3.8.0,<4",
42+
"mypy>=1.4.0,<2",
43+
"pycodestyle>=2.12.1,<3",
44+
"isort>=5.13.2,<6",
45+
]
46+
contract-tests = [
47+
"Flask>=3.0",
48+
]
49+
docs = [
50+
"sphinx>=6,<8",
51+
"sphinx-autodoc-typehints>=1.3.0,<2",
52+
"sphinx-rtd-theme>=1.3,<4.0",
53+
"backoff>=1.4.3",
54+
"expiringdict>=1.1.4",
55+
"pyrfc3339>=1.0",
56+
"jsonpickle>1.4.1",
57+
"semver>=2.7.9",
58+
"urllib3>=1.26.0",
59+
"jinja2>=3.1.2",
60+
]
6861

6962
[tool.mypy]
7063
python_version = "3.9"
7164
ignore_missing_imports = true
72-
install_types = true
73-
non_interactive = true
7465

66+
# Do not type-check third-party test framework internals; their source may use
67+
# syntax newer than this project's minimum supported Python version.
68+
[[tool.mypy.overrides]]
69+
module = ["pytest", "pytest.*", "_pytest.*"]
70+
follow_imports = "skip"
7571

7672
[tool.pytest.ini_options]
7773
addopts = ["-ra"]
7874
asyncio_mode = "auto"
7975

80-
8176
[build-system]
82-
requires = ["poetry-core"]
83-
build-backend = "poetry.core.masonry.api"
77+
requires = ["hatchling"]
78+
build-backend = "hatchling.build"
79+
80+
[tool.hatch.build.targets.wheel]
81+
packages = ["ld_eventsource"]
82+
exclude = ["ld_eventsource/testing"]

0 commit comments

Comments
 (0)