FLEXvalue

raw JSON →
2.0.8 verified Fri May 01 auth: no python

FLEXvalue is a Python library for calculating avoided costs, commonly used in energy efficiency and demand-side management. Version 2.0.8 is the latest, with maintenance-oriented updates. Release cadence is irregular, driven by method updates.

pip install flexvalue
error ImportError: cannot import name 'FlexValue' from 'flexvalue'
cause The class name changed to 'Flexvalue' (lowercase v) in version 2.0.0.
fix
Use 'from flexvalue import Flexvalue' (note the lowercase v).
error TypeError: calculate() got an unexpected keyword argument 'fuel_cost'
cause Parameter name changed from 'fuel_cost' to 'fuel_price' in version 2.0.0.
fix
Update the keyword argument to 'fuel_price' (see documentation for exact parameter names).
breaking In version 2.0.0, the main class was renamed from 'FlexValue' to 'Flexvalue' (lowercase 'v'). Old code using 'FlexValue' will raise an ImportError.
fix Change import to 'from flexvalue import Flexvalue' and replace all 'FlexValue' references with 'Flexvalue'.
gotcha The calculate() method parameters changed in 2.0.0. Old code using positional arguments may silently produce wrong results if order changed. Always use keyword arguments.
fix Always call calculate() with explicit keyword arguments, e.g., calculate(fuel_price=..., discount_rate=..., ...).
deprecated The function 'avoided_cost' (lowercase, module-level) is deprecated since 1.5.0 and removed in 2.0.0. Use the class-based API instead.
fix Replace 'from flexvalue import avoided_cost' with 'from flexvalue import Flexvalue' and use the object-oriented approach.

Basic usage: import Flexvalue, create an instance with default parameters, and call calculate() with required inputs.

from flexvalue import Flexvalue

# Initialize with configuration (adjust parameters as needed)
fv = Flexvalue()

# Calculate avoided costs for a given scenario
result = fv.calculate(
    fuel_price=0.05,          # $/kWh
    discount_rate=0.03,       # 3%
    lifetime_years=10,
    annual_savings_kwh=10000
)
print(result)