Skip to content

Commit

Permalink
Instructions for Ubuntu 18. Better python version tests. (#15)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
robotrapta authored Oct 25, 2022
1 parent 57c441c commit 31918e0
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 21 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/test-integ.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,31 @@ name: test integ
on: [push]
jobs:
run-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: [
#"3.6", # Default on Ubuntu18.04 but openapi-generator fails
"3.7",
"3.8",
"3.9",
"3.10",
#"3.11", # Not passing tests. No useful error messages.
]
env:
# This is associated with the "sdk-integ-test" user, credentials on 1password
GROUNDLIGHT_API_TOKEN: ${{ secrets.GROUNDLIGHT_API_TOKEN }}
steps:
- name: get code
uses: actions/checkout@v2
- name: install python
uses: actions/setup-python@v2
uses: actions/checkout@v3
- name: install python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: install poetry
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: install poetry and build poetry environment
run: |
pip install -U pip
pip install poetry
Expand Down
40 changes: 28 additions & 12 deletions UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,18 @@ How to build a computer vision system in 5 lines of python code:
```Python
from groundlight import Groundlight
gl = Groundlight()

# Create a new detector: use natural language to describe what you want to understand
detector = gl.create_detector(name="door", query="Is the door open?")

# Send an image to the detector
image_query = gl.submit_image_query(detector=detector, image="path/to/filename.jpeg")

# Show the results
print(f"The answer is {image_query.result}")
detector = gl.create_detector(name="door", query="Is the door open?") # Define your detector using natural language
image_query = gl.submit_image_query(detector=detector, image="path/to/filename.jpeg") # send an image
print(f"The answer is {image_query.result}") # get the result
```


## Getting Started

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

```Bash
$ pip install groundlight
$ pip3 install groundlight
```

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

```bash
$ export GROUNDLIGHT_API_TOKEN=api_2asdfkjEXAMPLE
$ python glapp.py
$ python3 glapp.py
```


## Prerequisites

### Using Groundlight SDK on Ubuntu 18.04

Ubuntu 18.04 still uses python 3.6 by default, which is end-of-life. We recommend setting up python 3.8 as follows:

```
# Prepare Ubuntu to install things
sudo apt-get update
# Install the basics
sudo apt-get install -y python3.8 python3.8-distutils curl
# Configure `python3` to run python3.8 by default
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 10
# Download and install pip3.8
curl https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py
sudo python3.8 /tmp/get-pip.py
# Configure `pip3` to run pip3.8
sudo update-alternatives --install /usr/bin/pip3 pip3 $(which pip3.8) 10
# Now we can install Groundlight!
pip3 install groundlight
```
## Using Groundlight on the edge
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:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "groundlight"
version = "0.5.0"
version = "0.5.1"
license = "MIT"
readme = "UserGuide.md"
homepage = "https://groundlight.ai"
Expand All @@ -12,7 +12,7 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.6.2,<4.0"
python = ">=3.7.0,<4.0"
python-dateutil = "^2.8.2"
urllib3 = "^1.26.9"
frozendict = "^2.3.2"
Expand Down
2 changes: 1 addition & 1 deletion src/groundlight/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_or_create_detector(self, name: str, query: str, config_name: str = None)
return existing_detector
else:
raise ValueError(
f"Found existing detector with {name=} (id={existing_detector.id}) but the queries don't match"
f"Found existing detector with name={name} (id={existing_detector.id}) but the queries don't match"
)

return self.create_detector(name, query, config_name)
Expand Down

0 comments on commit 31918e0

Please sign in to comment.