Changelogs » Paramtools

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

Paramtools

27347.36

[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]
  ...: )
  Out[3]:

13673.68

{'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):
  python
  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):
  
  python
  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
  Out[3]:
  [{'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}]

0.0025

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:
  params.delete(
  {
  "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):
  python
  Select standard_deduction values in years 2014 and 2015
  In [2]: params.to_array("standard_deduction", year=[2014, 2015])
  Out[2]:

0.15.0

- 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)

0.14.2

- Fix deserialization bug. (109)

0.14.1

- 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)

0.14.0

- 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):
  
  python
  Update extension rules:

0.13.1

- 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)

0.13.0

- 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)

0.12.0

- Streamline steps to add custom types with a new [`register_custom_type`](https://paramtools.dev/api/custom-types/) 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](https://squidfunk.github.io/mkdocs-material/), add the beginnings of an API reference page using [`mkautodoc`](https://github.com/tomchristie/mkautodoc), and move the docs website to https://paramtools.dev (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)

0.11.1

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

0.11.0

- Add a warnings distinction to validators. By default, validators throw errors, but you may specify that they emit warnings instead (86):
  json
  "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](https://github.com/PSLmodels/Tax-Cruncher) social security parameter (81):
  
  json
  {
  "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)

0.10.3

- 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)

0.10.2

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

0.10.1

- 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)

0.10.0

- 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)

0.9.0

- 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](https://paramtools.org/api/custom-adjust/) to learn more. (70)
  - Enhancements and bug fixes for the `extend` method. (71)

0.8.0

- 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](https://paramtools.org/api/indexing/). (65)

0.7.3

- Make updates for Marshmallow 3 compatibility. (68)

0.7.2

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

0.7.1

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

0.7.0

- 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)

0.6.0

- 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](https://paramtools.org/api/extend/) to learn more about this feature. (58)
  - Add [API guide](https://paramtools.org/api/guide/). (58, 59)

0.5.4

- Preserve order of parameters. (7a4f949d4adabe0eab47e4627452bcf01b07bdcc)

0.5.3

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

0.5.2

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

0.5.1

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

0.5.0

- 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 [paramtools.org](https://paramtools.org)

0.4.1

- Adds several example config piles to `MANIFEST.in` (42).

0.4.0

- Promotes the tax parameters to be the prominent example in the documentation (35).
  - Behavior-Responses parameter example and cleaner error messages (37).
  - Add ability to delete parameter value objects by setting their value to `None` (38).
  - Fix a bug where a parameter name specified in the defaults collides with a name used by the `Parameters` class (39).
  - Use conda to set up the paramtools development environment and for packaging (41).

0.3.3

This release improves the format of the README files and adds fields and validator documentation.

0.3.2

ParamTools 0.3.2 contains a bug fix that specifies that the data files should be included in the ParamTools package.

0.3.1

ParamTools 0.3.1 contains a bug fix that stores the example JSON config files in the ParamTools package. This way, the examples work correctly without extra configuration.