mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-06 12:30:29 +08:00
Add job for python client ci (#3674)
* Add job + lint * Fix path * Fix path * Fix path * Checkout * Add test requirements * Fix syntax * Fix test * Lint * Fix deps + README * Move dependency
This commit is contained in:
parent
fec48570c7
commit
0b91a3363b
43
.github/workflows/backend.yml
vendored
43
.github/workflows/backend.yml
vendored
@ -14,6 +14,49 @@ env:
|
||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||
|
||||
jobs:
|
||||
client-test:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "windows-latest"]
|
||||
python-version: ["3.9"]
|
||||
runs-on: ${{ matrix.os }}
|
||||
defaults:
|
||||
run:
|
||||
working-directory: client/python
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Cache python deps
|
||||
id: cache-python
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./venv
|
||||
key: pythondeps-${{ matrix.python-version }}-${{ github.ref }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test/requirements.txt') }}
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install pip
|
||||
run: python -m pip install build requests virtualenv
|
||||
- name: venv activate Linux
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: |
|
||||
python -m virtualenv venv
|
||||
source venv/bin/activate
|
||||
echo PATH=$PATH >> $GITHUB_ENV
|
||||
- name: venv activate Windows
|
||||
if: ${{ matrix.os == 'windows-latest' }}
|
||||
run: |
|
||||
python -m virtualenv venv
|
||||
./venv/Scripts/Activate.ps1
|
||||
echo "PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
- name: Install Client
|
||||
run: |
|
||||
pip install -e .
|
||||
pip install -r test/requirements.txt
|
||||
- name: Tests
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/ci.sh
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -21,7 +21,7 @@ job.result()
|
||||
|
||||
If you already have a recent version of `gradio`, then the `gradio_client` is included as a dependency.
|
||||
|
||||
Otherwise, the lightweight `gradio_client` package can be installed from pip (or pip3) and works with Python versions 3.7 or higher:
|
||||
Otherwise, the lightweight `gradio_client` package can be installed from pip (or pip3) and works with Python versions 3.9 or higher:
|
||||
|
||||
```bash
|
||||
$ pip install gradio_client
|
||||
|
@ -12,11 +12,12 @@ from typing import Any, Callable, Dict, List, Tuple
|
||||
import huggingface_hub
|
||||
import requests
|
||||
import websockets
|
||||
from gradio_client import serializing, utils
|
||||
from gradio_client.serializing import Serializable
|
||||
from huggingface_hub.utils import build_hf_headers, send_telemetry
|
||||
from packaging import version
|
||||
|
||||
from gradio_client import serializing, utils
|
||||
from gradio_client.serializing import Serializable
|
||||
|
||||
|
||||
class Client:
|
||||
def __init__(
|
||||
|
@ -2,4 +2,4 @@ requests
|
||||
websockets
|
||||
packaging
|
||||
fsspec
|
||||
huggingface_hub>=0.13.0
|
||||
huggingface_hub>=0.13.0
|
4
client/python/test/conftest.py
Normal file
4
client/python/test/conftest.py
Normal file
@ -0,0 +1,4 @@
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line(
|
||||
"markers", "flaky: mark test as flaky. Failure will not cause te"
|
||||
)
|
6
client/python/test/requirements.txt
Normal file
6
client/python/test/requirements.txt
Normal file
@ -0,0 +1,6 @@
|
||||
black==22.6.0
|
||||
flake8==4.0.1
|
||||
isort==5.10.1
|
||||
pytest==7.1.2
|
||||
gradio>=3.23.0
|
||||
pytest-asyncio
|
Loading…
x
Reference in New Issue
Block a user