Releases: holoviz/param
Version 2.1.1
This minor release contains bug fixes for reactive expressions and a few minor documentation improvements. Thanks to @jrycw for their first contribution! And to @ahuang11, @maximlt, and @philippjfr for their continued maintenance and development efforts.
Bug fixes:
- Ensure
rx._callback
resolves accessors (#949) - Ensure refs can be updated by watcher of the same parameter (#929)
- Recursively resolve references on args and kwargs passed to a reactive operation (#944)
- Only override the name of a Parameterized instance on Parameter instantiation when
instantiate=True
(#938)
Documentation:
Maintenance:
- Fix
test_reactive_logic_unary_ops
on Python 3.12 (#946)
Version 2.1.0
This minor release focuses on improving reactive expressions and support for asynchronous (and synchronous) generators. Many thanks to @maximlt, @hoxbro and @philippjfr for their continued maintenance and development efforts.
Enhancements
- Improvements for synchronous and asychronous generators (#908)
- Additions to the .rx namespace including
and_
,bool
,map
,not_
,or_
andupdating
(#906) - Add support for adding asynchronous watcher to
rx
(#917) - Make it possible to resolve reactive expressions recursively with
.rx.resolve
(#918) - Add support for async and generator functions in
.rx.pipe
(#924)
Bug fixes
- Ensure that
.param.update
context manager restore refs (#915) - Avoid overeager root invalidation on
rx
leading to unnecessary evaluation (#919)
Deprecations
- Passing positional arguments to
Parameter
now raises aParamDeprecationWarning
(#921)
Version 2.0.2
This patch release fixes a few bugs and introduces a performance enhancement. Many thanks to @alfredocarella for their first contribution, and to the maintainers @maximlt and @philippjfr for contributing to this release.
Optimization:
- Minor optimizations in hot codepaths accessing class parameters (#893)
Bug fixes:
- Unpack partial callables in
iscoroutinefunction
(#894) - Fix building Param with
setuptools-scm<7
(#903)
Documentation:
Version 2.0.1
This minor release fixes a number of bugs, including a regression introduced by the replacement of the build backend (setuptools
for hatchling
) which led to the doc
folder being wrongly packaged. Many thanks to @SultanOrazbayev for their first contribution, to @musicinmybrain for spotting the regression and submitting fixes, and to the maintainers @hoxbro, @jbednar and @maximlt for contributing to this release.
Bug fixes:
- Do not install
doc
folder in site-packages (#878) - Drop the
feather-format
test dependency (#879) - Add
tables
to thetests-deser
extra (#880) - Fix
_state_push
and_state_pop
(#884) version.py
: new process should not create a window on Windows (#882, #886)- Don't import
setuptools_scm
if the.git
folder doesn't exist (#885)
Documentation:
Version 2.0.0
20 years after its creation, Param has reached version 2.0! Can you guess when Param 3.0 will be released?
Param 2.0 is a major new release available for Python 3.8 and above, significantly streamlining, simplifying, and improving the Param API. Many long-supported but also long-obsolete functions, methods, and usages will now warn loudly so that you can make sure your code is only using the fully supported and safe current approaches. Because upgrading to Param 2 is likely to reveal compatibility issues with older codebases, new releases in the 1.x series are expected to continue for some time, focused on compatibility with the ecosystem rather than adding new features. Thus you can keep using Param 1.x with your older code, but Param 2 is the future!
We would like to thank @minimav for their first contribution, and @droumis, @hoxbro, @jbednar, @maximlt, @philippjfr and @sdrobert for their contributions. We would also like to thank @ceball, who made the first plans for Param 2.0 quite a few years ago, and we are glad to be delivering on them at last!
Major enhancements and features
- Parameter slot values are now all inherited correctly across a hierarchy of Parameterized classes, making their behavior much clearer and more consistent. Let's say we have class
B
being a subclass ofA
, itself being a subclass ofparam.Parameterized
. IfA
definesx = Number(1, bounds=(0, 10))
andB
definesx = Number(2)
,B.param['x'].bounds
is now going to be inherited fromA
and equal to(0, 10)
as you would expect. Parameterized classes have always supported inheritance, but the previous mechanism was based on usingNone
to indicate which values should be inherited, which was highly problematic becauseNone
was also a valid value for many slots. All Parameter slot signatures now default to the newUndefined
sentinel, finally allowingNone
to be inherited where appropriate. (#605, #771, #791, #874) - The
objects
slot of a Selector was previously highly confusing, because it accepted either a dictionary or a list for initialization but then was accessible only as a list, making it difficult to watch or update the objects. There is now aListProxy
wrapper aroundSelector.objects
(with forward and backward compatibility) to easily updateobjects
and watchobjects
updates (#598, #825) - Parameterized classes and instances now have a rich HTML representation that is displayed automatically in a Jupyter/IPython notebook. For a class or instance
p
, just returnp.param
in a notebook cell to see a table of all the Parameters of the class/instance, their state, type, and range, plus the docstring on hover. It is likely we will improve the content and design of this repr based on feedback, so please let us know what you think! (#425, #781, #821, #831) - Parameters have all gained the
allow_refs
andnested_refs
attributes, bringing an exceptionally useful feature that was available in Panel since version 1.2 to Param. Declaring a Parameter withallow_refs=True
(False
by default) allows setting this Parameter value with a reference to automatically mirror the value of the reference. Supported references include class/instance Parameter objects, functions/methods decorated withparam.depends
, reactive functions and expressions, asynchronous generators and custom objects transformed into a valid reference with a hook registered withparam.parameterized.register_reference_transform
.nested_refs
indicate whether references should be resolved even when they are nested inside a container (#843, #845, #849, #865, #862, #876) - Experimental new
rx
reactive expressions: Param is widely used for building web apps in the HoloViz ecosystem, where packages have added various mechanisms for dynamic updates (e.g.pn.bind
andpn.depends
in Panel, and.interactive
in hvPlot). These mechanisms were already built on Param and can be used far more widely than just in those packages, so that functionality has now been generalized, streamlined, and moved into Param. Nearly any Python expression can now be made reactive withparam.rx()
, at which point it will collect and be able to replay any operations (e.g. method calls) performed on them. This reactive programming approach lets you take just about any existing Python workflow and replace attributes with widgets or other reactive values, creating an app with fine-grained user control without having to design callbacks, event handlers, or any other complex logic!rx
support is still experimental while we get feedback about the API, packaging, and documentation, but it's fully ready to try out and give us suggestions!
(#460, #842, #841, #844, #846, #847, #850, #851, #856, #860, #854, #859, #858, #873)
Enhancements
- Parameter slot values that are set to mutable containers (e.g.
Selector(objects=a_list)
) will now be shallow-copied on instantiation, so that the container is no longer confusingly shared between the class and its subclasses and instances (#826) - To further clean up the Parameterized namespace (first started in version 1.7.0), the remaining private attributes haven been collected under two private namespaces
_param__private
and_param__parameters
(#766, #790) - You can now use
.param.update
as a context manager for applying temporary updates (#779) - The
name
Parameter has always had special behavior dating to its use in labeling objects in a GUI context, but this behavior is now able to be overriden at the class and instance level (#740) - Improved Parameter signatures for static and dynamic code analysis (#742)
- Removed inferred Parameterized docstring signature and add basic
__signature__
support (#802) - For speed, only generate the Parameter docstring in an IPython context (#774)
- Improve Parameter validation error messages (#808)
- Support for deserialization of file types into
Array
andDataFrame
(#482) Integer
now acceptsnumpy.integer
values (#735)Range
now does stricter validation of the slot values (#725, #824)Path
now hascheck_exists
attribute, leading it to raise an error ifpath
is not found on parameter instantiation (#800)- Add top-level
__all__
and move Parameter classes toparameters.py
(#853)
Bug fixes
- Allow type change for
DateRange
andDate
(#733) - Ensure class watchers are not inherited by instance parameter (#833)
- Fix multi-level indirection in Parameters access (#840)
- Ensure non-function types are not resolved as empty function declarations (#753)
- Fix watchers support when the Parameterized instance is falsy (#769)
- Fix depending on the method of a sub-parameter object (#765)
- Raise an error on bad non-watched references (#777)
- Ensure that the root dependency can be resolved, and error otherwise (#813)
- Fix basic pickling (#783, #792)
- Validate that
self
is present in the__init__
signature of a Parameterized class (#786) - No longer force
instantiate
to True whenconstant
is True (#776) - Instantiate default Parameter values based on all the Parameters available (#798)
Array
: fixparam.pprint
(#795)Array
: don't hard-codeallow_None
toTrue
(#726)Boolean
: validate the default type ([#722](https://git...
Version 1.13.0
The 1.13.0
is the last release of Param before the 2.0 release. However, Param 1.13 is meant to receive long-term support; security patches and fixes to critical bugs are planned to be backported to the 1.13.x series.
This release includes a new Bytes
Parameter and a few important bug fixes. This release is also marked by the adoption of a formal project governance, ensuring Param's future as a healthy open-source project. Many thanks to @ovidner and @droumis for their first contributions! And to @maximlt, @hoxbro, @jlstevens, @philippjfr and @jbednar for their continuing support to fixing and improving Param.
Bug fixes:
- Fix copying when having watchers on e.g. bounds on inherited Parameter types (#675)
- Allow JSON serialization to work with
json.dumps
(#655) ListSelector
restricted tolist
type objects (#531)- Fix
depends
async wrapper (#684) - Allow named colors to be any case (#711)
New features:
- Add Bytes parameter (#542)
Documentation:
- Fix param module link (#682)
Project governance:
- Create initial project governance docs (#674)
Maintenance:
Version 1.12.3
The 1.12.3
release adds support for Python 3.11. Many thanks to @musicinmybrain (first contribution!) and @maximlt for contributing to this release.
Enhancements:
Version 1.12.2
The 1.12.2 release fixes a number of bugs and adds support again for Python 2.7, which was unfortunately no longer supported in the last release. Note however that Param 2.0 will still drop support of Python 2.7 as already announced. Many thanks to @hoxbro and the maintainers @jbednar, @jlstevens, @maximlt and @philippjfr for contributing to this release.
Bug fixes:
- Match against complete spec name when determining dynamic watchers (615)
- Ensure async functionality does not cause python2 syntax errors (624)
- Allow (de)serializing
CalendarRange
andDateRange
Parameters
(625) - Improve
DateRange
validation (627) - Fix regression in
@param.depends
execution ordering (628) - Ensure
named_objs
does not fail on unhashable objects (632) - Support comparing date-like objects (629)
- Fixed
BinaryPower
example in the docs to use the correct nameEvenInteger
(634)
Version 1.12.1
The 1.12.1 release fixes a number of bugs related to async callback handling when using param.depends
and .param.watch
and a number of documentation and error messages. Many thanks to @hoxbro and the maintainers @jbednar, @jlstevens, @maximlt and @philippjfr for contributing to this release.
Error handling and documentation:
- Fixed description of shared_parameters (#568)
- Improve the error messages of Date and DateRange (#579)
- Clarified step error messages and other docs and links (#604)
Bug fixes:
- Make iscoroutinefunction more robust (#572)
- Fix for handling misspelled parameter (#575)
- Handle None serialization for Date, CalendarDate, Tuple, Array, and DataFrame (#582)
- Support async coroutines in param.depends (#591)
- Handle async functions in depends with watch=True (#611)
- Avoid equality check on Watcher (#612)
Documentation:
Version 1.12.0
Version 1.12.0 introduces a complete user manual and website (for the first time since 2003!) along with extensive API improvements gearing up for the 2.0 release (which will be Python3 only).
The pre-2.0 API is still being preserved and no new warnings are added in this release, so the older API can continue to be used with this release, but the next 1.x release is expected to enable warnings for deprecated API. If you have older code using the deprecated Param features below, please update your API calls as described below to be compatible with the 2.0 release when it comes out (or pin to param<2 if you don't need any new Param features). For new users, just use the API documented on the website, and you should be ready to go for either 1.12+ or 2.0+.
Thanks to James A. Bednar for the user guide and 2.0 API support, to Philipp Rudiger for improvements and new capabilities for handling dependencies on subobjects, and to Maxime Liquet and Philipp Rudiger for extensive improvements to the website/docs/package-building/testing.
New features:
- Added future-facing API for certain Parameterized().param methods (see Compatibility below; #556, #558, #559)
- New option
on_init=True
for@depends
decorator, to run the method in the constructor to ensure initial state is consistent when appropriate (#540) - Now resolves subobject dependencies dynamically, allowing dependencies on internal parameters of subobjects to resolve appropriately as those objects are replaced. (#552)
- Added prettyprinting for numbergen expressions (#525)
- Improved JSON schema generation (#458)
- Added more-usable script_repr command, availabie in param namespace, with default values, and showing imports (#522)
- Added Parameterized.param.pprint(); underlying implementation of script_repr but with defaults suitable for interactive usage rather than generating a .py script. (#522)
- Watchers can now declare precedence so that events are triggered in the desired order (#552, #557)
Bug fixes:
- Fix bug setting attributes in some cases before class is initialized (#544)
- Ensure None is supported on ListSelector (#511)
- Switched from deprecated
inspect.getargspec
to the py3 versioninspect.getfullargspec
, which is similar but splitskeyword
args intovarkw
(**) and kw-only args. Falls back to getargspec on Python2. (#521)
Doc improvements (including complete user guide for the first time!):
- Misc comments/docstrings/docs cleanup (#507, #518, #528, #553)
- Added comparison with pydantic (#523)
- Added new user guide sections:
Infrastructure:
- Added testing on Python 3.10 and on Mac OS X and removed slow PyPy/pandas/numpy tests (#548, #549, #526)
- Docs/tests/build infrastructure improvements (#509, #521, #529, #530, #537, #538, #539, #547, #548, #555)
Compatibility (see #543 for the complete list):
-
Calendardate now accepts date values only (#517)
-
No longer allows modifying name of a Parameter once it is in a Parameterized class, to avoid confusion (#541)
-
Renamed (with old name still accepted for compatibility until 2.0):
.param._add_parameter()
: Now public.param.add_parameter()
; too useful to keep private! (#559).param.params_depended_on
: Now.param.method_dependencies
to indicate that it accepts a method name and returns its dependencies (#559).pprint
: Now private._pprint
; use public.param.pprint
instead (#559)batch_watch
: Nowbatch_call_watchers
, to declare that it does not set up watching, it just invokes it. Removed unused operation argument (#536)
-
Deprecated (but not yet warning unless noted):
.param.debug()
: Use.param.log(param.DEBUG, ...)
instead (#556).param.verbose()
: Use.param.log(param.VERBOSE, ...)
instead (#556).param.message()
: Use.param.log(param.MESSAGE, ...)
instead (#556).param.defaults()
: Use{k:v.default for k,v in p.param.objects().items()}
instead (#559).param.deprecate()
: To be repurposed or deleted after 2.0 (#559).param.params()
: Use.param.values()
or.param['param']
instead (#559).param.print_param_defaults()
: Usefor k,v in p.param.objects().items(): print(f"{p.__class__.name}.{k}={repr(v.default)}")
instead (#559).param.print_param_values()
: Usefor k,v in p.param.values().items(): print(f"{p.name}.{k}={v}")
instead (#559).param.set_default()
: Usep.param.default=
instead (#559).param.set_param()
: Had tricky API; use.param.update
instead (#558).param.get_param_values()
: Use.param.values().items()
instead (or.param.values()
for the common case ofdict(....param.get_param_values())
) (#559).state_pop()
: Will be renamed to._state_pop
to make private.state_push()
: Will be renamed to._state_push
to make private.initialized
: Will be renamed to._initialized
to make private- Most methods on Parameterized itself have already been deprecated and warning for some time now; see #543 for the list. Use the corresponding method on the
.param
accessor instead.
-
Added:
.param.watchers
: Read-only version of private_watchers
(#559).param.log()
: Subsumes .debug/verbose/message; all are logging calls. (#556).param.update()
: Dictionary-style updates to parameter values, as a drop-in replacement forset_param
except for its optional legacy positional-arg syntax (#558).values()
: Dictionary of name:value pairs for parameter values, replacingget_param_values
but now a dict since python3 preserves order (#558).param.log()
: General-purpose interface to the logging module functionailty; replaces .debug, .verbose, .message (#556)