Skip to content

Commit aef97c7

Browse files
authored
Merge pull request #54 from lnxpy/stable
setup-related minimal improvements
2 parents 2639afa + 258fbad commit aef97c7

File tree

7 files changed

+68
-68
lines changed

7 files changed

+68
-68
lines changed

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
include requirements.txt
2+
prune tests*
3+
prune testing*

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Python MindsDB SDK
2-
It enables you to connect to a MidnsDB server from python using HTTP API.
2+
It enables you to connect to a MindsDB server from python using HTTP API.
33

44
## Install
55
```

mindsdb_sdk/__init__.py

+1-45
Original file line numberDiff line numberDiff line change
@@ -1,45 +1 @@
1-
2-
from mindsdb_sdk.__about__ import __package_name__ as name, __version__
3-
4-
from .server import Server
5-
6-
7-
def connect(url: str = None, login: str = None, password: str = None, is_managed: bool = False) -> Server:
8-
"""
9-
Create connection to mindsdb server
10-
11-
:param url: url to mindsdb server
12-
:param login: user login, for cloud version it contents email
13-
:param password: user password to login (for cloud version)
14-
:param is_managed: whether or not the URL points to a managed instance
15-
:return: Server object
16-
17-
Examples
18-
--------
19-
20-
>>> import mindsdb_sdk
21-
22-
Connect to local server
23-
24-
>>> server = mindsdb_sdk.connect()
25-
>>> server = mindsdb_sdk.connect('http://127.0.0.1:47334')
26-
27-
Connect to cloud server
28-
29-
>>> server = mindsdb_sdk.connect(login='a@b.com', password='-')
30-
>>> server = mindsdb_sdk.connect('https://cloud.mindsdb.com', login='a@b.com', password='-')
31-
32-
Connect to MindsDB pro
33-
34-
>>> server = mindsdb_sdk.connect('http://<YOUR_INSTANCE_IP>', login='a@b.com', password='-', is_managed=True)
35-
36-
"""
37-
if url is None:
38-
if login is not None:
39-
# default is cloud
40-
url = 'https://cloud.mindsdb.com'
41-
else:
42-
# is local
43-
url = 'http://127.0.0.1:47334'
44-
45-
return Server(url=url, login=login, password=password, is_managed=is_managed)
1+
from mindsdb_sdk.connect import connect

mindsdb_sdk/connect.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from mindsdb_sdk.server import Server
2+
3+
4+
def connect(url: str = None, login: str = None, password: str = None, is_managed: bool = False) -> Server:
5+
"""
6+
Create connection to mindsdb server
7+
8+
:param url: url to mindsdb server
9+
:param login: user login, for cloud version it contents email
10+
:param password: user password to login (for cloud version)
11+
:param is_managed: whether or not the URL points to a managed instance
12+
:return: Server object
13+
14+
Examples
15+
--------
16+
17+
>>> import mindsdb_sdk
18+
19+
Connect to local server
20+
21+
>>> server = mindsdb_sdk.connect()
22+
>>> server = mindsdb_sdk.connect('http://127.0.0.1:47334')
23+
24+
Connect to cloud server
25+
26+
>>> server = mindsdb_sdk.connect(login='a@b.com', password='-')
27+
>>> server = mindsdb_sdk.connect('https://cloud.mindsdb.com', login='a@b.com', password='-')
28+
29+
Connect to MindsDB pro
30+
31+
>>> server = mindsdb_sdk.connect('http://<YOUR_INSTANCE_IP>', login='a@b.com', password='-', is_managed=True)
32+
33+
"""
34+
if url is None:
35+
if login is not None:
36+
# default is cloud
37+
url = 'https://cloud.mindsdb.com'
38+
else:
39+
# is local
40+
url = 'http://127.0.0.1:47334'
41+
42+
return Server(url=url, login=login, password=password, is_managed=is_managed)

setup.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import setuptools
2-
3-
4-
about = {}
5-
with open("mindsdb_sdk/__about__.py") as fp:
6-
exec(fp.read(), about)
7-
1+
from setuptools import setup, find_packages
2+
from mindsdb_sdk import __about__ as C
83

94
with open("README.md", "r") as fh:
105
long_description = fh.read()
116

127
with open('requirements.txt') as req_file:
138
requirements = req_file.read().splitlines()
149

15-
setuptools.setup(
16-
name=about['__title__'],
17-
version=about['__version__'],
18-
url=about['__github__'],
19-
download_url=about['__pypi__'],
20-
license=about['__license__'],
21-
author=about['__author__'],
22-
author_email=about['__email__'],
23-
description=about['__description__'],
10+
setup(
11+
name=C.__title__,
12+
version=C.__version__,
13+
url=C.__github__,
14+
download_url=C.__pypi__,
15+
license=C.__license__,
16+
author=C.__author__,
17+
author_email=C.__email__,
18+
description=C.__description__,
2419
long_description=long_description,
2520
long_description_content_type="text/markdown",
26-
packages=setuptools.find_packages(),
21+
packages=find_packages(exclude=('tests*', 'testing*')),
2722
install_requires=requirements,
28-
classifiers=(
23+
extras_require={
24+
'dev': [
25+
'pytest',
26+
]
27+
},
28+
classifiers=[
2929
"Programming Language :: Python :: 3",
3030
"License :: OSI Approved :: MIT License",
3131
"Operating System :: OS Independent",
32-
),
33-
python_requires=">=3.6"
32+
],
33+
python_requires=">=3.6",
3434
)

tests/__init__.py

Whitespace-only changes.

tests/test_sdk.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import datetime as dt
2-
from unittest.mock import patch
32
from unittest.mock import Mock
3+
from unittest.mock import patch
44

55
import pandas as pd
66
from mindsdb_sql import parse_sql
77

8-
import mindsdb_sdk
98
from mindsdb_sdk.model import ModelVersion
9+
import mindsdb_sdk
1010

1111
from mindsdb_sdk.connectors import rest_api
1212

0 commit comments

Comments
 (0)