Skip to content

Commit 97b4a5a

Browse files
authored
Merge pull request #107 from Labelbox/master-fix
2.4.10
2 parents e6d9f16 + 55c3b3c commit 97b4a5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+756
-182
lines changed

.github/workflows/python-package.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
max-parallel: 1
1616
matrix:
1717
# TODO: unlock parallel testing by using more API keys
18-
python-version: [3.6]
18+
python-version: [3.6, 3.7, 3.8]
1919

2020
steps:
2121

@@ -27,9 +27,9 @@ jobs:
2727
- name: set environment for branch
2828
run: |
2929
if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
30-
echo "::set-env name=LABELBOX_TEST_ENVIRON::prod"
30+
echo "LABELBOX_TEST_ENVIRON=prod" >> $GITHUB_ENV
3131
else
32-
echo "::set-env name=LABELBOX_TEST_ENVIRON::staging"
32+
echo "LABELBOX_TEST_ENVIRON=staging" >> $GITHUB_ENV
3333
fi
3434
3535
- uses: actions/checkout@v2
@@ -58,7 +58,7 @@ jobs:
5858
mypy -p labelbox --pretty --show-error-codes
5959
- name: Install package and test dependencies
6060
run: |
61-
pip install tox==3.18.1 tox-gh-actions==1.3.0 pytest-parallel==0.1.0
61+
pip install tox==3.18.1
6262
6363
# TODO: replace tox.ini with what the Makefile does
6464
# to make sure local testing is
@@ -73,4 +73,4 @@ jobs:
7373
# randall+staging-python@labelbox.com
7474
LABELBOX_TEST_API_KEY_STAGING: ${{ secrets.STAGING_LABELBOX_API_KEY }}
7575
run: |
76-
pytest --workers 2 -svv
76+
tox -e py -- -svvx

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,9 @@ dmypy.json
131131

132132
# macos files
133133
.DS_STORE
134+
135+
# Sphinx Docs build
136+
docs/build/
137+
# and source files
138+
docs/source/_static
139+
docs/source/_templates

.readthedocs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Read the docs config file version (Required)
6+
version: 2
7+
8+
# Build documentation in the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: docs/source/conf.py
11+
12+
# Build all formats (epub, pdf, htmlzip)
13+
formats:
14+
- pdf
15+
16+
# Optionally set the version of Python and requirements required to build your docs
17+
python:
18+
version: 3.7
19+
install:
20+
- requirements: requirements.txt
21+
- requirements: docs/requirements.txt
22+
- method: setuptools
23+
path: .

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
# Changelog
2+
3+
## In progress
4+
### Fix
5+
* Custom queries with bad syntax now raise adequate exceptions (InvalidQuery)
6+
* Comparing a Labelbox object (e.g. Project) to None doesn't raise an exception
7+
* Adding `order_by` to `Project.labels` doesn't raise an exception
8+
9+
## Version 2.4.10 (2021-01-05)
10+
### Added
11+
* SDK version added to request headers
12+
213
## Version 2.4.9 (2020-11-09)
314
### Fix
415
* 2.4.8 was broken for > Python 3.6

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Labelbox Python SDK API Documentation
2+
3+
The Labelbox Python API documentation is generated from source code comments
4+
using Sphinx (https://www.sphinx-doc.org/).
5+
6+
## Preparing the Sphinx environment
7+
8+
To generate the documentation install Sphinx and Sphinxcontrib-Napoleon. The
9+
easiest way to do it is using a Python virtual env and pip:
10+
11+
```
12+
# create a virtual environment
13+
python3 -m venv labelbox_docs_venv
14+
15+
# activate the venv
16+
source ./labelbox_docs_venv/bin/activate
17+
18+
# upgrade venv pip and setuptools
19+
pip install --upgrade pip setuptools
20+
21+
# install Sphinx and necessary contrib from requriements
22+
pip install -r labelbox_root/docs/requirements.txt
23+
24+
# install Labelbox dependencies
25+
pip install -r labelbox_root/requirements.txt
26+
```
27+
28+
There are other ways to do prepare the environment, but we highly recommend
29+
using a Python virtual environment.
30+
31+
## Generating Labelbox SDK API documentation
32+
33+
With the Sphinx environment prepared, enter the docs folder:
34+
35+
```
36+
cd labelbox_root/docs/
37+
```
38+
39+
Run the make build tool, instructing it to build docs as HTML:
40+
```
41+
make html
42+
```

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Sphinx==3.4.3
2+
sphinxcontrib-napoleon==0.7
3+
sphinx-rtd-theme==0.5.1

docs/source/conf.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('../..'))
16+
17+
# -- Project information -----------------------------------------------------
18+
19+
project = 'Labelbox Python API reference'
20+
copyright = '2021, Labelbox'
21+
22+
release = '2.4'
23+
24+
# -- General configuration ---------------------------------------------------
25+
26+
# Add any Sphinx extension module names here, as strings. They can be
27+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
28+
# ones.
29+
extensions = [
30+
'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinxcontrib.napoleon'
31+
]
32+
33+
# Add any paths that contain templates here, relative to this directory.
34+
templates_path = ['_templates']
35+
36+
# List of patterns, relative to source directory, that match files and
37+
# directories to ignore when looking for source files.
38+
# This pattern also affects html_static_path and html_extra_path.
39+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
40+
41+
# -- Options for HTML output -------------------------------------------------
42+
43+
# The theme to use for HTML and HTML Help pages. See the documentation for
44+
# a list of builtin themes.
45+
#
46+
html_theme = 'sphinx_rtd_theme'
47+
48+
# Add any paths that contain custom static files (such as style sheets) here,
49+
# relative to this directory. They are copied after the builtin static files,
50+
# so a file named "default.css" will overwrite the builtin "default.css".
51+
html_static_path = ['_static']

0 commit comments

Comments
 (0)