# Firebase Remote Config SDK for Python
A Python SDK for managing Firebase Remote Config, built as a typed abstraction over the Firebase REST API.
This package provides a convenient way to get, validate, update and upload remote config templates.
## Features
- Provides SDK for managing Remote Config for mobile clients that is missing from Google `firebase-admin` package
- Type-safe interface using Pydantic models
- Minimal DSL for building and manipulating condition expressions
- Enables parsing condition expressions into Pydantic models
## Capabilities
- Fetch and update Remote Config templates
- Validate template updates before deployment
- List template versions and perform rollbacks
- Add, query, and update conditions and parameters
- Serialize and parse condition expressions to/from structured form
## Installation
```bash
pip install firebase-remote-config
```
## Requirements
- Python 3.9 or higher
- Firebase project with Remote Config enabled
- Service account credentials with necessary permissions (Firebase Admin / Firebase Remote Config Admin)
## Usage
### Getting Started
First, initialize the client with your Firebase credentials:
```python
from google.oauth2 import service_account
from firebase_remote_config import RemoteConfigClient
# Initialize the client
credentials = service_account.Credentials.from_service_account_file('path/to/service-account.json')
client = RemoteConfigClient(credentials, 'your-project-id')
# Get current Remote Config template
config = client.get_remote_config()
# Upload template to Firebase Remote Config
updated_config = client.update_remote_config(config)
```
### Use Cases
#### 1. Creating and Updating Parameters
```python
import firebase_remote_config as rc
# Add new parameter to the remote config template
new_param = rc.RemoteConfigParameter(
defaultValue=rc.RemoteConfigParameterValue(value="default_value"),
valueType=rc.ParameterValueType.STRING,
description="A new parameter"
)
config.template.parameters["new_parameter"] = new_param
# find parameter in the template
param = config.get_parameter_by_key("new_parameter")
param.description = "My new parameter"
```
#### 2. Working with Conditional Values
```python
import firebase_remote_config as rc
# Create condition object
condition = rc.RemoteConfigCondition(
name="ios_users",
expression="device.os == 'ios'",
tagColor=rc.TagColor.BLUE,
)
# Create condition in rconfig template
config.create_condition(condition)
# Use newly created condition in a conditional value
config.set_conditional_value(
param_key="my_parameter",
param_value=rc.RemoteConfigParameterValue(value="my_value"),
param_value_type=rc.ParameterValueType.STRING,
condition_name="ios_users",
)
```
#### 3. Building Complex Conditions with ConditionBuilder
```python
import firebase_remote_config as rc
from firebase_remote_config.conditions import ConditionBuilder
# Create a complex condition
builder = ConditionBuilder()
builder.CONDITION().APP_VERSION().GTE("1.2.0")
builder.CONDITION().APP_USER_PROPERTY("total_purchases_usd").GTE(5)
builder.CONDITION().DEVICE_COUNTRY().IN(["US", "CA"])
cond_expr = builder.build()
# Serialize condition as string
cond_expr_str = str(cond_expr)
# app.version.>=(['1.2.0']) && app.userProperty['total_purchases_usd'] >= 5 && device.country in ['US', 'CA']
# Create condition in remote config template
config.create_condition(rc.RemoteConfigCondition(
name="active_premium_users",
expression=cond_expr_str,
tagColor=rc.TagColor.GREEN,
))
```
#### 4. Parsing condition expression
```python
from firebase_remote_config.conditions import ConditionParser
# Parse condition expression
parser = ConditionParser()
cond_expr = "dateTime >= dateTime('2025-01-01T09:00:00') && app.userProperty['my_property'].contains(['abc', 'def'])"
condition = parser.parse(cond_expr)
# Compare string representations of the condition to the original expression
print(str(condition) == cond_expr)
# True
```
#### 5. Version Management
```python
# List recent versions
versions, _ = client.list_versions(page_size=30)
# Rollback to a previous version
rolled_back_config = client.rollback(version_number="42")
```
## License
This project is licensed under the terms of the LICENSE file in the root of this repository.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Raw data
{
"_id": null,
"home_page": null,
"name": "firebase-remote-config",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "firebase, remote, config",
"author": null,
"author_email": "Dmitry Kaysin <kaysin.dmitry@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a6/fe/f6be57ae0a54adc2ea4201d4813e04334f8cc42b5303ffe5d3f58d5b6290/firebase_remote_config-0.1.19.tar.gz",
"platform": null,
"description": "# Firebase Remote Config SDK for Python\n\nA Python SDK for managing Firebase Remote Config, built as a typed abstraction over the Firebase REST API.\nThis package provides a convenient way to get, validate, update and upload remote config templates.\n\n## Features\n\n- Provides SDK for managing Remote Config for mobile clients that is missing from Google `firebase-admin` package\n- Type-safe interface using Pydantic models\n- Minimal DSL for building and manipulating condition expressions\n- Enables parsing condition expressions into Pydantic models\n\n## Capabilities\n\n- Fetch and update Remote Config templates\n- Validate template updates before deployment\n- List template versions and perform rollbacks\n- Add, query, and update conditions and parameters\n- Serialize and parse condition expressions to/from structured form\n\n## Installation\n\n```bash\npip install firebase-remote-config\n```\n\n## Requirements\n\n- Python 3.9 or higher\n- Firebase project with Remote Config enabled\n- Service account credentials with necessary permissions (Firebase Admin / Firebase Remote Config Admin)\n\n## Usage\n\n### Getting Started\n\nFirst, initialize the client with your Firebase credentials:\n\n```python\nfrom google.oauth2 import service_account\nfrom firebase_remote_config import RemoteConfigClient\n\n# Initialize the client\ncredentials = service_account.Credentials.from_service_account_file('path/to/service-account.json')\nclient = RemoteConfigClient(credentials, 'your-project-id')\n\n# Get current Remote Config template\nconfig = client.get_remote_config()\n\n# Upload template to Firebase Remote Config\nupdated_config = client.update_remote_config(config)\n```\n\n### Use Cases\n\n\n#### 1. Creating and Updating Parameters\n\n```python\nimport firebase_remote_config as rc\n\n# Add new parameter to the remote config template\nnew_param = rc.RemoteConfigParameter(\n defaultValue=rc.RemoteConfigParameterValue(value=\"default_value\"),\n valueType=rc.ParameterValueType.STRING,\n description=\"A new parameter\"\n)\nconfig.template.parameters[\"new_parameter\"] = new_param\n\n# find parameter in the template\nparam = config.get_parameter_by_key(\"new_parameter\")\nparam.description = \"My new parameter\"\n```\n\n\n#### 2. Working with Conditional Values\n\n```python\nimport firebase_remote_config as rc\n\n# Create condition object\ncondition = rc.RemoteConfigCondition(\n name=\"ios_users\",\n expression=\"device.os == 'ios'\",\n tagColor=rc.TagColor.BLUE,\n)\n\n# Create condition in rconfig template\nconfig.create_condition(condition)\n\n# Use newly created condition in a conditional value\nconfig.set_conditional_value(\n param_key=\"my_parameter\",\n param_value=rc.RemoteConfigParameterValue(value=\"my_value\"),\n param_value_type=rc.ParameterValueType.STRING,\n condition_name=\"ios_users\",\n)\n```\n\n\n#### 3. Building Complex Conditions with ConditionBuilder\n\n```python\nimport firebase_remote_config as rc\nfrom firebase_remote_config.conditions import ConditionBuilder\n\n# Create a complex condition\nbuilder = ConditionBuilder()\nbuilder.CONDITION().APP_VERSION().GTE(\"1.2.0\")\nbuilder.CONDITION().APP_USER_PROPERTY(\"total_purchases_usd\").GTE(5)\nbuilder.CONDITION().DEVICE_COUNTRY().IN([\"US\", \"CA\"])\ncond_expr = builder.build()\n\n# Serialize condition as string\ncond_expr_str = str(cond_expr)\n# app.version.>=(['1.2.0']) && app.userProperty['total_purchases_usd'] >= 5 && device.country in ['US', 'CA']\n\n# Create condition in remote config template\nconfig.create_condition(rc.RemoteConfigCondition(\n name=\"active_premium_users\",\n expression=cond_expr_str,\n tagColor=rc.TagColor.GREEN,\n))\n```\n\n\n#### 4. Parsing condition expression\n\n```python\nfrom firebase_remote_config.conditions import ConditionParser\n\n# Parse condition expression\nparser = ConditionParser()\ncond_expr = \"dateTime >= dateTime('2025-01-01T09:00:00') && app.userProperty['my_property'].contains(['abc', 'def'])\"\ncondition = parser.parse(cond_expr)\n\n# Compare string representations of the condition to the original expression\nprint(str(condition) == cond_expr)\n# True\n```\n\n\n#### 5. Version Management\n\n```python\n# List recent versions\nversions, _ = client.list_versions(page_size=30)\n\n# Rollback to a previous version\nrolled_back_config = client.rollback(version_number=\"42\")\n```\n\n## License\n\nThis project is licensed under the terms of the LICENSE file in the root of this repository.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n",
"bugtrack_url": null,
"license": null,
"summary": "Firebase Remote Config SDK",
"version": "0.1.19",
"project_urls": {
"Homepage": "https://github.com/apprevenew-com/firebase-remote-config-python",
"Issues": "https://github.com/apprevenew-com/firebase-remote-config-python/issues"
},
"split_keywords": [
"firebase",
" remote",
" config"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2a052eeb6353450307615055c01311f6ef34e3a339575cf2efeaef9c9eb2b9b9",
"md5": "4d6eb4a45ded6625b2ae8ff7c513962e",
"sha256": "ba79128f2dd20d93d350e3a0a7be0857bf414587e074fd77aa0230c480a19dbb"
},
"downloads": -1,
"filename": "firebase_remote_config-0.1.19-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4d6eb4a45ded6625b2ae8ff7c513962e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 24718,
"upload_time": "2025-10-20T15:30:07",
"upload_time_iso_8601": "2025-10-20T15:30:07.901431Z",
"url": "https://files.pythonhosted.org/packages/2a/05/2eeb6353450307615055c01311f6ef34e3a339575cf2efeaef9c9eb2b9b9/firebase_remote_config-0.1.19-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a6fef6be57ae0a54adc2ea4201d4813e04334f8cc42b5303ffe5d3f58d5b6290",
"md5": "2e20678bad57d994a2b1193541099912",
"sha256": "79a16bbb497f574a86a82ab66f7e5e42ea8ccae8da8d1840e0978cb658944f20"
},
"downloads": -1,
"filename": "firebase_remote_config-0.1.19.tar.gz",
"has_sig": false,
"md5_digest": "2e20678bad57d994a2b1193541099912",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 25317,
"upload_time": "2025-10-20T15:30:09",
"upload_time_iso_8601": "2025-10-20T15:30:09.076690Z",
"url": "https://files.pythonhosted.org/packages/a6/fe/f6be57ae0a54adc2ea4201d4813e04334f8cc42b5303ffe5d3f58d5b6290/firebase_remote_config-0.1.19.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-20 15:30:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "apprevenew-com",
"github_project": "firebase-remote-config-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "firebase-remote-config"
}