Skip to content

Commit 06a3701

Browse files
committed
docs: Add supporting documentation
1 parent f6d769d commit 06a3701

File tree

10 files changed

+302
-0
lines changed

10 files changed

+302
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is this a support request?**
11+
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/hc/en-us/requests/new) or by emailing [email protected].
12+
13+
Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.
14+
15+
**Describe the bug**
16+
A clear and concise description of what the bug is.
17+
18+
**To reproduce**
19+
Steps to reproduce the behavior.
20+
21+
**Expected behavior**
22+
A clear and concise description of what you expected to happen.
23+
24+
**Logs**
25+
If applicable, add any log output related to your problem.
26+
27+
**SDK version**
28+
The version of this SDK that you are using.
29+
30+
**Language version, developer tools**
31+
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.
32+
33+
**OS/platform**
34+
For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version.
35+
36+
**Additional context**
37+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Support request
4+
url: https://support.launchdarkly.com/hc/en-us/requests/new
5+
about: File your support requests with LaunchDarkly's support team
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context about the feature request here.

.github/pull_request_template.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
**Requirements**
2+
3+
- [ ] I have added test coverage for new or changed functionality
4+
- [ ] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
5+
- [ ] I have validated my changes against all supported platform versions
6+
7+
**Related issues**
8+
9+
Provide links to any issues in this repository or elsewhere relating to this pull request.
10+
11+
**Describe the solution you've provided**
12+
13+
Provide a clear and concise description of what you expect to happen.
14+
15+
**Describe alternatives you've considered**
16+
17+
Provide a clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
21+
Add any other context about the pull request here.

CHANGELOG.md

