-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement/general-housekeeping (#43)
* Update versions Reformat * Linting / precommit for yaml Added prettir Fixed up some files * Removed prettierignore and linted some json and html * Remove support for python 3.7 and add 3.11
- Loading branch information
1 parent
59deb31
commit 5c8fa0f
Showing
10 changed files
with
166 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
name: Publish Pypi Package | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-latest | ||
name: Publish Pypi Package | ||
package: | ||
runs-on: ubuntu-latest | ||
name: Publish Pypi Package | ||
|
||
steps: | ||
- name: Cloning repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
steps: | ||
- name: Cloning repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build and publish to pypi | ||
uses: JRubics/[email protected] | ||
with: | ||
pypi_token: ${{ secrets.PYPI_API_TOKEN }} | ||
ignore_dev_requirements: "yes" | ||
build_format: "sdist" | ||
- name: Build and publish to pypi | ||
uses: JRubics/[email protected] | ||
with: | ||
pypi_token: ${{ secrets.PYPI_API_TOKEN }} | ||
ignore_dev_requirements: 'yes' | ||
build_format: 'sdist' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
name: Formatting and Tests | ||
|
||
on: | ||
- pull_request | ||
- pull_request | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Pytest and Black formatting | ||
|
||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- name: Cloning repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry install | ||
- name: Check Formatting | ||
run: | | ||
poetry run black --check . | ||
poetry run flake8 . | ||
poetry run isort --check . | ||
- name: Run Tests | ||
run: poetry run pytest | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Pytest and Black formatting | ||
|
||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
|
||
steps: | ||
- name: Cloning repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry install | ||
- name: Check Formatting | ||
run: | | ||
poetry run black --check . | ||
poetry run flake8 . | ||
poetry run isort --check . | ||
- name: Run Tests | ||
run: poetry run pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"proseWrap": "always", | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"tabWidth": 4, | ||
"overrides": [ | ||
{ | ||
"files": "**/*.md", | ||
"options": { | ||
"tabWidth": 1 | ||
} | ||
}, | ||
{ | ||
"files": ["**/*.yml", "**/*.yaml"], | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,30 @@ | |
|
||
# Flagsmith Python SDK | ||
|
||
> Flagsmith allows you to manage feature flags and remote config across multiple projects, environments and organisations. | ||
> Flagsmith allows you to manage feature flags and remote config across multiple projects, environments and | ||
> organisations. | ||
The SDK for Python applications for [https://www.flagsmith.com/](https://www.flagsmith.com/). | ||
|
||
## Adding to your project | ||
|
||
For full documentation visit [https://docs.flagsmith.com/clients/server-side](https://docs.flagsmith.com/clients/server-side). | ||
For full documentation visit | ||
[https://docs.flagsmith.com/clients/server-side](https://docs.flagsmith.com/clients/server-side). | ||
|
||
## Contributing | ||
|
||
Please read [CONTRIBUTING.md](https://gist.github.com/kyle-ssg/c36a03aebe492e45cbd3eefb21cb0486) for details on our code of conduct, and the process for submitting pull requests | ||
Please read [CONTRIBUTING.md](https://gist.github.com/kyle-ssg/c36a03aebe492e45cbd3eefb21cb0486) for details on our code | ||
of conduct, and the process for submitting pull requests | ||
|
||
## Getting Help | ||
|
||
If you encounter a bug or feature request we would like to hear about it. Before you submit an issue please search existing issues in order to prevent duplicates. | ||
If you encounter a bug or feature request we would like to hear about it. Before you submit an issue please search | ||
existing issues in order to prevent duplicates. | ||
|
||
## Get in touch | ||
|
||
If you have any questions about our projects you can email <a href="mailto:[email protected]">[email protected]</a>. | ||
If you have any questions about our projects you can email | ||
<a href="mailto:[email protected]">[email protected]</a>. | ||
|
||
## Useful links | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
# Flagsmith Basic Python Example | ||
|
||
This directory contains a basic Flask application which utilises Flagsmith. To run the example application, you'll | ||
need to go through the following steps: | ||
This directory contains a basic Flask application which utilises Flagsmith. To run the example application, you'll need | ||
to go through the following steps: | ||
|
||
1. Create an account, organisation and project on [Flagsmith](https://flagsmith.com) | ||
2. Create a feature in the project called "secret_button" | ||
3. Give the feature a value using the json editor as follows: | ||
3. Give the feature a value using the json editor as follows: | ||
|
||
```json | ||
{"colour": "#ababab"} | ||
{ "colour": "#ababab" } | ||
``` | ||
|
||
4. Create a .env file from the template located in this directory with the environment key of one of the environments | ||
in flagsmith (This can be found on the 'settings' page accessed from the menu on the left under the chosen environment.) | ||
4. Create a .env file from the template located in this directory with the environment key of one of the environments in | ||
flagsmith (This can be found on the 'settings' page accessed from the menu on the left under the chosen environment.) | ||
5. From a terminal window, export those environment variables (either manually or by using `export $(cat .env)`) | ||
6. Run the app using `flask run` | ||
7. Browse to http://localhost:5000 | ||
|
||
Now you can play around with the 'secret_button' feature in flagsmith, turn it on to show it and edit the colour in the | ||
json value to edit the colour of the button. You can also identify as a given user and then update the settings for the | ||
secret button feature for that user in the flagsmith interface to see the affect that has too. | ||
secret button feature for that user in the flagsmith interface to see the affect that has too. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
<!doctype html> | ||
<!DOCTYPE html> | ||
<head> | ||
<style></style> | ||
</head> | ||
<title>Flagsmith Example</title> | ||
<body> | ||
<p>Hello, {{ identifier or 'World' }}.</p> | ||
{% if show_button %} | ||
<button style="background-color: {{ button_colour }}">A secret button</button> | ||
{% endif %} | ||
<p>Hello, {{ identifier or 'World' }}.</p> | ||
{% if show_button %} | ||
<button style="background-color: {{ button_colour }}">A secret button</button> | ||
{% endif %} | ||
|
||
<p></p> | ||
<p></p> | ||
|
||
<form action="/" method="GET"> | ||
<h3>Identify as a user</h3> | ||
<label for="identifier">Identifier: </label><input name="identifier" id="identifier"><br> | ||
<form action="/" method="GET"> | ||
<h3>Identify as a user</h3> | ||
<label for="identifier">Identifier: </label><input name="identifier" id="identifier" /><br /> | ||
|
||
<p>... with an optional user trait</p> | ||
<label for="trait-key">Trait key: </label><input name="trait-key" id="trait-key"><br> | ||
<label for="trait-value">Trait value: </label><input name="trait-value" id="trait-value"><br><br> | ||
<p>... with an optional user trait</p> | ||
<label for="trait-key">Trait key: </label><input name="trait-key" id="trait-key" /><br /> | ||
<label for="trait-value">Trait value: </label><input name="trait-value" id="trait-value" /><br /><br /> | ||
|
||
<button type="submit">Identify!</button> | ||
</form> | ||
|
||
</body> | ||
<button type="submit">Identify!</button> | ||
</form> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
{ | ||
"api_key": "B62qaMZNwfiqT76p38ggrQ", | ||
"project": { | ||
"name": "Test project", | ||
"organisation": { | ||
"feature_analytics": false, | ||
"name": "Test Org", | ||
"id": 1, | ||
"persist_trait_data": true, | ||
"stop_serving_flags": false | ||
}, | ||
"id": 1, | ||
"hide_disabled_flags": false, | ||
"segments": [ | ||
{ | ||
"api_key": "B62qaMZNwfiqT76p38ggrQ", | ||
"project": { | ||
"name": "Test project", | ||
"organisation": { | ||
"feature_analytics": false, | ||
"name": "Test Org", | ||
"id": 1, | ||
"persist_trait_data": true, | ||
"stop_serving_flags": false | ||
}, | ||
"id": 1, | ||
"name": "Test segment", | ||
"rules": [ | ||
{ | ||
"type": "ALL", | ||
"rules": [ | ||
{ | ||
"type": "ALL", | ||
"rules": [], | ||
"conditions": [ | ||
{ | ||
"operator": "EQUAL", | ||
"property_": "foo", | ||
"value": "bar" | ||
} | ||
"hide_disabled_flags": false, | ||
"segments": [ | ||
{ | ||
"id": 1, | ||
"name": "Test segment", | ||
"rules": [ | ||
{ | ||
"type": "ALL", | ||
"rules": [ | ||
{ | ||
"type": "ALL", | ||
"rules": [], | ||
"conditions": [ | ||
{ | ||
"operator": "EQUAL", | ||
"property_": "foo", | ||
"value": "bar" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"segment_overrides": [], | ||
"id": 1, | ||
"feature_states": [ | ||
{ | ||
"multivariate_feature_state_values": [], | ||
"feature_state_value": "some-value", | ||
"id": 1, | ||
"featurestate_uuid": "40eb539d-3713-4720-bbd4-829dbef10d51", | ||
"feature": { | ||
"name": "some_feature", | ||
"type": "STANDARD", | ||
"id": 1 | ||
}, | ||
"segment_id": null, | ||
"enabled": true | ||
} | ||
] | ||
}, | ||
"segment_overrides": [], | ||
"id": 1, | ||
"feature_states": [ | ||
{ | ||
"multivariate_feature_state_values": [], | ||
"feature_state_value": "some-value", | ||
"id": 1, | ||
"featurestate_uuid": "40eb539d-3713-4720-bbd4-829dbef10d51", | ||
"feature": { | ||
"name": "some_feature", | ||
"type": "STANDARD", | ||
"id": 1 | ||
}, | ||
"segment_id": null, | ||
"enabled": true | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ | |
"identity": null, | ||
"feature_segment": null | ||
} | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ | |
"feature_segment": null | ||
} | ||
] | ||
} | ||
} |