{"id":28255,"library":"sppl","title":"SPPL (Sum-Product Probabilistic Language)","description":"SPPL is a probabilistic programming language for specifying and manipulating sum-product expressions. Version 2.0.4 targets Python >=3.8. The library enables concise modeling of discrete and continuous random variables with automatic inference.","status":"active","version":"2.0.4","language":"python","source_language":"en","source_url":"https://github.com/probcomp/sppl","tags":["probabilistic-programming","sum-product","inference","graphical-models","bayesian"],"install":[{"cmd":"pip install sppl","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Core numerical operations","package":"numpy","optional":false},{"reason":"Statistical distributions and optimization","package":"scipy","optional":false},{"reason":"Symbolic mathematics for expression manipulation","package":"sympy","optional":false}],"imports":[{"note":"SPPLDistribution is in the distributions submodule.","wrong":"from sppl import SPPLDistribution","symbol":"SPPLDistribution","correct":"from sppl.distributions import SPPLDistribution"},{"note":"Direct import from the top-level package.","symbol":"Model","correct":"from sppl import Model"},{"note":"Direct import from the top-level package.","symbol":"Variable","correct":"from sppl import Variable"}],"quickstart":{"code":"from sppl import Model, Variable\nfrom sppl.distributions import SPPLDistribution\nimport os\n\n# Define a simple model: flip a fair coin\nmodel = Model()\nwith model:\n    x = Variable('x', SPPLDistribution.bernoulli(0.5))\n\n# Check the model structure\nprint(model)\n","lang":"python","description":"Creates a simple probabilistic model with a Bernoulli variable."},"warnings":[{"fix":"Update imports: use 'from sppl.distributions import SPPLDistribution' instead of 'from sppl import SPPLDistribution'.","message":"In version 2.0.0, the package structure changed: distributions are now in 'sppl.distributions' submodule, not directly under 'sppl'.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Replace 'Distribution' with 'SPPLDistribution' in your code.","message":"The function 'sppl.distributions.Distribution' is deprecated in favor of 'SPPLDistribution'.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always use 'with model:' context manager when defining variables.","message":"Model variables must be defined inside a 'with model:' block, otherwise they are not added to the model.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from sppl.distributions import SPPLDistribution'","cause":"Trying to import SPPLDistribution from the top-level sppl package instead of the submodule.","error":"ImportError: cannot import name 'SPPLDistribution' from 'sppl'"},{"fix":"Use the new API: see the documentation for accessing the distribution from a Variable.","cause":"Accessing .distribution attribute that was renamed or restructured.","error":"AttributeError: 'Variable' object has no attribute 'distribution'"},{"fix":"Ensure you pass the distribution as the second argument to Variable: Variable('name', distribution).","cause":"Creating Variable without providing the distribution argument correctly.","error":"TypeError: __init__() missing 1 required positional argument: 'dist'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}