Skip to content

Commit 31918e0

Browse files
authored
Instructions for Ubuntu 18. Better python version tests. (#15)
* Reverting black version for py3.6 support in tests. * Expanding GHA tests to include many python versions. * Fixing py3.6 syntax error. * Instructions for setting up python 3.8 on Ubuntu 18.04 * Taking out 3.6 and 3.11 from automated tests. * Upgrading to 0.5.1 and removing py3.6 from poetry allowed list. * Better Ubuntu 18.04 install instructions.
1 parent 57c441c commit 31918e0

File tree

4 files changed

+50
-21
lines changed

4 files changed

+50
-21
lines changed

.github/workflows/test-integ.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,31 @@ name: test integ
33
on: [push]
44
jobs:
55
run-tests:
6-
runs-on: ubuntu-latest
6+
runs-on: ubuntu-20.04
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
python-version: [
11+
#"3.6", # Default on Ubuntu18.04 but openapi-generator fails
12+
"3.7",
13+
"3.8",
14+
"3.9",
15+
"3.10",
16+
#"3.11", # Not passing tests. No useful error messages.
17+
]
718
env:
819
# This is associated with the "sdk-integ-test" user, credentials on 1password
920
GROUNDLIGHT_API_TOKEN: ${{ secrets.GROUNDLIGHT_API_TOKEN }}
1021
steps:
1122
- name: get code
12-
uses: actions/checkout@v2
13-
- name: install python
14-
uses: actions/setup-python@v2
23+
uses: actions/checkout@v3
24+
- name: install python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v4
1526
with:
16-
python-version: 3.9
17-
- name: install poetry
27+
python-version: ${{ matrix.python-version }}
28+
- name: Display Python version
29+
run: python -c "import sys; print(sys.version)"
30+
- name: install poetry and build poetry environment
1831
run: |
1932
pip install -U pip
2033
pip install poetry

UserGuide.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,18 @@ How to build a computer vision system in 5 lines of python code:
1414
```Python
1515
from groundlight import Groundlight
1616
gl = Groundlight()
17-
18-
# Create a new detector: use natural language to describe what you want to understand
19-
detector = gl.create_detector(name="door", query="Is the door open?")
20-
21-
# Send an image to the detector
22-
image_query = gl.submit_image_query(detector=detector, image="path/to/filename.jpeg")
23-
24-
# Show the results
25-
print(f"The answer is {image_query.result}")
17+
detector = gl.create_detector(name="door", query="Is the door open?") # Define your detector using natural language
18+
image_query = gl.submit_image_query(detector=detector, image="path/to/filename.jpeg") # send an image
19+
print(f"The answer is {image_query.result}") # get the result
2620
```
2721

2822

2923
## Getting Started
3024

31-
1. Install the `groundlight` sdk.
25+
1. Install the `groundlight` SDK. Requires python version 3.7 or higher. See [prerequisites](#Prerequisites).
3226

3327
```Bash
34-
$ pip install groundlight
28+
$ pip3 install groundlight
3529
```
3630

3731
1. To access the API, you need an API token. You can create one on the
@@ -47,10 +41,32 @@ which is an easy way to get started, but is NOT a best practice. Please do not
4741

4842
```bash
4943
$ export GROUNDLIGHT_API_TOKEN=api_2asdfkjEXAMPLE
50-
$ python glapp.py
44+
$ python3 glapp.py
5145
```
5246

5347

48+
## Prerequisites
49+
50+
### Using Groundlight SDK on Ubuntu 18.04
51+
52+
Ubuntu 18.04 still uses python 3.6 by default, which is end-of-life. We recommend setting up python 3.8 as follows:
53+
54+
```
55+
# Prepare Ubuntu to install things
56+
sudo apt-get update
57+
# Install the basics
58+
sudo apt-get install -y python3.8 python3.8-distutils curl
59+
# Configure `python3` to run python3.8 by default
60+
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 10
61+
# Download and install pip3.8
62+
curl https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py
63+
sudo python3.8 /tmp/get-pip.py
64+
# Configure `pip3` to run pip3.8
65+
sudo update-alternatives --install /usr/bin/pip3 pip3 $(which pip3.8) 10
66+
# Now we can install Groundlight!
67+
pip3 install groundlight
68+
```
69+
5470
## Using Groundlight on the edge
5571
5672
Starting your model evaluations at the edge reduces latency, cost, network bandwidth, and energy. Once you have downloaded and installed your Groundlight edge models, you can configure the Groundlight SDK to use your edge environment by configuring the 'endpoint' to point at your local environment as such:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "groundlight"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
license = "MIT"
55
readme = "UserGuide.md"
66
homepage = "https://groundlight.ai"
@@ -12,7 +12,7 @@ packages = [
1212
]
1313

1414
[tool.poetry.dependencies]
15-
python = ">=3.6.2,<4.0"
15+
python = ">=3.7.0,<4.0"
1616
python-dateutil = "^2.8.2"
1717
urllib3 = "^1.26.9"
1818
frozendict = "^2.3.2"

src/groundlight/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_or_create_detector(self, name: str, query: str, config_name: str = None)
9090
return existing_detector
9191
else:
9292
raise ValueError(
93-
f"Found existing detector with {name=} (id={existing_detector.id}) but the queries don't match"
93+
f"Found existing detector with name={name} (id={existing_detector.id}) but the queries don't match"
9494
)
9595

9696
return self.create_detector(name, query, config_name)

0 commit comments

Comments
 (0)