Skip to content

Commit 0884d2e

Browse files
authored
prepare 6.9.1 release (#122)
1 parent 77e57f4 commit 0884d2e

File tree

5 files changed

+76
-144
lines changed

5 files changed

+76
-144
lines changed

CONTRIBUTING.md

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
1-
Contributing
2-
------------
1+
# Contributing to the LaunchDarkly Server-side SDK for Python
32

4-
We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.
3+
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.
54

6-
Development information (for developing this module itself)
7-
-----------------------------------------------------------
5+
## Submitting bug reports and feature requests
6+
7+
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/python-server-sdk/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.
88

9-
1. One-time setup:
9+
## Submitting pull requests
10+
11+
We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.
1012

11-
mkvirtualenv python-client
13+
## Build instructions
1214

13-
1. When working on the project be sure to activate the python-client virtualenv using the technique of your choosing.
15+
### Setup
1416

15-
1. Install requirements (run-time & test):
17+
It's advisable to use [`virtualenv`](https://virtualenv.pypa.io/) to create a development environment within the project directory:
1618

17-
pip install -r requirements.txt
18-
pip install -r test-requirements.txt
19+
```
20+
mkvirtualenv python-client
21+
source ./python-client/bin/activate
22+
```
1923

20-
1. When running unit tests, in order for `test_feature_store.py` to run, you'll need all of the supported databases (Redis, Consul, DynamoDB) running locally on their default ports.
24+
To install the runtime and test requirements:
2125

22-
1. If you want integration tests to run, set the ```LD_SDK_KEY``` environment variable to a valid production SDK Key.
26+
```
27+
pip install -r requirements.txt
28+
pip install -r test-requirements.txt
29+
```
2330

24-
1. ```$ py.test testing```
31+
The additional requirements files `consul-requirements.txt`, `dynamodb-requirements.txt`, `redis-requirements.txt`, and `test-filesource-optional-requirements.txt` can also be installed if you need to test the corresponding features.
2532

26-
1. All code must be compatible with all supported Python versions as described in README. Most portability issues are addressed by using the `six` package. We are avoiding the use of `__future__` imports, since they can easily be omitted by mistake causing code in one file to behave differently from another; instead, whenever possible, use an explicit approach that makes it clear what the desired behavior is in all Python versions (e.g. if you want to do floor division, use `//`; if you want to divide as floats, explicitly cast to floats).
33+
### Testing
2734

28-
Developing with different Python versions
29-
-----------------------------------------
35+
To run all unit tests:
3036

31-
Example for switching to Python 3:
37+
```
38+
pytest
39+
```
3240

33-
```virtualenv -p `which python3` ~/.virtualenvs/python-client```
41+
By default, the full unit test suite includes live tests of the integrations for Consul, DynamoDB, and Redis. Those tests expect you to have instances of all of those databases running locally. To skip them, set the environment variable `LD_SKIP_DATABASE_TESTS=1` before running the tests.
42+
43+
There are also integration tests that can be run against the LaunchDarkly service. To enable them, set the environment variable `LD_SDK_KEY` to a valid production SDK Key.
44+
45+
### Portability
46+
47+
Most portability issues are addressed by using the `six` package. We are avoiding the use of `__future__` imports, since they can easily be omitted by mistake causing code in one file to behave differently from another; instead, whenever possible, use an explicit approach that makes it clear what the desired behavior is in all Python versions (e.g. if you want to do floor division, use `//`; if you want to divide as floats, explicitly cast to floats).
48+
49+
It is preferable to run tests against all supported minor versions of Python (as described in `README.md` under Requirements), or at least the lowest and highest versions, prior to submitting a pull request. However, LaunchDarkly's CI tests will run automatically against all supported versions.

README.md

Lines changed: 20 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,49 @@
1-
LaunchDarkly SDK for Python
2-
===========================
1+
# LaunchDarkly Server-side SDK for Python
32

4-
[![Circle CI](https://img.shields.io/circleci/project/launchdarkly/python-client.png)](https://circleci.com/gh/launchdarkly/python-client)
5-
6-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Flaunchdarkly%2Fpython-client.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Flaunchdarkly%2Fpython-client?ref=badge_shield)
3+
[![Circle CI](https://img.shields.io/circleci/project/launchdarkly/python-server-sdk.png)](https://circleci.com/gh/launchdarkly/python-server-sdk)
74

85
[![PyPI](https://img.shields.io/pypi/v/ldclient-py.svg?maxAge=2592000)](https://pypi.python.org/pypi/ldclient-py)
96
[![PyPI](https://img.shields.io/pypi/pyversions/ldclient-py.svg)](https://pypi.python.org/pypi/ldclient-py)
107

11-
[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)
12-
13-
Supported Python versions
14-
-------------------------
15-
16-
This version of the LaunchDarkly SDK is compatible with Python 2.7, and Python 3.3 through 3.7.
17-
18-
Quick setup
19-
-----------
20-
21-
1. Install the Python SDK with `pip`
22-
23-
pip install ldclient-py
24-
25-
2. Configure the library with your sdk key:
26-
27-
import ldclient
28-
29-
3. Get the client:
30-
31-
ldclient.set_sdk_key("your sdk key")
32-
client = ldclient.get()
33-
34-
35-
HTTPS proxy
36-
------------
37-
Python's standard HTTP library provides built-in support for the use of a HTTPS proxy. If the HTTPS_PROXY environment variable is present then the SDK will proxy all network requests through the URL provided.
8+
## LaunchDarkly overview
389

39-
How to set the HTTPS_PROXY environment variable on Mac/Linux systems:
40-
```
41-
export HTTPS_PROXY=https://web-proxy.domain.com:8080
42-
```
43-
44-
45-
How to set the HTTPS_PROXY environment variable on Windows systems:
46-
```
47-
set HTTPS_PROXY=https://web-proxy.domain.com:8080
48-
```
49-
50-
Or it can be set from within python:
51-
```
52-
os.environ["https_proxy"] = "https://web-proxy.domain.com:8080"
53-
```
54-
55-
If your proxy requires authentication then you can prefix the URN with your login information:
56-
```
57-
export HTTPS_PROXY=http://user:pass@web-proxy.domain.com:8080
58-
```
59-
or
60-
```
61-
set HTTPS_PROXY=http://user:pass@web-proxy.domain.com:8080
62-
```
63-
64-
65-
Your first feature flag
66-
-----------------------
67-
68-
1. Create a new feature flag on your [dashboard](https://app.launchdarkly.com)
69-
2. In your application code, use the feature's key to check whether the flag is on for each user:
70-
71-
if client.variation("your.flag.key", {"key": "user@test.com"}, False):
72-
# application code to show the feature
73-
else:
74-
# the code to run if the feature is off
75-
76-
Supported Python versions
77-
-------------------------
78-
79-
The SDK is tested with the most recent patch releases of Python 2.7, 3.3, 3.4, 3.5, and 3.6. Python 2.6 is no longer supported.
80-
81-
Database integrations
82-
---------------------
10+
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!
11+
12+
[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)
8313

84-
Feature flag data can be kept in a persistent store using Consul, DynamoDB, or Redis. These adapters are implemented in the `Consul`, `DynamoDB` and `Redis` classes in `ldclient.integrations`; to use them, call the `new_feature_store` method in the appropriate class, and put the returned object in the `feature_store` property of your client configuration. See [`ldclient.integrations`](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-integrations.html#module-ldclient.integrations) and the [SDK reference guide](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store) for more information.
14+
## Supported Python versions
8515

86-
Note that Consul is not supported in Python 3.3 or 3.4.
16+
This version of the LaunchDarkly SDK is compatible with Python 2.7 and 3.3 through 3.7. It is tested with the most recent patch releases of those versions. Python 2.6 is no longer supported.
8717

88-
Using flag data from a file
89-
---------------------------
18+
## Getting started
9019

91-
For testing purposes, the SDK can be made to read feature flag state from a file or files instead of connecting to LaunchDarkly. See [`ldclient.integrations.Files`](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-integrations.html#ldclient.integrations.Files) and the [SDK reference guide](https://docs.launchdarkly.com/v2.0/docs/reading-flags-from-a-file) for more details.
20+
Refer to the [SDK reference guide](https://docs.launchdarkly.com/docs/python-sdk-reference) for instructions on getting started with using the SDK.
9221

93-
Learn more
94-
----------
22+
## Learn more
9523

9624
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/docs/python-sdk-reference).
9725

9826
Generated API documentation is on [readthedocs.io](https://launchdarkly-python-sdk.readthedocs.io/en/latest/).
9927

100-
Testing
101-
-------
28+
## Testing
10229

10330
We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.
10431

105-
[![Test Coverage](https://codeclimate.com/github/launchdarkly/python-client/badges/coverage.svg)](https://codeclimate.com/github/launchdarkly/python-client/coverage) The Code Climate coverage does not include the coverage provided by this integration test harness.
106-
107-
Contributing
108-
------------
32+
## Contributing
10933

110-
See [CONTRIBUTING](CONTRIBUTING.md) for more information.
34+
We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK.
11135

112-
About LaunchDarkly
113-
------------------
36+
## About LaunchDarkly
11437

11538
* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
11639
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
11740
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
11841
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
11942
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
120-
* LaunchDarkly provides feature flag SDKs for
121-
* [Java](http://docs.launchdarkly.com/docs/java-sdk-reference "LaunchDarkly Java SDK")
122-
* [JavaScript](http://docs.launchdarkly.com/docs/js-sdk-reference "LaunchDarkly JavaScript SDK")
123-
* [PHP](http://docs.launchdarkly.com/docs/php-sdk-reference "LaunchDarkly PHP SDK")
124-
* [Python](http://docs.launchdarkly.com/docs/python-sdk-reference "LaunchDarkly Python SDK")
125-
* [Go](http://docs.launchdarkly.com/docs/go-sdk-reference "LaunchDarkly Go SDK")
126-
* [Node.JS](http://docs.launchdarkly.com/docs/node-sdk-reference "LaunchDarkly Node SDK")
127-
* [Electron](http://docs.launchdarkly.com/docs/electron-sdk-reference "LaunchDarkly Electron SDK")
128-
* [.NET](http://docs.launchdarkly.com/docs/dotnet-sdk-reference "LaunchDarkly .Net SDK")
129-
* [Ruby](http://docs.launchdarkly.com/docs/ruby-sdk-reference "LaunchDarkly Ruby SDK")
130-
* [iOS](http://docs.launchdarkly.com/docs/ios-sdk-reference "LaunchDarkly iOS SDK")
131-
* [Android](http://docs.launchdarkly.com/docs/android-sdk-reference "LaunchDarkly Android SDK")
132-
* [C/C++](http://docs.launchdarkly.com/docs/c-sdk-reference "LaunchDarkly C/C++ SDK")
43+
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
13344
* Explore LaunchDarkly
134-
* [launchdarkly.com](http://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
135-
* [docs.launchdarkly.com](http://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDKs
136-
* [apidocs.launchdarkly.com](http://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
137-
* [blog.launchdarkly.com](http://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
45+
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
46+
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
47+
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
48+
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
13849
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies

scripts/release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# When done you should commit and push the changes made.
1010

1111
set -uxe
12-
echo "Starting python-client release."
12+
echo "Starting python-server-sdk release."
1313

1414
VERSION=$1
1515

@@ -28,4 +28,4 @@ python setup.py sdist
2828
pip install twine
2929
python -m twine upload dist/*
3030

31-
echo "Done with python-client release"
31+
echo "Done with python-server-sdk release"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def run(self):
4949
author='LaunchDarkly',
5050
author_email='team@launchdarkly.com',
5151
packages=find_packages(),
52-
url='https://github.com/launchdarkly/python-client',
52+
url='https://github.com/launchdarkly/python-server-sdk',
5353
description='LaunchDarkly SDK for Python',
5454
long_description='LaunchDarkly SDK for Python',
5555
install_requires=reqs,

testing/test_feature_store.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import boto3
22
import json
3+
import os
34
import pytest
45
import redis
56
import time
@@ -165,19 +166,23 @@ def _clear_data(self):
165166

166167

167168
class TestFeatureStore:
168-
params = [
169-
InMemoryTester(),
170-
RedisTester(CacheConfig.default()),
171-
RedisTester(CacheConfig.disabled()),
172-
RedisWithDeprecatedConstructorTester(CacheConfig.default()),
173-
RedisWithDeprecatedConstructorTester(CacheConfig.disabled()),
174-
DynamoDBTester(CacheConfig.default()),
175-
DynamoDBTester(CacheConfig.disabled())
176-
]
177-
178-
if have_consul:
179-
params.append(ConsulTester(CacheConfig.default()))
180-
params.append(ConsulTester(CacheConfig.disabled()))
169+
if os.environ.get('LD_SKIP_DATABASE_TESTS') == '1':
170+
params = [
171+
InMemoryTester()
172+
]
173+
else:
174+
params = [
175+
InMemoryTester(),
176+
RedisTester(CacheConfig.default()),
177+
RedisTester(CacheConfig.disabled()),
178+
RedisWithDeprecatedConstructorTester(CacheConfig.default()),
179+
RedisWithDeprecatedConstructorTester(CacheConfig.disabled()),
180+
DynamoDBTester(CacheConfig.default()),
181+
DynamoDBTester(CacheConfig.disabled())
182+
]
183+
if have_consul:
184+
params.append(ConsulTester(CacheConfig.default()))
185+
params.append(ConsulTester(CacheConfig.disabled()))
181186

182187
@pytest.fixture(params=params)
183188
def tester(self, request):

0 commit comments

Comments
 (0)