Skip to content

Commit 4ed64e6

Browse files
setup ci
1 parent c212abc commit 4ed64e6

File tree

11 files changed

+135
-83
lines changed

11 files changed

+135
-83
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
pull_request:
9+
branches:
10+
- master
11+
12+
env:
13+
VEKTONN_PYTHON_PACKAGE_VERSION: 0.5.0
14+
15+
jobs:
16+
test:
17+
strategy:
18+
matrix:
19+
python: ['3.7', '3.8', '3.9', '3.10']
20+
platform: [ubuntu-latest, macos-latest, windows-latest]
21+
runs-on: ${{ matrix.platform }}
22+
timeout-minutes: 5
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
27+
- name: Set up Python ${{ matrix.python }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python }}
31+
32+
- name: Install test dependencies
33+
run: python -m pip install -U tox
34+
35+
- name: Test
36+
run: python -m tox -e py
37+
38+
pypi-publish:
39+
if: github.ref == 'refs/heads/master'
40+
needs: test
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 3
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v2
46+
47+
- name: Set up Python
48+
uses: actions/setup-python@v1
49+
with:
50+
python-version: '3.x'
51+
52+
- name: Install build dependencies
53+
run: python -m pip install -U setuptools wheel build
54+
55+
- name: Build
56+
run: python -m build .
57+
58+
- name: Publish
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
user: __token__
62+
password: ${{ secrets.PYPI_API_TOKEN }}
63+
skip_existing: true

.github/workflows/release.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Python client for Vektonn
2+
3+
[![CI](https://github.com/vektonn/vektonn-client-python/actions/workflows/ci.yml/badge.svg)](https://github.com/vektonn/vektonn-client-python/actions/workflows/ci.yml)
4+
[![version](https://img.shields.io/pypi/v/vektonn.svg?color=blue)](https://pypi.org/project/vektonn/)
5+
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/vektonn?logo=python&logoColor=blue)](https://pypi.org/project/vektonn/)
6+
[![license](https://img.shields.io/hexpm/l/plug.svg?color=green)](https://github.com/vektonn/vektonn-client-python/blob/master/LICENSE)
7+
8+
## Installation
9+
10+
Install the latest version:
11+
```shell
12+
$ pip install vektonn
13+
```
14+
15+
Install specific version:
16+
```shell
17+
$ pip install vektonn==0.5.0
18+
```
19+
20+
Upgrade to the latest version:
21+
```shell
22+
$ pip install --upgrade vektonn
23+
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
requires = [
3-
'setuptools >= 40.8.0',
3+
'setuptools >= 42.0.0',
44
'wheel',
55
]
66
build-backend = 'setuptools.build_meta'

setup.cfg

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
[metadata]
2+
description = Python client for Vektonn
3+
long_description = file: README.md
4+
long_description_content_type = text/markdown
5+
license = Apache License 2.0
26
license_file = LICENSE
7+
url = https://github.com/vektonn/vektonn-client-python
8+
maintainer = Vektonn Team
9+
maintainer_email = [email protected]
10+
classifiers =
11+
Development Status :: 5 - Production/Stable
12+
Intended Audience :: Developers
13+
License :: OSI Approved :: Apache Software License
14+
Operating System :: OS Independent
15+
Programming Language :: Python
16+
Programming Language :: Python :: 3
17+
Programming Language :: Python :: 3.7
18+
Programming Language :: Python :: 3.8
19+
Programming Language :: Python :: 3.9
20+
Programming Language :: Python :: 3.10
21+
22+
[options]
23+
zip_safe = True

setup.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22

33
from setuptools import setup, find_packages
44

5-
package_version = os.environ.get('PYTHON_PACKAGE_VERSION') or '0.0.dev0'
5+
package_version = os.environ.get('VEKTONN_PYTHON_PACKAGE_VERSION') or '0.0.0.dev0'
66

77
setup(
88
name='vektonn',
99
version=package_version,
10-
description='Python client for Vektonn',
11-
license='Apache License 2.0',
12-
url='https://github.com/vektonn/vektonn-client-python',
13-
maintainer='Vektonn team',
14-
maintainer_email='[email protected]',
1510
package_dir={'': 'src'},
1611
packages=find_packages(where='src'),
1712
python_requires='>=3.7',
@@ -21,18 +16,4 @@
2116
'pydantic~=1.8.2',
2217
'requests~=2.26.0',
2318
],
24-
zip_safe=True,
25-
classifiers=[
26-
'Development Status :: 5 - Production/Stable',
27-
'Intended Audience :: Developers',
28-
'License :: OSI Approved :: Apache Software License',
29-
'Operating System :: OS Independent',
30-
'Programming Language :: Python',
31-
'Programming Language :: Python :: 3',
32-
'Programming Language :: Python :: 3.6',
33-
'Programming Language :: Python :: 3.7',
34-
'Programming Language :: Python :: 3.8',
35-
'Programming Language :: Python :: 3.9',
36-
'Programming Language :: Python :: 3.10',
37-
]
3819
)

tests/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import socket
2+
from contextlib import closing
3+
14
from vektonn.dtos import VectorDto
25

3-
vektonn_local_base_url = 'http://localhost:8081'
6+
vektonn_api_host = 'localhost'
7+
vektonn_api_port = 8081
8+
vektonn_api_base_url = f'http://{vektonn_api_host}:{vektonn_api_port}'
49

510
data_source_name = 'Samples.DenseVectors'
611
data_source_version = '0.1'
@@ -9,3 +14,14 @@
914
index_version = '0.1'
1015

1116
zero_vector = VectorDto(is_sparse=False, coordinates=[0.0, 0.0])
17+
18+
19+
def is_vektonn_running() -> bool:
20+
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
21+
if sock.connect_ex((vektonn_api_host, vektonn_api_port)) == 0:
22+
return True
23+
else:
24+
return False
25+
26+
27+
is_vektonn_running = is_vektonn_running()

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import pytest
22

3-
from tests import vektonn_local_base_url
3+
from tests import vektonn_api_base_url
44
from vektonn import Vektonn, VektonnAsync
55

66
pytest_plugins = "aiohttp.pytest_plugin"
77

88

99
@pytest.fixture(scope="session")
1010
def vektonn_client() -> Vektonn:
11-
return Vektonn(vektonn_local_base_url)
11+
return Vektonn(vektonn_api_base_url)
1212

1313

1414
@pytest.fixture(scope="session")
1515
def vektonn_client_async() -> VektonnAsync:
16-
return VektonnAsync(vektonn_local_base_url)
16+
return VektonnAsync(vektonn_api_base_url)

tests/test_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3-
from tests import zero_vector, index_name, index_version, data_source_name, data_source_version
3+
from tests import zero_vector, index_name, index_version, data_source_name, data_source_version, is_vektonn_running
44
from vektonn import Vektonn, VektonnApiError
55
from vektonn.dtos import SearchQueryDto, SearchResultDto, InputDataPointDto, AttributeDto, AttributeValueDto
66

7+
pytestmark = pytest.mark.skipif(is_vektonn_running is not True, reason="Integration tests require Vektonn running")
8+
79

810
def test_search__success(vektonn_client: Vektonn):
911
search_query = SearchQueryDto(k=1, query_vectors=[zero_vector])

0 commit comments

Comments
 (0)