Registry / crm-productivity / powerfx

powerfx

JSON →
library0.0.34pypiunverified

The `powerfx` Python library (current version 0.0.34) acts as a bridge to invoke the C# implementation of Microsoft Power Fx, a low-code, general-purpose programming language. It enables Python applications to evaluate Power Fx expressions. This library is actively maintained by Microsoft and sees releases periodically, often tied to updates within the broader Power Platform ecosystem.

pip install powerfx
INSTALL
IMPORT
SIG · POWERFX
P
powerfx
crm-productivityenv0.0.34
Install
2.0s avg
Import
Disk
29MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.34 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.1s
py 3.11
✓ —
✓ 2.1s
py 3.12
✓ —
✓ 1.9s
py 3.13
✓ —
✓ 1.9s
py 3.9
✕ build_error
✕ build_error
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Engine
from powerfx import Engine
The `Engine` class is the primary entry point for evaluating Power Fx expressions.

This quickstart demonstrates how to initialize the `powerfx.Engine`, register Python objects as host objects, and evaluate Power Fx expressions. It includes an example of string concatenation and a conditional statement. Note the crucial importance of a correctly installed and discoverable .NET runtime for `powerfx` to function.

import os from powerfx import Engine # Ensure DOTNET_ROOT is set if .NET runtime is not in standard paths # Example: os.environ['DOTNET_ROOT'] = '/usr/local/share/dotnet' # Initialize the Power Fx engine engine = Engine() # Define variables that can be used in Power Fx expressions engine.add_host_object('Name', 'Alice') engine.add_host_object('Age', 30) # Evaluate a simple Power Fx expression expression = '"Hello " & Name & ", you are " & Text(Age) & " years old!"' result = engine.eval(expression) print(f"Power Fx Expression: {expression}") print(f"Result: {result.to_string()}") # Example with a conditional expression conditional_expression = 'If(Age >= 18, "Adult", "Minor")' conditional_result = engine.eval(conditional_expression) print(f"\nPower Fx Conditional Expression: {conditional_expression}") print(f"Conditional Result: {conditional_result.to_string()}")
Debug
Known issues
breakingThe `powerfx` library is a Python bridge to a C# implementation. Major updates to the underlying Power Fx language or the C# runtime it depends on may introduce breaking changes not directly reflected in the Python package versioning.
fix
Always check the official Microsoft Power Fx documentation and any related .NET/C# interop documentation for compatibility. Pin `powerfx` versions in production environments.
affects: All versions
gotchaRequires .NET Runtime: The `powerfx` Python package will not function without a compatible .NET runtime installed and correctly configured on the system. This is a common point of failure for users.
fix
Ensure the appropriate .NET SDK or runtime is installed for your operating system (e.g., via `sudo apt install dotnet-sdk-8.0` on Linux, or `brew install --cask dotnet-sdk` on macOS). Set the `DOTNET_ROOT` environment variable if the runtime is not in a standard location.
affects: All versions
gotchaPower Fx is a declarative, Excel-like language. Trying to use it with imperative Python programming paradigms or expecting direct object manipulation as in Python will lead to unexpected results. It's not a Pythonic library in its core logic.
fix
Familiarize yourself with Power Fx language concepts and syntax, which are distinct from Python. Use the `powerfx.Engine` for evaluating Power Fx expressions, not as a general-purpose Python utility library.
affects: All versions
Errors
Common errors & fixes
RuntimeError: Can not determine dotnet root
The `pythonnet` library, used by `powerfx` to bridge to the C# implementation, cannot locate the .NET runtime installation on your system.
fix
Install the .NET SDK or runtime for your operating system and architecture. If it's not installed in a default path, set the `DOTNET_ROOT` environment variable to the path where .NET is installed (e.g., `export DOTNET_ROOT=/usr/local/share/dotnet`).
FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=..., Culture=neutral, PublicKeyToken=...' or one of its dependencies.
This typically indicates an incompatibility between the installed .NET runtime and the version of the `powerfx` library's C# components, or a corrupted .NET installation.
fix
Verify that your .NET runtime version is compatible with the `powerfx` library. Try updating your .NET runtime to the latest stable version or reinstalling it. Also, consider reinstalling `powerfx` and its dependencies (`pip uninstall powerfx pythonnet` then `pip install powerfx`).
Upgrade
Version history
0.0.34latest on PyPI · released Dec 22, 2025
Audit
Dependencies
pythonnetrequiredThe `powerfx` library is a C# bridge and relies on `pythonnet` to interoperate with the .NET runtime. This is an implicit dependency and often causes runtime errors if the .NET runtime is not correctly configured.
dotnet-runtimerequiredAs a bridge to a C# implementation, `powerfx` requires a compatible .NET runtime to be installed and accessible on the system. Without it, the library will fail to initialize.
Agent activity
40 hits · last 30 days
node
36
OpenAI (training)
1
Resources

No resource links recorded.