Skip to content

Commit 841322d

Browse files
mrobers1982midhun-pm
authored andcommitted
refactor to support lbox-alignerr as a rye workspace
1 parent 32f7bdc commit 841322d

26 files changed

+1447
-49
lines changed

libs/labelbox/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies = [
1212
"tqdm>=4.66.2",
1313
"geojson>=3.1.0",
1414
"lbox-clients==1.1.2",
15-
"PyYAML>=6.0",
15+
"PyYAML>=6.0"
1616
]
1717
readme = "README.md"
1818
requires-python = ">=3.9,<3.14"
@@ -56,6 +56,9 @@ data = [
5656
"typing-extensions>=4.10.0",
5757
"opencv-python-headless>=4.9.0.80",
5858
]
59+
alignerr = [
60+
"lbox-alignerr>=0.1.0",
61+
]
5962

6063
[build-system]
6164
requires = ["hatchling"]

libs/labelbox/src/labelbox/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
from labelbox.schema.ontology_kind import OntologyKind
7979
from labelbox.schema.organization import Organization
8080
from labelbox.schema.project import Project
81-
from labelbox.alignerr.schema.project_rate import ProjectRateV2 as ProjectRate
8281
from labelbox.schema.project_model_config import ProjectModelConfig
8382
from labelbox.schema.project_overview import (
8483
ProjectOverview,

libs/labelbox/src/labelbox/alignerr/__init__.py

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

libs/labelbox/src/labelbox/client.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
from labelbox.schema.taskstatus import TaskStatus
8383
from labelbox.schema.api_key import ApiKey
8484
from labelbox.schema.timeunit import TimeUnit
85-
from labelbox.alignerr import AlignerrWorkspace
8685

8786
logger = logging.getLogger(__name__)
8887

@@ -162,10 +161,6 @@ def enable_experimental(self, value: bool):
162161
def app_url(self) -> str:
163162
return self._request_client.app_url
164163

165-
@property
166-
def alignerr_workspace(self) -> AlignerrWorkspace:
167-
return AlignerrWorkspace(self)
168-
169164
def set_sdk_method(self, sdk_method: str):
170165
self._request_client.sdk_method = sdk_method
171166

libs/labelbox/src/labelbox/orm/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ class Entity(metaclass=EntityMeta):
395395
ProjectRole: Type[labelbox.ProjectRole]
396396
ProjectModelConfig: Type[labelbox.ProjectModelConfig]
397397
Project: Type[labelbox.Project]
398-
ProjectRate: Type[labelbox.ProjectRate]
399398
Batch: Type[labelbox.Batch]
400399
CatalogSlice: Type[labelbox.CatalogSlice]
401400
ModelSlice: Type[labelbox.ModelSlice]

libs/lbox-alignerr/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Alignerr
2+
3+
Alignerr workspace management for Labelbox.
4+
5+
This package provides functionality for managing Alignerr projects, including:
6+
- Project creation and configuration
7+
- Rate management for labelers and reviewers
8+
- Domain and tag management
9+
- Workforce management

libs/lbox-alignerr/pyproject.toml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[project]
2+
name = "lbox-alignerr"
3+
version = "0.1.0"
4+
description = "Alignerr workspace management for Labelbox"
5+
authors = [
6+
{ name = "Labelbox", email = "engineering@labelbox.com" }
7+
]
8+
dependencies = [
9+
"labelbox>=0.1.0",
10+
"pydantic>=2.0.0",
11+
"pyyaml>=6.0",
12+
]
13+
readme = "README.md"
14+
requires-python = ">= 3.9"
15+
16+
classifiers=[
17+
# How mature is this project?
18+
"Development Status :: 2 - Pre-Alpha",
19+
# Indicate who your project is intended for
20+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
21+
"Topic :: Software Development :: Libraries",
22+
"Intended Audience :: Developers",
23+
"Intended Audience :: Science/Research",
24+
# Pick your license as you wish
25+
"License :: OSI Approved :: Apache Software License",
26+
# Specify the Python versions you support here.
27+
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
]
33+
keywords = ["ml", "ai", "labelbox", "labeling", "llm", "machinelearning", "alignerr", "lbox-alignerr"]
34+
35+
[project.urls]
36+
Homepage = "https://labelbox.com/"
37+
Documentation = "https://labelbox-python.readthedocs.io/en/latest/"
38+
Repository = "https://github.com/Labelbox/labelbox-python"
39+
Issues = "https://github.com/Labelbox/labelbox-python/issues"
40+
Changelog = "https://github.com/Labelbox/labelbox-python/blob/develop/libs/labelbox/CHANGELOG.md"
41+
42+
[build-system]
43+
requires = ["hatchling"]
44+
build-backend = "hatchling.build"
45+
46+
[tool.rye]
47+
managed = true
48+
dev-dependencies = [
49+
"pytest>=8.1.1",
50+
"pytest-cases>=3.8.4",
51+
"pytest-rerunfailures>=14.0",
52+
"pytest-snapshot>=0.9.0",
53+
"pytest-cov>=4.1.0",
54+
"pytest-xdist>=3.5.0",
55+
"faker>=25.5.0",
56+
"pytest-timestamper>=0.0.10",
57+
"pytest-timeout>=2.3.1",
58+
"pytest-order>=1.2.1",
59+
"pyjwt>=2.9.0",
60+
]
61+
62+
[tool.rye.scripts]
63+
unit = "pytest tests/unit"
64+
integration = "pytest tests/integration"
65+
66+
[tool.hatch.metadata]
67+
allow-direct-references = true
68+
69+
[tool.hatch.build.targets.wheel]
70+
packages = ["src/alignerr"]
71+
72+
[tool.pytest.ini_options]
73+
addopts = "-rP -vvv --durations=20 --cov=alignerr --import-mode=importlib"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from alignerr.alignerr_project import AlignerrWorkspace
2+
3+
__all__ = ["AlignerrWorkspace"]

libs/labelbox/src/labelbox/alignerr/alignerr_project.py renamed to libs/lbox-alignerr/src/alignerr/alignerr_project.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
import logging
55

6-
from labelbox.alignerr.schema.project_rate import ProjectRateV2
7-
from labelbox.alignerr.schema.project_domain import ProjectDomain
8-
from labelbox.alignerr.schema.enchanced_resource_tags import (
6+
from alignerr.schema.project_rate import ProjectRateV2
7+
from alignerr.schema.project_domain import ProjectDomain
8+
from alignerr.schema.enchanced_resource_tags import (
99
EnhancedResourceTag,
1010
ResourceTagType,
1111
)
12-
from labelbox.alignerr.schema.project_boost_workforce import (
12+
from alignerr.schema.project_boost_workforce import (
1313
ProjectBoostWorkforce,
1414
)
1515
from labelbox.pagination import PaginatedCollection
@@ -20,7 +20,7 @@
2020
if TYPE_CHECKING:
2121
from labelbox import Client
2222
from labelbox.schema.project import Project
23-
from labelbox.alignerr.schema.project_domain import ProjectDomain
23+
from alignerr.schema.project_domain import ProjectDomain
2424

2525

2626
class AlignerrRole(Enum):
@@ -161,15 +161,19 @@ def __init__(self, client: "Client"):
161161
self.client = client
162162

163163
def project_builder(self):
164-
from labelbox.alignerr.alignerr_project_builder import (
164+
from alignerr.alignerr_project_builder import (
165165
AlignerrProjectBuilder,
166166
)
167167

168168
return AlignerrProjectBuilder(self.client)
169169

170170
def project_prototype(self):
171-
from labelbox.alignerr.alignerr_project_factory import (
171+
from alignerr.alignerr_project_factory import (
172172
AlignerrProjectFactory,
173173
)
174174

175175
return AlignerrProjectFactory(self.client)
176+
177+
@classmethod
178+
def from_labelbox(cls, client: "Client") -> "AlignerrWorkspace":
179+
return cls(client)

libs/labelbox/src/labelbox/alignerr/alignerr_project_builder.py renamed to libs/lbox-alignerr/src/alignerr/alignerr_project_builder.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from typing import TYPE_CHECKING, Optional, Union, List
44
import logging
55

6-
from labelbox.alignerr.schema.project_rate import BillingMode
7-
from labelbox.alignerr.schema.project_rate import ProjectRateInput
8-
from labelbox.alignerr.schema.project_domain import ProjectDomain
9-
from labelbox.alignerr.schema.enchanced_resource_tags import (
6+
from alignerr.schema.project_rate import BillingMode
7+
from alignerr.schema.project_rate import ProjectRateInput
8+
from alignerr.schema.project_domain import ProjectDomain
9+
from alignerr.schema.enchanced_resource_tags import (
1010
EnhancedResourceTag,
1111
ResourceTagType,
1212
)
13-
from labelbox.alignerr.schema.project_boost_workforce import (
13+
from alignerr.schema.project_boost_workforce import (
1414
ProjectBoostWorkforce,
1515
)
1616
from labelbox.schema.media_type import MediaType
@@ -28,7 +28,7 @@ class ValidationType(Enum):
2828

2929
if TYPE_CHECKING:
3030
from labelbox import Client
31-
from labelbox.alignerr.alignerr_project import AlignerrProject, AlignerrRole
31+
from alignerr.alignerr_project import AlignerrProject, AlignerrRole
3232

3333

3434
class AlignerrProjectBuilder:
@@ -185,7 +185,7 @@ def create(
185185
labelbox_project = self.client.create_project(**project_data)
186186

187187
# Import here to avoid circular imports
188-
from labelbox.alignerr.alignerr_project import AlignerrProject
188+
from alignerr.alignerr_project import AlignerrProject
189189

190190
alignerr_project = AlignerrProject(
191191
self.client, labelbox_project, _internal=True
@@ -254,7 +254,7 @@ def _create_project_owner(self, alignerr_project: "AlignerrProject"):
254254

255255
def _validate_alignerr_rates(self):
256256
# Import here to avoid circular imports
257-
from labelbox.alignerr.alignerr_project import AlignerrRole
257+
from alignerr.alignerr_project import AlignerrRole
258258

259259
required_role_rates = set(
260260
[AlignerrRole.Labeler.value, AlignerrRole.Reviewer.value]

0 commit comments

Comments
 (0)