Skip to content

[PLT-0] Publish demo #1734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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: 10 additions & 0 deletions libs/lbox-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# python generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info

# venv
.venv
44 changes: 44 additions & 0 deletions libs/lbox-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# https://github.com/ucyo/python-package-template/blob/master/Dockerfile
FROM python:3.8-slim as rye

ENV LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
PATH="/home/python/.local/bin:/home/python/.rye/shims:$PATH" \
PIP_NO_CACHE_DIR="false" \
RYE_VERSION="0.34.0" \
RYE_INSTALL_OPTION="--yes" \
LABELBOX_TEST_ENVIRON="prod"

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
inotify-tools \
make \
# cv2
libsm6 \
libxext6 \
ffmpeg \
libfontconfig1 \
libxrender1 \
libgl1-mesa-glx \
libgeos-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*

RUN groupadd --gid 1000 python && \
useradd --uid 1000 --gid python --shell /bin/bash --create-home python

USER 1000
WORKDIR /home/python/

RUN curl -sSf https://rye.astral.sh/get | bash -

COPY --chown=python:python . /home/python/labelbox-python/
WORKDIR /home/python/labelbox-python

RUN rye config --set-bool behavior.global-python=true && \
rye config --set-bool behavior.use-uv=true && \
rye pin 3.8 && \
rye sync

CMD rye run unit && rye integration
9 changes: 9 additions & 0 deletions libs/lbox-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# lbox-example

This is an example module which can be cloned and reused to develop modules under the `lbox` namespace.

## Module Status: Experimental

**TLDR: This module may be removed or altered at any given time and there is no offical support.**

Please see [here](https://docs.labelbox.com/docs/product-release-phases) for the formal definition of `Experimental`.
66 changes: 66 additions & 0 deletions libs/lbox-cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[project]
name = "lbox-cli"
version = "0.1.0"
description = "A CLI tool for labelbox"
authors = [
{ name = "Labelbox", email = "engineering@labelbox.com" }
]
dependencies = [
"tinydb>=4.8.0",
"click>=8.1.7",
"labelbox>=3.75.1",
]
readme = "README.md"
requires-python = ">= 3.8"

classifiers=[
# How mature is this project?
"Development Status :: 2 - Pre-Alpha",
# Indicate who your project is intended for
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
# Pick your license as you wish
"License :: OSI Approved :: Apache Software License",
# Specify the Python versions you support here.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
keywords = ["ml", "ai", "labelbox", "labeling", "llm", "machinelearning", "edu"]

[project.urls]
Homepage = "https://labelbox.com/"
Documentation = "https://labelbox-python.readthedocs.io/en/latest/"
Repository = "https://github.com/Labelbox/labelbox-python"
Issues = "https://github.com/Labelbox/labelbox-python/issues"
Changelog = "https://github.com/Labelbox/labelbox-python/blob/develop/libs/lbox-cli/CHANGELOG.md"

[project.scripts]
lbox = 'lbox.cli.main:cli'

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = []

[tool.rye.scripts]
unit = "pytest tests/unit"
integration = "python -c \"import sys; sys.exit(0)\""

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/lbox"]

[tool.pytest.ini_options]
addopts = "-rP -vvv --durations=20 --cov=lbox.cli --import-mode=importlib"
25 changes: 25 additions & 0 deletions libs/lbox-cli/src/lbox/cli/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import click
import tinydb
from pathlib import Path


@click.group()
def cli():
db = tinydb.TinyDB(
Path.home() / "~/.lbox/db.json", create_dirs=True, access_mode="r+"
)
print(db.count())


@cli.group()
def key():
pass


@key.command()
def select():
print("select")


def init():
return "init"
6 changes: 6 additions & 0 deletions libs/lbox-cli/tests/unit/lbox/cli/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from lbox.cli.main import init


class TestArt:
def test_init(self):
assert init() == "init"
Loading