Skip to content

Commit 31d207c

Browse files
authored
Merge pull request #230 from splitio/development
Development
2 parents 705a444 + 67ee291 commit 31d207c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+388
-2133
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ target/
7171

7272
# vim backup files
7373
*.swp
74+
75+
.DS_Store

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ git:
55

66
matrix:
77
include:
8-
- python: '2.7'
98
- python: '3.6'
109
after_success:
1110
- bash sonar-scanner.sh

CHANGES.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
9.0.0 (May 3, 2021)
2+
- BREAKING CHANGE: Removed splitSdkMachineIp and splitSdkMachineName configs.
3+
- BREAKING CHANGE: Deprecated `redisCharset` config.
4+
- BREAKING CHANGE: Deprecated uWSGI local cache.
5+
- BREAKING CHANGE: Deprecated Python2 support.
6+
- Removed six, future and futures libs for compatibility between Python2 and Python3.
7+
- Updated strings encoding to utf-8 by default for Redis.
8+
- Added SDK Metadata headers to streaming client.
9+
110
8.4.1 (Apr 16, 2021)
211
- Bumped mmh3cffi dependency which now requires c99 flag to build.
312

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This SDK is designed to work with Split, the platform for controlled rollouts, w
77
[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)
88

99
## Compatibility
10-
This SDK is compatible with **Python 2.7 and higher**.
10+
This SDK is compatible with **Python 3 and higher**.
1111

1212
## Getting started
1313
Below is a simple example that describes the instantiation and most basic usage of our SDK:
@@ -57,7 +57,7 @@ Split has built and maintains SDKs for:
5757
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
5858
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
5959
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
60-
* .NET [Github](https://github.com/splitio/.net-core-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
60+
* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
6161
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
6262
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
6363
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)

doc/source/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This project provides Python programs access to the `Split.io <http://split.io/>
66
Installation and Requirements
77
-----------------------------
88

9-
``splitio_client`` supports both Python 2 (2.7 or later) and Python 3 (3.3 or later). Stable versions can be installed from `PyPI <https://pypi.python.org>`_ using pip: ::
9+
``splitio_client`` supports Python 3 (3.3 or later). Stable versions can be installed from `PyPI <https://pypi.python.org>`_ using pip: ::
1010

1111
pip install splitio_client
1212

setup.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
11
"""Setup module."""
2-
#!/usr/bin/env python
2+
# !/usr/bin/env python
33

44
from os import path
55
from setuptools import setup, find_packages
66

77
TESTS_REQUIRES = [
88
'flake8',
9-
'pytest<=4.6', # for deprecated python versions: https://docs.pytest.org/en/latest/py27-py34-deprecation.html
10-
'pytest-mock==2.0.0',
9+
'pytest>=6.2.3',
10+
'pytest-mock>=3.5.1',
1111
'coverage',
1212
'pytest-cov',
13-
'mock;python_version<"3"'
1413
]
1514

1615
INSTALL_REQUIRES = [
1716
'requests>=2.9.1',
1817
'pyyaml>=5.1',
19-
'future>=0.15.2',
2018
'docopt>=0.6.2',
21-
'six>=1.10.0',
2219
'enum34;python_version<"3.4"',
23-
'futures>=3.0.5;python_version<"3"'
2420
]
2521

2622
with open(path.join(path.abspath(path.dirname(__file__)), 'splitio', 'version.py')) as f:
2723
exec(f.read()) # pylint: disable=exec-used
2824

2925
setup(
3026
name='splitio_client',
31-
version=__version__, # pylint: disable=undefined-variable
27+
version=__version__, # pylint: disable=undefined-variable
3228
description='Split.io Python Client',
3329
author='Patricio Echague, Sebastian Arrubia',
3430
author_email='pato@split.io, sebastian@split.io',
3531
url='https://github.com/splitio/python-client',
36-
download_url=('https://github.com/splitio/python-client/tarball/' + __version__), # pylint: disable=undefined-variable
32+
download_url=('https://github.com/splitio/python-client/tarball/' + __version__), # pylint: disable=undefined-variable
3733
license='Apache License 2.0',
3834
install_requires=INSTALL_REQUIRES,
3935
tests_require=TESTS_REQUIRES,

splitio/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
from __future__ import absolute_import, division, print_function, \
2-
unicode_literals
3-
41
from splitio.client.factory import get_factory
52
from splitio.client.key import Key
63
from splitio.version import __version__

splitio/api/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,29 @@ def status_code(self):
1515
return self._status_code
1616

1717

18-
def headers_from_metadata(sdk_metadata):
18+
def headers_from_metadata(sdk_metadata, client_key=None):
1919
"""
2020
Generate a dict with headers required by data-recording API endpoints.
2121
2222
:param sdk_metadata: SDK Metadata object, generated at sdk initialization time.
2323
:type sdk_metadata: splitio.client.util.SdkMetadata
2424
25+
:param client_key: client key.
26+
:type client_key: str
27+
2528
:return: A dictionary with headers.
2629
:rtype: dict
2730
"""
28-
return {
31+
32+
metadata = {
2933
'SplitSDKVersion': sdk_metadata.sdk_version,
3034
'SplitSDKMachineIP': sdk_metadata.instance_ip,
3135
'SplitSDKMachineName': sdk_metadata.instance_name
3236
} if sdk_metadata.instance_ip != 'NA' and sdk_metadata.instance_ip != 'unknown' else {
3337
'SplitSDKVersion': sdk_metadata.sdk_version,
3438
}
39+
40+
if client_key is not None:
41+
metadata['SplitSDKClientKey'] = client_key
42+
43+
return metadata

splitio/api/auth.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import logging
44
import json
55

6-
from future.utils import raise_from
7-
86
from splitio.api import APIException, headers_from_metadata
97
from splitio.api.client import HttpClientException
108
from splitio.models.token import from_raw
@@ -53,4 +51,4 @@ def authenticate(self):
5351
except HttpClientException as exc:
5452
_LOGGER.error('Exception raised while authenticating')
5553
_LOGGER.debug('Exception information: ', exc_info=True)
56-
raise_from(APIException('Could not perform authentication.'), exc)
54+
raise APIException('Could not perform authentication.') from exc

splitio/api/client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"""Synchronous HTTP Client for split API."""
2-
from __future__ import division
3-
42
from collections import namedtuple
53

6-
from future.utils import raise_from
74
import requests
85

96
HttpResponse = namedtuple('HttpResponse', ['status_code', 'body'])
@@ -107,7 +104,7 @@ def get(self, server, path, apikey, query=None, extra_headers=None): # pylint:
107104
)
108105
return HttpResponse(response.status_code, response.text)
109106
except Exception as exc: # pylint: disable=broad-except
110-
raise_from(HttpClientException('requests library is throwing exceptions'), exc)
107+
raise HttpClientException('requests library is throwing exceptions') from exc
111108

112109
def post(self, server, path, apikey, body, query=None, extra_headers=None): # pylint: disable=too-many-arguments
113110
"""
@@ -144,4 +141,4 @@ def post(self, server, path, apikey, body, query=None, extra_headers=None): # p
144141
)
145142
return HttpResponse(response.status_code, response.text)
146143
except Exception as exc: # pylint: disable=broad-except
147-
raise_from(HttpClientException('requests library is throwing exceptions'), exc)
144+
raise HttpClientException('requests library is throwing exceptions') from exc

0 commit comments

Comments
 (0)