diff --git a/.travis.yml b/.travis.yml
index 598102a..f5f10a3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ python:
# command to install dependencies
install:
- python setup.py bdist_wheel
- - pip install dist/deepomatic-*.whl
+ - pip install dist/deepomatic_api-*.whl
- mkdir samples
- cp demo.py samples/demo.py
diff --git a/Dockerfile b/Dockerfile
index 5cb03f2..91c2c14 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,7 +10,7 @@ RUN python setup.py bdist_wheel
FROM ${BASE_IMAGE} as runtime
# copy egg
-COPY --from=builder /app/dist/deepomatic-*.whl /tmp/
+COPY --from=builder /app/dist/deepomatic_api-*.whl /tmp/
COPY --from=builder /app/demo.py /samples/
-RUN pip install /tmp/deepomatic-*.whl
+RUN pip install /tmp/deepomatic_api-*.whl
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..48cd18a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,16 @@
+all: release
+
+release: clean
+ python3 setup.py sdist bdist_wheel
+
+clean:
+ rm -rf build dist *.egg-info
+
+publish-test: release
+ # For testing, note that once one version is uploaded, you have to increment the version number or make a post release to re-upload
+ # https://www.python.org/dev/peps/pep-0440/#post-releases
+ twine upload --repository-url https://test.pypi.org/legacy/ dist/*
+
+publish: release
+ # More info here https://packaging.python.org/tutorials/packaging-projects/
+ twine upload dist/*
diff --git a/README.md b/README.md
index 572c2c5..58b8519 100644
--- a/README.md
+++ b/README.md
@@ -1,40 +1,36 @@
# deepomatic-client-python
-Deepomatic API Client for Python.
+[Deepomatic](https://www.deepomatic.com) API Client for Python.
This client have been made in order to help you integrating our services within your apps in python.
-Tested on python 2.7 & 3.5.
-
-
+Tested on python 2.7, 3.4, 3.5, 3.6.
# API Documentation
https://developers.deepomatic.com/docs/v0.7
-
# Installation
+```bash
+pip install deepomatic-api
```
-git clone https://github.com/Deepomatic/deepomatic-client-python.git
-pip install ./deepomatic-client-python
-```
-
# Client
Initialize a client.
Does not make any call to the server.
+
```python
-import deepomatic
+from deepomatic.api.client import Client
# You should find your app_id and api_key in your account on https://developers.deepomatic.com/dashboard
-client = deepomatic.Client(app_id, api_key)
+client = Client(app_id, api_key)
```
### Client methods
-All client methods can be found in [deepomatic/client.py](deepomatic/client.py) and detail for each type of resource is located in [deepomatic/resources](deepomatic/resources).
+All client methods can be found in [deepomatic/api/client.py](deepomatic/api/client.py) and detail for each type of resource is located in [deepomatic/api/resources](deepomatic/api/resources).
### Examples
@@ -42,4 +38,4 @@ You will find examples of usage in [demo.py](demo.py).
# Bugs
-Please send bug reports to support@deepomatic.com
+Please send bug reports to support@deepomatic.com or open an issue here.
diff --git a/deepomatic/__init__.py b/deepomatic/__init__.py
index 64965bf..267f710 100644
--- a/deepomatic/__init__.py
+++ b/deepomatic/__init__.py
@@ -1,27 +1,6 @@
-# -*- coding: utf-8 -*-
-"""
-Copyright (c) 2017 Deepomatic SAS
-http://www.deepomatic.com/
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-"""
-
-from deepomatic.version import __version__
-from deepomatic.client import Client
-from deepomatic.inputs import ImageInput
+try:
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ import pkgutil
+ __path__ = pkgutil.extend_path(__path__, __name__)
diff --git a/deepomatic/api/__init__.py b/deepomatic/api/__init__.py
new file mode 100644
index 0000000..97cf7a6
--- /dev/null
+++ b/deepomatic/api/__init__.py
@@ -0,0 +1 @@
+from deepomatic.api.version import __version__
diff --git a/deepomatic/client.py b/deepomatic/api/client.py
similarity index 87%
rename from deepomatic/client.py
rename to deepomatic/api/client.py
index 4468c21..ec7d89d 100644
--- a/deepomatic/client.py
+++ b/deepomatic/api/client.py
@@ -22,11 +22,11 @@
THE SOFTWARE.
"""
-from deepomatic.http_helper import HTTPHelper
-from deepomatic.resources.network import Network
-from deepomatic.resources.recognition import RecognitionSpec, RecognitionVersion
-from deepomatic.resources.task import Task
-from deepomatic.resources.account import Account
+from deepomatic.api.http_helper import HTTPHelper
+from deepomatic.api.resources.network import Network
+from deepomatic.api.resources.recognition import RecognitionSpec, RecognitionVersion
+from deepomatic.api.resources.task import Task
+from deepomatic.api.resources.account import Account
###############################################################################
diff --git a/deepomatic/exceptions.py b/deepomatic/api/exceptions.py
similarity index 100%
rename from deepomatic/exceptions.py
rename to deepomatic/api/exceptions.py
diff --git a/deepomatic/http_helper.py b/deepomatic/api/http_helper.py
similarity index 98%
rename from deepomatic/http_helper.py
rename to deepomatic/api/http_helper.py
index 8d7caf8..9049c2f 100644
--- a/deepomatic/http_helper.py
+++ b/deepomatic/api/http_helper.py
@@ -30,8 +30,8 @@
from requests.structures import CaseInsensitiveDict
from six import string_types
-from deepomatic.exceptions import DeepomaticException, BadStatus
-from deepomatic.version import __version__
+from deepomatic.api.exceptions import DeepomaticException, BadStatus
+from deepomatic.api.version import __version__
###############################################################################
diff --git a/deepomatic/inputs.py b/deepomatic/api/inputs.py
similarity index 98%
rename from deepomatic/inputs.py
rename to deepomatic/api/inputs.py
index ed5c866..0aaa7bf 100644
--- a/deepomatic/inputs.py
+++ b/deepomatic/api/inputs.py
@@ -26,7 +26,7 @@
import copy
import base64
-from deepomatic.exceptions import DeepomaticException
+from deepomatic.api.exceptions import DeepomaticException
###############################################################################
diff --git a/deepomatic/mixins.py b/deepomatic/api/mixins.py
similarity index 97%
rename from deepomatic/mixins.py
rename to deepomatic/api/mixins.py
index 93f0a11..0ca100b 100644
--- a/deepomatic/mixins.py
+++ b/deepomatic/api/mixins.py
@@ -22,8 +22,8 @@
THE SOFTWARE.
"""
-from deepomatic.exceptions import DeepomaticException
-from deepomatic.resource import ResourceList
+from deepomatic.api.exceptions import DeepomaticException
+from deepomatic.api.resource import ResourceList
###############################################################################
diff --git a/deepomatic/resource.py b/deepomatic/api/resource.py
similarity index 98%
rename from deepomatic/resource.py
rename to deepomatic/api/resource.py
index e163137..32405d5 100644
--- a/deepomatic/resource.py
+++ b/deepomatic/api/resource.py
@@ -25,7 +25,7 @@
import json
import copy
-from deepomatic.exceptions import DeepomaticException, NoData
+from deepomatic.api.exceptions import DeepomaticException, NoData
###############################################################################
diff --git a/deepomatic/resources/__init__.py b/deepomatic/api/resources/__init__.py
similarity index 100%
rename from deepomatic/resources/__init__.py
rename to deepomatic/api/resources/__init__.py
diff --git a/deepomatic/resources/account.py b/deepomatic/api/resources/account.py
similarity index 96%
rename from deepomatic/resources/account.py
rename to deepomatic/api/resources/account.py
index 62929a8..d0b26c5 100644
--- a/deepomatic/resources/account.py
+++ b/deepomatic/api/resources/account.py
@@ -22,7 +22,7 @@
THE SOFTWARE.
"""
-from deepomatic.resource import Resource
+from deepomatic.api.resource import Resource
###############################################################################
diff --git a/deepomatic/resources/network.py b/deepomatic/api/resources/network.py
similarity index 90%
rename from deepomatic/resources/network.py
rename to deepomatic/api/resources/network.py
index 0bf76e7..28dae55 100644
--- a/deepomatic/resources/network.py
+++ b/deepomatic/api/resources/network.py
@@ -25,10 +25,10 @@
from six import string_types
import numpy as np
-from deepomatic.resource import Resource
-from deepomatic.utils import InferenceResource
-from deepomatic.mixins import CreateableResource, ListableResource, UpdatableResource, DeletableResource
-from deepomatic.mixins import RequiredArg, OptionnalArg, ImmutableArg
+from deepomatic.api.resource import Resource
+from deepomatic.api.utils import InferenceResource
+from deepomatic.api.mixins import CreateableResource, ListableResource, UpdatableResource, DeletableResource
+from deepomatic.api.mixins import RequiredArg, OptionnalArg, ImmutableArg
###############################################################################
diff --git a/deepomatic/resources/recognition.py b/deepomatic/api/resources/recognition.py
similarity index 89%
rename from deepomatic/resources/recognition.py
rename to deepomatic/api/resources/recognition.py
index 619b08e..b8e2974 100644
--- a/deepomatic/resources/recognition.py
+++ b/deepomatic/api/resources/recognition.py
@@ -24,10 +24,10 @@
from six import string_types
-from deepomatic.resource import Resource, ResourceList
-from deepomatic.utils import InferenceResource
-from deepomatic.mixins import CreateableResource, ListableResource, UpdatableResource, DeletableResource
-from deepomatic.mixins import RequiredArg, OptionnalArg, ImmutableArg, UpdateOnlyArg
+from deepomatic.api.resource import Resource, ResourceList
+from deepomatic.api.utils import InferenceResource
+from deepomatic.api.mixins import CreateableResource, ListableResource, UpdatableResource, DeletableResource
+from deepomatic.api.mixins import RequiredArg, OptionnalArg, ImmutableArg, UpdateOnlyArg
###############################################################################
diff --git a/deepomatic/resources/task.py b/deepomatic/api/resources/task.py
similarity index 97%
rename from deepomatic/resources/task.py
rename to deepomatic/api/resources/task.py
index 0394e31..d6ba23d 100644
--- a/deepomatic/resources/task.py
+++ b/deepomatic/api/resources/task.py
@@ -24,9 +24,9 @@
from tenacity import Retrying, wait_random_exponential, stop_after_delay, retry_if_result, before_log, after_log, RetryError
-from deepomatic.resource import Resource
-from deepomatic.mixins import ListableResource
-from deepomatic.exceptions import TaskError, TaskTimeout
+from deepomatic.api.resource import Resource
+from deepomatic.api.mixins import ListableResource
+from deepomatic.api.exceptions import TaskError, TaskTimeout
import logging
diff --git a/deepomatic/utils.py b/deepomatic/api/utils.py
similarity index 92%
rename from deepomatic/utils.py
rename to deepomatic/api/utils.py
index 06e0974..2b94b48 100644
--- a/deepomatic/utils.py
+++ b/deepomatic/api/utils.py
@@ -22,9 +22,9 @@
THE SOFTWARE.
"""
-from deepomatic.exceptions import DeepomaticException
-from deepomatic.resources.task import Task
-from deepomatic.inputs import format_inputs
+from deepomatic.api.exceptions import DeepomaticException
+from deepomatic.api.resources.task import Task
+from deepomatic.api.inputs import format_inputs
###############################################################################
diff --git a/deepomatic/api/version.py b/deepomatic/api/version.py
new file mode 100644
index 0000000..b87509f
--- /dev/null
+++ b/deepomatic/api/version.py
@@ -0,0 +1,13 @@
+__title__ = 'deepomatic-api'
+__description__ = 'Deepomatic API client'
+__version__ = '0.7.10'
+__author__ = 'deepomatic'
+__author_email__ = 'support@deepomatic.com'
+__url__ = 'https://github.com/deepomatic/deepomatic-client-python'
+__license__ = 'MIT License'
+__project_urls__ = {
+ 'Product': 'https://www.deepomatic.com',
+ 'Documentation': 'https://developers.deepomatic.com/docs/v0.7',
+ 'Source': 'https://github.com/deepomatic/deepomatic-client-python',
+ 'Tracker': 'https://github.com/deepomatic/deepomatic-client-python/issues',
+}
diff --git a/deepomatic/version.py b/deepomatic/version.py
deleted file mode 100644
index 60985cd..0000000
--- a/deepomatic/version.py
+++ /dev/null
@@ -1,7 +0,0 @@
-__title__ = 'deepomatic'
-__description__ = 'Deepomatic API client',
-__version__ = '0.7.8'
-__author__ = 'deepomatic'
-__author_email__ = 'support@deepomatic.com'
-__url__ = 'https://www.deepomatic.com'
-__license__ = 'MIT License'
diff --git a/demo.py b/demo.py
index e71c6b8..bc77144 100644
--- a/demo.py
+++ b/demo.py
@@ -4,8 +4,8 @@
import base64
import tarfile
-import deepomatic
-from deepomatic import ImageInput
+from deepomatic.api.client import Client
+from deepomatic.api.inputs import ImageInput
if sys.version_info >= (3, 0):
from urllib.request import urlretrieve
@@ -19,7 +19,7 @@
app_id = os.getenv('DEEPOMATIC_APP_ID')
api_key = os.getenv('DEEPOMATIC_API_KEY')
-client = deepomatic.Client(app_id, api_key, host=api_host)
+client = Client(app_id, api_key, host=api_host)
demo_url = "https://static.deepomatic.com/resources/demos/api-clients/dog1.jpg"
diff --git a/requirements.txt b/requirements.txt
index 235b807..6b5ec8c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-numpy>=1.10,<2
+numpy>=1.10.0,<2
promise>=2.1,<3
six>=1.10.0,<2
requests>=2.19.0,<3 # will not work below in python3
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..ed8a958
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[bdist_wheel]
+universal = 1
+
+[metadata]
+license_file = LICENSE
diff --git a/setup.py b/setup.py
index 18261e8..bed6697 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
about = {}
-with io.open(os.path.join(here, 'deepomatic', 'version.py'), 'r', encoding='utf-8') as f:
+with io.open(os.path.join(here, 'deepomatic', 'api', 'version.py'), 'r', encoding='utf-8') as f:
exec(f.read(), about)
with io.open(os.path.join(here, 'README.md'), 'r', encoding='utf-8') as readme:
@@ -22,7 +22,9 @@
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
# Read requirements
-install_reqs = parse_requirements('requirements.txt', session='hack')
+install_reqs = parse_requirements(os.path.join(here, 'requirements.txt'), session='hack')
+
+namespaces = ['deepomatic']
setup(
name=about['__title__'],
@@ -31,10 +33,14 @@
author=about['__author__'],
author_email=about['__author_email__'],
url=about['__url__'],
+ project_urls=about['__project_urls__'],
license=about['__license__'],
packages=find_packages(),
+ namespace_packages=namespaces,
include_package_data=True,
long_description=README,
+ long_description_content_type='text/markdown',
+ data_files=[('', ['requirements.txt'])],
install_requires=[str(ir.req) for ir in install_reqs],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
classifiers=[