Changelogs » Paramtools

PyUp Safety actively tracks 316,954 Python packages for vulnerabilities and notifies you when to upgrade.



[13673.68, 27347.36]])
  Convert standard_deduction values to a numpy array and back to a list of value objects:
  In [3]: params.from_array(
  ...:     "standard_deduction",
  ...:     params.to_array("standard_deduction", year=[2014, 2015]),
  ...:     year=[2014, 2015]
  ...: )


{'year': 2014, 'marital_status': 'joint', 'value': 27347.36},
  {'year': 2015, 'marital_status': 'single', 'value': 13673.68},
  {'year': 2015, 'marital_status': 'joint', 'value': 27347.36}]
  - Bug fix for overriding the `ops` values like `array_first` or `label_to_extend` when initializing a `Parameters` instance (104):
  params = Params(array_first=False, label_to_extend=None)
  - Fixes bug in `sort_values` method that occurs when using it in conjunction with `set_state` (106):
  In [1]: from taxcalc import Policy
  ...: pol = Policy(array_first=False)
  ...: pol.select_eq("STD", strict=False, year=[2021])
  ...: pol.set_year([2018, 2019, 2020, 2021])
  In [2]: d = pol.sort_values()
  In [3]: pol.STD
  [{'MARS': 'single', 'value': 12000.0, 'year': 2018},
  {'MARS': 'mjoint', 'value': 24000.0, 'year': 2018},
  {'MARS': 'mseparate', 'value': 12000.0, 'year': 2018},
  {'MARS': 'headhh', 'value': 18000.0, 'year': 2018},
  {'MARS': 'widow', 'value': 24000.0, 'year': 2018},
  {'MARS': 'single', 'value': 12200.0, 'year': 2019},
  {'MARS': 'mjoint', 'value': 24400.0, 'year': 2019},
  {'MARS': 'mseparate', 'value': 12200.0, 'year': 2019},
  {'MARS': 'headhh', 'value': 18350.0, 'year': 2019},
  {'MARS': 'widow', 'value': 24400.0, 'year': 2019},
  {'MARS': 'single', 'value': 12392.76, 'year': 2020, '_auto': True},
  {'MARS': 'mjoint', 'value': 24785.52, 'year': 2020, '_auto': True},
  {'MARS': 'mseparate', 'value': 12392.76, 'year': 2020, '_auto': True},
  {'MARS': 'headhh', 'value': 18639.93, 'year': 2020, '_auto': True},
  {'MARS': 'widow', 'value': 24785.52, 'year': 2020, '_auto': True},
  {'MARS': 'single', 'value': 12662.92, 'year': 2021, '_auto': True},
  {'MARS': 'mjoint', 'value': 25325.84, 'year': 2021, '_auto': True},
  {'MARS': 'mseparate', 'value': 12662.92, 'year': 2021, '_auto': True},
  {'MARS': 'headhh', 'value': 19046.28, 'year': 2021, '_auto': True},
  {'MARS': 'widow', 'value': 25325.84, 'year': 2021, '_auto': True}]


