Upgrading

From v2.x.x to v3.0.0

There were several breaking changes in v3.0.0:

  • Make to_string convert None to empty string. (breaking change)
  • Make the following functions work with empty strings and None: (breaking change)
    • camel_case
    • capitalize
    • chars
    • chop
    • chop_right
    • class_case
    • clean
    • count_substr
    • decapitalize
    • ends_with
    • join
    • js_replace
    • kebab_case
    • lines
    • quote
    • re_replace
    • replace
    • series_phrase
    • series_phrase_serial
    • starts_with
    • surround
  • Reorder function arguments for after from (n, func) to (func, n). (breaking change)
  • Reorder function arguments for before from (n, func) to (func, n). (breaking change)
  • Reorder function arguments for times from (n, callback) to (callback, n). (breaking change)
  • Reorder function arguments for js_match from (reg_exp, text) to (text, reg_exp). (breaking change)
  • Reorder function arguments for js_replace from (reg_exp, text, repl) to (text, reg_exp, repl). (breaking change)

And some potential breaking changes:

  • Move arrays.join to strings.join (possible breaking change).
  • Rename join/implode‘s second parameter from delimiter to separator. (possible breaking change)
  • Rename split/explode‘s second parameter from delimiter to separator. (possible breaking change)

Some notable new features/functions:

Late Value Chaining

The passing of the root value argument for chaining can now be done “late” meaning that you can build chains without providing a value at the beginning. This allows you to build a chain and re-use it with different root values:

>>> from pydash import py_

>>> square_sum = py_().power(2).sum()

>>> [square_sum([1, 2, 3]), square_sum([4, 5, 6]), square_sum([7, 8, 9])]
[14, 77, 194]

See also

  • For more details on method chaining, check out Method Chaining.
  • For a full listing of changes in v3.0.0, check out the Changelog.

From v1.x.x to v2.0.0

There were several breaking and potentially breaking changes in v2.0.0:

  • pydash.arrays.flatten() is now shallow by default. Previously, it was deep by default. For deep flattening, use either flatten(..., is_deep=True) or flatten_deep(...).
  • pydash.predicates.is_number() now returns False for boolean True and False. Previously, it returned True.
  • Internally, the files located in pydash.api were moved to pydash. If you imported from pydash.api.<module>, then it’s recommended to change your imports to pull from pydash.
  • The function functions() was renamed to callables() to avoid ambiguities with the module functions.py.

Some notable new features:

  • Callback functions no longer require the full call signature definition. See Callbacks for more details.
  • A new “_” instance was added which supports both method chaining and module method calling. See py_ Instance for more details.

See also

For a full listing of changes in v2.0.0, check out the Changelog.