-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VID-3001 add clients part of feature flags
- Loading branch information
0 parents
commit 41d0a2b
Showing
68 changed files
with
5,576 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Ignore Python bytecode files / cache | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.mypy_cache | ||
.pytest_cache | ||
.ruff_cache | ||
__pycache__ | ||
__pypackages__ | ||
|
||
# Ignore Python virtual environment files | ||
venv/ | ||
.venv/ | ||
.ve/ | ||
.pdm.toml | ||
.pdm-build | ||
.pdm-python | ||
|
||
# Ignore local development configuration files | ||
.git | ||
.env | ||
.flake8 | ||
mypy.ini | ||
.dockerignore | ||
.gitignore | ||
.gitlab-ci.yml | ||
.python-version | ||
README.md | ||
.hooks | ||
.lets | ||
helm | ||
.ipython | ||
.ptpython | ||
.secrets | ||
|
||
# Ignore IDE settings | ||
.vscode | ||
.idea | ||
|
||
# Ignore any compiled Python extension modules | ||
*.so | ||
|
||
# Ignore any build artifacts | ||
build/ | ||
dist/ |
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,47 @@ | ||
name: Build & publish | ||
|
||
on: | ||
push: | ||
branches: [ "**" ] | ||
tags: | ||
- "client-v*" | ||
- "proto-v*" | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
deploy-client: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./client | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/client-') | ||
strategy: | ||
matrix: | ||
python-version: [3.7] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: pdm-project/setup-pdm@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Upload package to pypi.org | ||
run: pdm publish --username ${{ secrets.TWINE_USERNAME }} --password ${{ secrets.TWINE_PASSWORD }} | ||
|
||
deploy-proto: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./protobuf | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/proto-') | ||
strategy: | ||
matrix: | ||
python-version: [3.7] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Upload package to pypi.org | ||
run: pdm publish --username ${{ secrets.TWINE_USERNAME }} --password ${{ secrets.TWINE_PASSWORD }} |
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,42 @@ | ||
name: Test | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- assigned | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
test-client: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./client | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9, "3.10", 3.11] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: pdm-project/setup-pdm@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: python -m pip install tox tox-gh-actions tox-pdm | ||
- name: Test with tox | ||
run: | | ||
tox --version | ||
tox | ||
test-server: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install lets | ||
uses: lets-cli/[email protected] | ||
- name: Run test | ||
run: lets test server |
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,37 @@ | ||
# Ignore Python bytecode files / cache | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.mypy_cache | ||
.pytest_cache | ||
.ruff_cache | ||
__pycache__ | ||
__pypackages__ | ||
featureflags_protobuf | ||
|
||
# Ignore Python virtual environment files | ||
venv/ | ||
.venv/ | ||
.ve/ | ||
.pdm.toml | ||
.pdm-python | ||
.pdm-build | ||
|
||
# Ignore local development configuration files | ||
.env | ||
.lets | ||
.ipython | ||
.ptpython | ||
.python-version | ||
.secrets | ||
|
||
# Ignore IDE settings | ||
.vscode | ||
.idea | ||
|
||
# Ignore any compiled Python extension modules | ||
*.so | ||
|
||
# Ignore any build artifacts | ||
build/ | ||
dist/ |
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,48 @@ | ||
FROM python:3.11-slim-bullseye as base | ||
|
||
ENV PIP_VERSION=23.2.1 | ||
ENV PDM_VERSION=2.9.1 | ||
ENV PDM_USE_VENV=no | ||
ENV PYTHONPATH=/app/__pypackages__/3.11/lib | ||
|
||
WORKDIR /app | ||
|
||
COPY ./pyproject.toml . | ||
COPY ./pdm.lock . | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
libpq-dev \ | ||
gcc \ | ||
make \ | ||
g++ \ | ||
git && \ | ||
# install tools | ||
pip install --upgrade pip==${PIP_VERSION} && \ | ||
pip install pdm==${PDM_VERSION} && \ | ||
# configure | ||
pdm config cache_dir /pdm_cache && \ | ||
pdm config check_update false && \ | ||
# install base deps \ | ||
pdm install --no-lock --prod --no-editable && \ | ||
# cleanup base layer to keep image size small | ||
apt purge --auto-remove -y \ | ||
gcc \ | ||
make \ | ||
g++ \ | ||
git && \ | ||
rm -rf /var/cache/apt && \ | ||
rm -rf /var/lib/apt/list && \ | ||
rm -rf $HOME/.cache | ||
|
||
FROM base as dev | ||
RUN pdm install --no-lock -G dev -G lint --no-editable | ||
|
||
FROM dev as examples | ||
RUN pdm install --no-lock -G examples | ||
|
||
FROM base as test | ||
RUN pdm install --no-lock -G test | ||
|
||
FROM base as docs | ||
RUN pdm install --no-lock -G docs |
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,67 @@ | ||
FeatureFlags service and client library for Python. | ||
|
||
See ``examples`` directory for complete examples for some major Web frameworks. | ||
|
||
Overview | ||
-------- | ||
|
||
This repository consists of three sub-projects: | ||
|
||
- ``/client`` - client library | ||
- ``/server`` - server application | ||
- ``/protobuf`` - message types definition for talking between client and server | ||
using gRPC protocol | ||
|
||
Client supports Python >=3.7. | ||
|
||
Server requires Python >= 3.11. | ||
|
||
Server consists of two services: | ||
|
||
- Web application: | ||
|
||
- sanic_ + hiku_ + aiopg_ on backend | ||
- `react.js`_ + `Apollo`_ on frontend | ||
|
||
- gRPC API handler: | ||
|
||
- grpclib_ + hiku_ | ||
|
||
ADR | ||
--- | ||
|
||
Check important architecture decisions in ``adr/`` directory. | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
On PyPi: https://pypi.org/project/evo-featureflags-client | ||
|
||
To install client library for synchronous app: | ||
|
||
.. code-block:: shell | ||
|
||
$ pip install evo-featureflags-client grpcio | ||
|
||
To install client library for asynchronous app: | ||
|
||
.. code-block:: shell | ||
|
||
$ pip install evo-featureflags-client grpclib | ||
|
||
Development | ||
----------- | ||
|
||
Run all this commands: | ||
|
||
- ``lets postgres`` | ||
- ``lets apply-migrations-dev`` | ||
- ``lets web`` # in separate terminal | ||
- ``lets rpc`` # in separate terminal, not required for web | ||
- ``lets ui`` # in separate terminal | ||
|
||
.. _sanic: https://github.com/channelcat/sanic/ | ||
.. _hiku: https://github.com/vmagamedov/hiku | ||
.. _aiopg: https://github.com/aio-libs/aiopg | ||
.. _grpclib: https://github.com/vmagamedov/grpclib |
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,32 @@ | ||
version: "3.9" | ||
|
||
services: | ||
featureflags: &base | ||
image: featureflags | ||
init: true | ||
environment: | ||
LANG: C.UTF-8 | ||
LC_ALL: C.UTF-8 | ||
PYTHONIOENCODING: UTF-8 | ||
PYTHONUNBUFFERED: 1 | ||
volumes: | ||
- ./featureflags:/app/featureflags | ||
- ./examples:/app/examples | ||
- ./.ipython:/app/.ipython | ||
# Uncomment to mount local build of `featureflags_protobuf` | ||
- ./featureflags_protobuf:/app/featureflags_protobuf | ||
|
||
ishell: | ||
<<: *base | ||
image: featureflags-examples | ||
command: pdm run ipython --ipython-dir=/app/.ipython | ||
|
||
test: | ||
<<: *base | ||
image: featureflags-test | ||
command: pdm run test ${ARGS} | ||
|
||
docs: | ||
<<: *base | ||
image: featureflags-docs | ||
command: sphinx-build -a -b html docs public |
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,25 @@ | ||
.wy-nav-side { | ||
background: #2d3a48; | ||
} | ||
.wy-side-nav-search { | ||
background: #181f27; | ||
} | ||
.wy-menu-vertical a:hover { | ||
background-color: #475260; | ||
} | ||
.rst-content code { | ||
border-radius: 3px; | ||
} | ||
.rst-content code.literal { | ||
color: black; | ||
} | ||
.rst-content dl:not(.docutils) code { | ||
font-weight: normal; | ||
} | ||
.rst-content a code.literal { | ||
font-weight: normal; | ||
color: #2980B9; | ||
} | ||
.rst-content a:hover code.literal { | ||
color: #3091d1; | ||
} |
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,24 @@ | ||
Client | ||
====== | ||
|
||
0.2.0 | ||
~~~~~ | ||
|
||
- Fixed default flag value | ||
- Removed ``OverrideManager`` in favor to the ``overrides`` keyword argument | ||
in the :py:meth:`~featureflags.client.flags.Client.flags` method. | ||
- Dropped Python 2 support | ||
|
||
0.1.3 | ||
~~~~~ | ||
|
||
- Added :py:meth:`~featureflags.client.flags.Flags.__history__` method, | ||
see :doc:`../client/tracing` for more information | ||
|
||
0.1.2 | ||
~~~~~ | ||
|
||
- Added :py:class:`~featureflags.client.managers.dummy.DummyManager` | ||
- Added :py:class:`~featureflags.client.managers.override.OverrideManager` | ||
to override flags state | ||
- Fixed setup.py file to properly list all requirements |
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,7 @@ | ||
Changelog | ||
========= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
client |
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,9 @@ | ||
Client | ||
====== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
variables | ||
tracing | ||
reference |
Oops, something went wrong.