Skip to content

Commit 8abdb67

Browse files
authored
migrate build backend to hatch (#543)
1 parent b74f405 commit 8abdb67

File tree

7 files changed

+66
-207
lines changed

7 files changed

+66
-207
lines changed

livekit-api/pyproject.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=42"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "livekit-api"
7-
version = "0.8.0"
7+
dynamic = ["version"]
88
description = "Python Server API for LiveKit"
99
readme = "README.md"
1010
requires-python = ">=3.9.0"
@@ -40,3 +40,12 @@ Source = "https://github.com/livekit/python-sdks/"
4040

4141
[tool.uv.sources]
4242
livekit-protocol = { workspace = true }
43+
44+
[tool.hatch.version]
45+
path = "livekit/api/version.py"
46+
47+
[tool.hatch.build.targets.wheel]
48+
packages = ["livekit"]
49+
50+
[tool.hatch.build.targets.sdist]
51+
include = ["/livekit"]

livekit-api/setup.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

livekit-protocol/pyproject.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=42"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "livekit-protocol"
7-
version = "1.1.1"
7+
dynamic = ["version"]
88
description = "Python protocol stubs for LiveKit"
99
requires-python = ">=3.7.0"
1010
license = "Apache-2.0"
@@ -31,3 +31,12 @@ dependencies = [
3131
Documentation = "https://docs.livekit.io"
3232
Website = "https://livekit.io/"
3333
Source = "https://github.com/livekit/python-sdks/"
34+
35+
[tool.hatch.version]
36+
path = "livekit/protocol/version.py"
37+
38+
[tool.hatch.build.targets.wheel]
39+
packages = ["livekit"]
40+
41+
[tool.hatch.build.targets.sdist]
42+
include = ["/livekit"]

livekit-protocol/setup.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

livekit-rtc/hatch_build.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2023 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
16+
17+
18+
class CustomBuildHook(BuildHookInterface):
19+
def initialize(self, version, build_data):
20+
"""Force platform-specific wheel due to native libraries"""
21+
build_data["pure_python"] = False
22+
build_data["infer_tag"] = True

livekit-rtc/pyproject.toml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=42", "wheel", "requests"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling", "requests"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "livekit"
7-
version = "0.16.8"
7+
dynamic = ["version"]
88
description = "Python Real-time SDK for LiveKit"
99
readme = "README.md"
1010
requires-python = ">=3.9.0"
@@ -35,6 +35,23 @@ Documentation = "https://docs.livekit.io"
3535
Website = "https://livekit.io/"
3636
Source = "https://github.com/livekit/python-sdks/"
3737

38+
[tool.hatch.version]
39+
path = "livekit/rtc/version.py"
40+
41+
[tool.hatch.build.targets.wheel]
42+
packages = ["livekit"]
43+
artifacts = [
44+
"livekit/rtc/resources/*.so",
45+
"livekit/rtc/resources/*.dylib",
46+
"livekit/rtc/resources/*.dll",
47+
]
48+
49+
[tool.hatch.build.targets.wheel.hooks.custom]
50+
path = "hatch_build.py"
51+
52+
[tool.hatch.build.targets.sdist]
53+
include = ["/livekit", "/rust-sdks"]
54+
3855
[tool.cibuildwheel]
3956
build = "cp39-*"
4057
skip = "*-musllinux_*" # not supported (libwebrtc is using glibc)

livekit-rtc/setup.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)