Whitespace-only changes.

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Repository Maintainers
2+
* @launchdarkly/team-sdk-python

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Contributing to the LaunchDarkly OpenFeature provider for the Server-Side SDK for Python
2+
3+
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.
4+
5+
## Submitting bug reports and feature requests
6+
7+
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/openfeature-python-server/issues) in the provider repository. Bug reports and feature requests specific to this provider should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.
8+
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.
12+
13+
## Prerequisites
14+
15+
This project is built using [poetry](https://python-poetry.org/). To learn more about the basics of working with this tool, read [Poetry's basic usage guide](https://python-poetry.org/docs/basic-usage/).
16+
17+
To begin development, active the poetry shell and ensure your dependencies are installed.
18+
19+
```
20+
poetry shell
21+
poetry install
22+
```
23+
24+
## Build instructions
25+
26+
This project makes use of `make` as a way of automating common steps. Run `make help` to see a list of valid targets. For example,
27+
28+
```shell
29+
$ make
30+
Usage: make [target] ...
31+
32+
Targets:
33+
help Show this help message
34+
test Run unit tests
35+
lint Run type analysis and linting checks
36+
docs Generate sphinx-based documentation
37+
```

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2024 Catamorphic, Co.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# LaunchDarkly OpenFeature provider for the Server-Side SDK for Python
2+
3+
[![Run CI](https://github.com/launchdarkly/openfeature-python-server/actions/workflows/ci.yml/badge.svg)](https://github.com/launchdarkly/openfeature-python-server/actions/workflows/ci.yml)
4+
[![Packagist](https://img.shields.io/packagist/v/launchdarkly/openfeature-server.svg?style=flat-square)](https://packagist.org/packages/launchdarkly/openfeature-server)
5+
[![readthedocs](https://readthedocs.org/projects/launchdarkly-openfeature-server/badge/)](https://launchdarkly-openfeature-server.readthedocs.io/en/latest/)
6+
7+
This provider allows for using LaunchDarkly with the OpenFeature SDK for Python.
8+
9+
This provider is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.
10+
11+
This provider is a beta version and should not be considered ready for production use while this message is visible.
12+
13+
# LaunchDarkly overview
14+
15+
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today!
16+
17+
[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)
18+
19+
## Supported Python versions
20+
21+
This version of the LaunchDarkly provider works with Python 3.8 and above.
22+
23+
## Getting started
24+
25+
### Requisites
26+
27+
Install the library via pip
28+
29+
```shell
30+
$ pip install launchdarkly-openfeature-server
31+
```
32+
33+
### Usage
34+
35+
```python
36+
from ldclient import Config, LDClient
37+
from ld_openfeature import LaunchDarklyProvider
38+
from openfeature.evaluation_context import EvaluationContext
39+
from openfeature import api
40+
41+
ld_client = LDClient(config=Config("sdk-key"))
42+
openfeature_provider = LaunchDarklyProvider(ld_client)
43+
44+
api.set_provider(openfeature_provider)
45+
46+
# Refer to OpenFeature documentation for getting a client and performing evaluations.
47+
```
48+
49+
Refer to the [SDK reference guide](https://docs.launchdarkly.com/sdk/server-side/python) for instructions on getting started with using the SDK.
50+
51+
For information on using the OpenFeature client please refer to the [OpenFeature Documentation](https://docs.openfeature.dev/docs/reference/concepts/evaluation-api/).
52+
53+
## OpenFeature Specific Considerations
54+
55+
LaunchDarkly evaluates contexts, and it can either evaluate a single-context, or a multi-context. When using OpenFeature both single and multi-contexts must be encoded into a single `EvaluationContext`. This is accomplished by looking for an attribute named `kind` in the `EvaluationContext`.
56+
57+
There are 4 different scenarios related to the `kind`:
58+
1. There is no `kind` attribute. In this case the provider will treat the context as a single context containing a "user" kind.
59+
2. There is a `kind` attribute, and the value of that attribute is "multi". This will indicate to the provider that the context is a multi-context.
60+
3. There is a `kind` attribute, and the value of that attribute is a string other than "multi". This will indicate to the provider a single context of the kind specified.
61+
4. There is a `kind` attribute, and the attribute is not a string. In this case the value of the attribute will be discarded, and the context will be treated as a "user". An error message will be logged.
62+
63+
The `kind` attribute should be a string containing only contain ASCII letters, numbers, `.`, `_` or `-`.
64+
65+
The OpenFeature specification allows for an optional targeting key, but LaunchDarkly requires a key for evaluation. A targeting key must be specified for each context being evaluated. It may be specified using either `targetingKey`, as it is in the OpenFeature specification, or `key`, which is the typical LaunchDarkly identifier for the targeting key. If a `targetingKey` and a `key` are specified, then the `targetingKey` will take precedence.
66+
67+
There are several other attributes which have special functionality within a single or multi-context.
68+
- A key of `privateAttributes`. Must be an array of string values. [Equivalent to the 'private' builder method in the SDK.](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-main.html#ldclient.ContextBuilder.private)
69+
- A key of `anonymous`. Must be a boolean value. [Equivalent to the 'anonymous' builder method in the SDK.](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-main.html#ldclient.ContextBuilder.anonymous)
70+
- A key of `name`. Must be a string. [Equivalent to the 'name' builder method in the SDK.](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-main.html#ldclient.ContextBuilder.name)
71+
72+
### Examples
73+
74+
#### A single user context
75+
76+
```python
77+
context = EvaluationContext("the-key")
78+
```
79+
80+
#### A single context of kind "organization"
81+
82+
```python
83+
context = EvaluationContext("org-key", {"kind": "organization"});
84+
```
85+
86+
#### A multi-context containing a "user" and an "organization"
87+
88+
```python
89+
attributes = {
90+
"kind": "multi",
91+
"organization": {
92+
"name": "the-org-name",
93+
"targetingKey", "my-org-key",
94+
"myCustomAttribute", "myAttributeValue"
95+
},
96+
"user": {
97+
"key": "my-user-key",
98+
"anonymous", true
99+
}
100+
}
101+
context = EvaluationContext(null, attributes)
102+
```
103+
104+
#### Setting private attributes in a single context
105+
106+
```python
107+
attributes = {
108+
"kind": "organization",
109+
"myCustomAttribute": "myAttributeValue",
110+
"privateAttributes": ["myCustomAttribute"]
111+
}
112+
113+
context = EvaluationContext("org-key", attributes)
114+
```
115+
116+
#### Setting private attributes in a multi-context
117+
118+
```python
119+
attributes = {
120+
"kind": "organization",
121+
"organization": {
122+
"name": "the-org-name",
123+
"targetingKey": "my-org-key",
124+
# This will ONLY apply to the "organization" attributes.
125+
"privateAttributes": ["myCustomAttribute"],
126+
# This attribute will be private.
127+
"myCustomAttribute": "myAttributeValue",
128+
},
129+
"user": [
130+
"key": "my-user-key",
131+
"anonymous" = > true,
132+
# This attribute will not be private.
133+
"myCustomAttribute": "myAttributeValue",
134+
]
135+
}
136+
137+
context = EvaluationContext(null, attributes)
138+
```
139+
140+
## Learn more
141+
142+
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](https://docs.launchdarkly.com/sdk/server-side/python).
143+
144+
The authoritative description of all properties and methods is in the [python documentation](https://launchdarkly.github.io/python-server-sdk/).
145+
146+
## Contributing
147+
148+
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.
149+
150+
## About LaunchDarkly
151+
152+
* 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:
153+
* 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.
154+
* 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?).
155+
* 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.
156+
* 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.
157+
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
158+
* Explore LaunchDarkly
159+
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
160+
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
161+
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
162+
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates

SECURITY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Reporting and Fixing Security Issues
2+
3+
Please report all security issues to the LaunchDarkly security team by submitting a bug bounty report to our [HackerOne program](https://hackerone.com/launchdarkly?type=team). LaunchDarkly will triage and address all valid security issues following the response targets defined in our program policy. Valid security issues may be eligible for a bounty.
4+
5+
Please do not open issues or pull requests for security issues. This makes the problem immediately visible to everyone, including potentially malicious actors.

0 commit comments

Comments
 (0)