Skip to content

Commit

Permalink
FEAT: Xinference Restful Client (#2)
Browse files Browse the repository at this point in the history
* init

* remove blank.yaml

* add dev packages

* add cython for dev packages

* add UT

* Add README

* Generate versioneer

* reduce packages to install in CI
  • Loading branch information
ChengjieLi28 authored Sep 25, 2023
1 parent 12ae3eb commit 50ed06a
Show file tree
Hide file tree
Showing 27 changed files with 5,085 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xinference_client/_version.py export-subst
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: "BUG"
labels: ''
assignees: ''

---

### Describe the bug
A clear and concise description of what the bug is.

### To Reproduce
To help us to reproduce this bug, please provide information below:

1. Your Python version.
2. The version of xinference you use.
3. The version of xinference client you use.
4. Versions of crucial packages.
5. Full stack of the error.
6. Minimized code to reproduce the error.

### Expected behavior
A clear and concise description of what you expected to happen.

### Additional context
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

### Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like
A clear and concise description of what you want to happen.

### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

### Additional context
Add any other context or screenshots about the feature request here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Other
about: Submit other issues here.
title: ''
labels: ''
assignees: ''

---

Note that the issue tracker is NOT the place for general support.
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Question
about: Ask a question here.
title: 'QUESTION'
labels: 'question'
assignees: ''
---

Note that the issue tracker is NOT the place for general support.
36 changes: 0 additions & 36 deletions .github/workflows/blank.yml

This file was deleted.

103 changes: 103 additions & 0 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Python CI

on:
push:
branches:
- '*'
pull_request:
types: ['opened', 'reopened', 'synchronize']

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10" ]
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
path: "xinference_client"
args: "--config setup.cfg"
- name: black
uses: psf/black@stable
with:
src: "xinference_client"
options: "--check"
- uses: isort/isort-action@master
with:
sortPaths: "xinference_client"
configuration: "--check-only --diff --sp setup.cfg"
- name: mypy
run: pip install mypy && mypy --install-types --non-interactive xinference_client
- name: codespell
run: pip install codespell && codespell xinference_client

build_test_job:
runs-on: ${{ matrix.os }}
needs: lint
env:
CONDA_ENV: test
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
module: [ "xinference_client" ]
exclude:
- { os: macos-latest, python-version: 3.9 }
- { os: macos-latest, python-version: 3.10 }
- { os: windows-latest, python-version: 3.9 }
- { os: windows-latest, python-version: 3.10 }

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Set up conda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}

- name: Install dependencies
env:
MODULE: ${{ matrix.module }}
run: |
pip install llama-cpp-python>=0.2.0
pip install torch
pip install sentence-transformers
pip install requests
pip install xinference
pip install -e ".[dev]"
working-directory: .

- name: Test with pytest
env:
MODULE: ${{ matrix.module }}
run: |
pytest --timeout=1500 \
-W ignore::PendingDeprecationWarning \
--cov-config=setup.cfg --cov-report=xml --cov=xinference_client xinference_client
working-directory: .
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and upload to PyPI

on:
schedule:
# trigger build every day at 4:30 UTC
- cron: '30 4 * * *'
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
build-publish:
name: Build and publish Python distribution to PyPI
runs-on: ubuntu-latest

steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: actions/checkout@v3
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python3 -m
build
--sdist
--wheel
--outdir dist/
.
# if is xorbitsai repo, upload to pypi
- uses: pypa/[email protected]
if: github.repository == 'xorbitsai/inference-client'
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}

# if is not xorbitsai repo, upload to test
- uses: pypa/[email protected]
if: github.repository != 'xorbitsai/inference-client'
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
verbose: true
repository_url: https://test.pypi.org/legacy/
Loading

0 comments on commit 50ed06a

Please sign in to comment.