Skip to content
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: 5 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
max-parallel: 1
matrix:
# TODO: unlock parallel testing by using more API keys
python-version: [3.6]
python-version: [3.6, 3.7, 3.8]

steps:

Expand All @@ -27,9 +27,9 @@ jobs:
- name: set environment for branch
run: |
if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
echo "::set-env name=LABELBOX_TEST_ENVIRON::prod"
echo "LABELBOX_TEST_ENVIRON=prod" >> $GITHUB_ENV
else
echo "::set-env name=LABELBOX_TEST_ENVIRON::staging"
echo "LABELBOX_TEST_ENVIRON=staging" >> $GITHUB_ENV
fi

- uses: actions/checkout@v2
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
mypy -p labelbox --pretty --show-error-codes
- name: Install package and test dependencies
run: |
pip install tox==3.18.1 tox-gh-actions==1.3.0 pytest-parallel==0.1.0
pip install tox==3.18.1

# TODO: replace tox.ini with what the Makefile does
# to make sure local testing is
Expand All @@ -73,4 +73,4 @@ jobs:
# randall+staging-python@labelbox.com
LABELBOX_TEST_API_KEY_STAGING: ${{ secrets.STAGING_LABELBOX_API_KEY }}
run: |
pytest --workers 2 -svv
tox -e py -- -svv
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,9 @@ dmypy.json

# macos files
.DS_STORE

# Sphinx Docs build
docs/build/
# and source files
docs/source/_static
docs/source/_templates
23 changes: 23 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Read the docs config file version (Required)
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Build all formats (epub, pdf, htmlzip)
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: requirements.txt
- requirements: docs/requirements.txt
- method: setuptools
path: .
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Changelog
## Version 2.4.9 (2020-09-10)

## In progress
### Fix
* Custom queries with bad syntax now raise adequate exceptions (InvalidQuery)
* Comparing a Labelbox object (e.g. Project) to None doesn't raise an exception
* Adding `order_by` to `Project.labels` doesn't raise an exception

## Version 2.4.10 (2021-01-05)
### Added
* SDK version added to request headers

## Version 2.4.9 (2020-11-09)
### Fix
* 2.4.8 was broken for > Python 3.6
### Added
* include new `Project.enable_model_assisted_labeling` method for turning on [model-assisted labeling](https://labelbox.com/docs/automation/model-assisted-labeling)

## Version 2.4.8 (2020-09-10)
## Version 2.4.8 (2020-11-06)
### Fix
* fix failing `next` call https://github.com/Labelbox/labelbox-python/issues/74

Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
42 changes: 42 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Labelbox Python SDK API Documentation

The Labelbox Python API documentation is generated from source code comments
using Sphinx (https://www.sphinx-doc.org/).

## Preparing the Sphinx environment

To generate the documentation install Sphinx and Sphinxcontrib-Napoleon. The
easiest way to do it is using a Python virtual env and pip:

```
# create a virtual environment
python3 -m venv labelbox_docs_venv

# activate the venv
source ./labelbox_docs_venv/bin/activate

# upgrade venv pip and setuptools
pip install --upgrade pip setuptools

# install Sphinx and necessary contrib from requriements
pip install -r labelbox_root/docs/requirements.txt

# install Labelbox dependencies
pip install -r labelbox_root/requirements.txt
```

There are other ways to do prepare the environment, but we highly recommend
using a Python virtual environment.

## Generating Labelbox SDK API documentation

With the Sphinx environment prepared, enter the docs folder:

```
cd labelbox_root/docs/
```

Run the make build tool, instructing it to build docs as HTML:
```
make html
```
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sphinx==3.4.3
sphinxcontrib-napoleon==0.7
sphinx-rtd-theme==0.5.1
51 changes: 51 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))

# -- Project information -----------------------------------------------------

project = 'Labelbox Python API reference'
copyright = '2021, Labelbox'

release = '2.4'

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinxcontrib.napoleon'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
Loading