for year, rate in params.index_rates.items():
  params.index_rates[year] = rate + offset
  Select automatically created values:
  automatically_added = params.select_eq(
  "standard_deduction", strict=True, _auto=True
  Delete automatically created values and replace using the new rules:
  "standard_deduction": automatically_added
  - Add a `clobber` argument to the `adjust` method that allows you to toggle whether user-defined values should be overridden while doing an adjustment in extend mode. (102)
  - Bug fixes for corner cases in logic for extending parameter values. (103)
  - API change in `extend` method to use more concise keyword arguments. The argument `label_to_extend` is now `label` and the `label_to_extend_values` is now `label_values`. (103)
  - Ability to specify the state to be used when converting between lists of value objects and arrays (105):
  Select standard_deduction values in years 2014 and 2015
  In [2]: params.to_array("standard_deduction", year=[2014, 2015])


- Fix bug when using a `when` validator with `defer_validation`. (127)


- Allow comments in JSON files. (124)
  In [1]: import paramtools
  In [2]: s = """// this is my json file
  ...: // more comments here
  ...: /*
  ...: multi line comments?
  ...: */
  ...: {
  ...:     "hello": "world",
  ...:     "allows_urls": ""
  ...: }"""
  In [3]: paramtools.read_json(s)
  OrderedDict([('hello', 'world'),
  ('allows_urls', '')])


- Add `transaction` method for multi-stage updates. (123)
  ![Screenshot from 2021-01-25 17-53-08](
  - Use Github Actions for CI. (123)


- New API for querying parameter values:
  ![Screenshot from 2020-10-28 11-00-59](
  - Improvements for querying custom/nested values:
  ![Screenshot from 2020-10-28 11-02-22](


- Fix several ordering bugs affecting the order of schema vs parameter names in the output of `Parameters.dump` and the order of keys in value objects. (115)
  - Expose argument to use the labels set in the `state` of the `Parameters` instance when selecting which values to include when calling `Parameters.dump`. (115)
  - Use most up-to-date operator values when dumping a Parameter values to JSON. (118)


- Use `fsspec` to support a rich variety of inputs sources from local JSON files to files stored on GitHub, S3, or Google Cloud Storage. (111, 113)


- Fix deserialization bug. (109)


- Perfomance improvements to `extend` functionality. (107)
  - Bug fix for `sort_values` that caused an error when calling `dump` on a `Parameters` instance that does not specify any labels. (108)


- Add the `_auto` attribute to parameter values that were extended automatically. This make it possible to update the rules for how parameters should be extended, delete the extended values, and update with the new rules (102):
  Update extension rules:


- Make integer validation strict so that floats are now invalid. (98)
  - Fixes bug where errors were not raised when passing a list value to a non-list parameter. (99)
  - Fix error messages for labels. (100)


- Add `delete` method for removing a parameter's value objects. (95)
  - Round out select module with the `select_lte` and `select_gte` functions. (96)
  - Makes `exact_match` keyword on `Parameters.select_*` methods optional. (96)
  - Fixes bug where `select_lt` was left out of top-level import. (96)


- Streamline steps to add custom types with a new [`register_custom_type`]( function. This makes it easy to register a custom type that can be used through out the `defaults` config file. (#93)
  - Add ability to select value objects based on whether a label is less than or equal to some value with the new `select_lt` function. (90)
  - Update the docs website with a slick new theme from [Material for MkDocs](, add the beginnings of an API reference page using [`mkautodoc`](, and move the docs website to (#94)
  - Removes warnings that are shown when adjusting a value for a parameter that is not active in the current state of the `Parameters` instance. (91)


- Bug fix for custom fields. This feature was accidentally removed in 72. (89)


- Add a warnings distinction to validators. By default, validators throw errors, but you may specify that they emit warnings instead (86):
  "range": {"min": 0, "max": 10, "level": "warn"}
  - Adds a new `when` validator, that allows you to specify complex conditional validation logic. Here's an example using [Tax-Cruncher's]( social security parameter (#81):
  "when": {
  "param": "spouse_age",
  "is": {"less_than": 65},
  "then": {
  "when": {
  "param": "primary_age",
  "is": {"less_than": 65},
  "then": { "range": {"min": 0, "max": 0} },
  "otherwise": { "range": {"min": 0, "max": 9e99} }
  "otherwise": { "range": {"min": 0, "max": 9e99} }
  - A bug fix for the `sort_values` method and its usage in `dump`. (87)


- Add a `sort_values` method for to re-order value objects that may get shuffled after operations like `extend` or `adjust`. The `dump` method now ensures that the results are sorted by default. (84, 85)


- Rename "actions" to "operators". (83)
  - Fix handling of scalar parameters when `array_first` is true. (80)


- Fix bug where array parameters could not be adjusted when `array_first` is `True`. (76)
  - Add `to_dict` method that returns a `Parameters` instance as a Python dictionary. (76)


- The "schema" object in `defaults` now undergoes comprehensive validation. (72)
  - A new "operators" member is added to the "schema" object in `defaults`. Operators are variables like `label_to_extend` or `array_first` which tell ParamTools how a `defaults` object should be loaded. This makes it easier to dump the data for a Parameters instance in one place and load it in another. (73)
  -  A new approach to doing searches and updates brings performance improvements. (74)
  - The `Parameters` class supports iteration similar to Python dictionaries. (75)


- Make it easier to customize the `adjust` method. This allows projects to use custom adjustment formats or apply custom logic. Checkout the [custom adjustment docs]( to learn more. (#70)
  - Enhancements and bug fixes for the `extend` method. (71)


- Add out-of-the-box parameter indexing. This is helpful for projects that have parameters that change at some rate over time. For more information, checkout the [indexing docs]( (#65)


- Make updates for Marshmallow 3 compatibility. (68)


- Update custom fields for Marshmallow 3.0.0rc7 API changes. (66)


- Bug fixes related to extend capability and its interactions with the `Parameters` instance's state. (63)


- Apply extend capability to user adjustments. (60)
  - Add flexibility to the `Parameters.extend` by extending at the value object level instead of the `label_to_extend` value level. (60)
  - Refactor `Parameters._select` method into the `select` module. This refactor allows the user to implement custom comparison functions similar to what can be done with `pandas.DataFrame.loc`. (60)


- Add array extension capability. This is helpful for filling out a parameter's values without having to specify redundant data in `defaults.json`. Check out the [extend docs]( to learn more about this feature. (#58)
  - Add [API guide]( (#58, 59)


- Preserve order of parameters. (7a4f949d4adabe0eab47e4627452bcf01b07bdcc)


- Add serializable flag to specification method. (54)
  - Rename schema 'builder' to schema 'factory.' (55)


- Fixes bug where the original `defaults` dictionary was modified by a `pop` command. 53


- Make "validators" and "additional_parameters" optional. (52)


- Drop `schema.json`, and move it into a top-level `schema` member in `defaults.json`. (49)
  - Rename `dims` to `labels`. (47)
  - Rename `optional`—>`additional_members`. (49)
  - Set a default value of zero for `number_dims` . (44)
  - Handle simple parameter values. (45)
  - Revamp documentation. (51)
  - Documentation is now hosted at [](