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)