Sciris

Latest version: v3.2.0

Safety actively analyzes 681866 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 6

3.2.0

--------------------------

New features
~~~~~~~~~~~~
. :func:`sc.loadany() <sc_fileio.loadany>` will try to load a file using any of the known formats (pickle, JSON, YAML, Excel, CSV, zip, or plain text).
. :func:`sc.sem() <sc_math.sem>` calculates the standard error of the mean.
. :func:`sc.sigfiground() <sc_printing.sigfiground>` rounds an array to a specified number of significant figures.
. :class:`sc.tracecalls() <sc_profiling.tracecalls>` traces every function call within a context block (alias to ``sys.setprofile``).
. :func:`sc.isfunc() <sc_utils.isfunc>` checks whether something is a function (or a class method).
. :class:`sc.dataframe() <sc_dataframe.dataframe>` now has an :func:`addcol() <sc_dataframe.dataframe.addcol>` method, which adds one or more columns to the dataframe.
. :class:`sc.dataframe() <sc_dataframe.dataframe>` now has an :func:`enumrows() <sc_dataframe.dataframe.enumrows>` method, which is similar to :func:`pd.iterrows() <pandas.iterrows>`, but up to 50x faster.

Bugfixes
~~~~~~~~
. Previously, :func:`sc.importbypath() <sc_utils.importbypath>` would sometimes fail to import a module correctly if a module with the same name was already imported. This has been fixed.
. Previously, :func:`sc.inclusiverange() <sc_math.inclusiverange>` would stretch steps in order to exactly match ``start`` and ``stop`` (e.g., ``sc.inclusiverange(0,10,3)`` would stretch the step to ``3.333``). It now defaults to not stretching the step. Previous behavior can be restored via ``sc.inclusiverange(..., stretch=True).
. Previously, in:func:`sc.parallel() <sc_parallel.parallel>`, specifying ``interval`` without also specifying ``maxcpu`` had no effect. Now it will still schedule the jobs on intervals, but with ``maxcpu=1.0`` by default.

Other changes
~~~~~~~~~~~~~
. :func:`sc.makenested() <sc_nested.makenested>` and :func:`sc.setnested() <sc_nested.setnested>` are now more flexible and can operate on objects. (Thanks to `Kelvin Burke <https://github.com/kelvinburke>`_ for this feature.)
. :func:`sc.search() <sc_nested.search>` has been completely rewritten, and can now be used to e.g. find objects of a certain type in another object.
. :func:`sc.datedelta() <sc_datetime.datedelta>` can now handle fractional years.
. :func:`sc.datetoyear() <sc_datetime.datetoyear>` now has a ``reverse`` argument for converting years to dates.
. :func:`sc.profile() <sc_profiling.profile>` now allows modules and classes to be followed, not just functions.
. :func:`sc.uniquename() <sc_utils.uniquename>` now has ``human`` (more verbose) and ``suffix`` (positioned after the counter) arguments.
. :func:`sc.objatt() <sc_printing.objatt>`, :func:`sc.objmeth() <sc_printing.objmeth>`, and :func:`sc.objprop() <sc_printing.objprop>` all now have a ``return_keys`` argument.
. :func:`sc.sha() <sc_utils.sha>` now has an ``asint`` argument for converting the digest to an integer.
. Imports have been changed: Sciris internally uses absolute rather than relative imports, and ``pylab`` has been replaced with ``matplotlib.pyplot``. These should not impact the user, but improves load time.

3.1.7

--------------------------
. Updated :func:`sc.asd() <sc_asd.asd>` to handle negative values in the objective function. (Thanks to `Eloisa Perez-Bennetts <https://github.com/epbennetts>`_ for this feature.)
. Updated :class:`sc.cprofile() <sc_profiling.cprofile>` with new display options, including a ``maxitems`` argument.
. Improved :func:`sc.jsonify() <sc_fileio.jsonify>`, including custom and recursive object parsing.
. Fixed a bug preventing :class:`sc.odict.copy() <sc_odict.odict>` from being sorted by a specified order.
. Fixed a bug in :func:`sc.getrowscols() <sc_plotting.getrowscols>` that raised an exception when called with ``n=1``.
. :meth:`sc.options.use_style() <sc_settings.ScirisOptions.use_style>` now resets the style before applying a new one.

3.1.6

--------------------------
. Added a new profiler, :class:`sc.cprofile() <sc_profiling.cprofile>`, as an interface to Python's built-in `cProfile <https://docs.python.org/3/library/profile.html>`_.
. Updated :func:`sc.iterobj() <sc_nested.iterobj>` to include several new arguments: ``skip`` will skip objects to avoid iterating over; ``depthfirst`` switches between depth-first (default) and breadth-first (new) iteration options; ``flatten`` returns object traces as strings rather than tuples; and ``to_df`` converts the output to a dataframe.
. Pretty-repr functions and classes (e.g. :func:`sc.pr() <sc_printing.pr>`, :class:`sc.prettyobj() <sc_printing.prettyobj>`) now include protections against infinite recursion. ``sc.prettyobj()`` was linked back to ``sc.sc_utils`` to prevent unpickling errors (partially reversing the change in version 3.1.4).
. :class:`sc.dictobj.copy() <sc_odict.dictobj>` now returns another ``dictobj`` (previously it returned a ``dict``).
. :func:`sc.require() <sc_versioning.require>` has been reimplemented to be faster and avoid ``pkg_resources`` deprecations.

3.1.5

--------------------------
. Added a new :class:`sc.quickobj() <sc_printing.quickobj>` class, which is like :class:`sc.prettyobj() <sc_printing.prettyobj>` except it only prints attribute names, not values. This is useful for large objects that can be slow to print.
. :func:`sc.pr() <sc_printing.pr>` has a new ``vals=False`` argument that skips printing attribute values. The default column width was also increased (from 18 to 22 chars).
. A new function :func:`sc.ifelse() <sc_utils.ifelse>` was added, which is a shortcut to finding the first non-``None`` (or non-``False``) value in a list.
. Updated :func:`sc.iterobj() <sc_nested.iterobj>` to prevent recursion, and to handle atomic classes (i.e. objects that are not descended into) more flexibly.

3.1.4

--------------------------
. Fixed failures of pretty-repr (e.g. :func:`sc.pr() <sc_printing.pr>` and :class:`sc.prettyobj() <sc_printing.prettyobj>`) for objects with invalid properties (e.g., properties that rely on missing/invalid attributes). ``sc.prettyobj()`` was also moved from ``sc_utils`` to ``sc_printing``.
. Added additional flexibility for loading zip files (:func:`sc.loadzip() <sc_fileio.loadzip>`); saving zip files (:func:`sc.savezip() <sc_fileio.savezip>`) now saves text as plain text even with ``tobytes=True``.
. :func:`sc.dcp(die=False) <sc_utils.dcp>` now passes ``die=False`` to :func:`sc.cp() <sc_utils.cp>`, and will return the original object if it cannot be copied.
. :func:`sc.urlopen() <sc_utils.urlopen>` now has additional response options, including ``'json'`` and ``'full'``.

3.1.3

--------------------------
. :func:`sc.equal() <sc_nested.equal>` now parses the structure of all objects (not just the first), with missing keys/attributes listed in the output table. It also now allows for a ``detailed=2`` argument, which prints the value of each key/attribute in each object. (Thanks to `Kelvin Burke <https://github.com/kelvinburke>`_ for this and other features.)
. Fixed incorrect keyword arguments (``iterkwargs``) in :func:`sc.parallelize() <sc_parallel.parallelize>` when using ``thread`` or another non-copying parallelizer, when the ``iterkwargs`` are *not* consistent between iterations.
. Fixed incorrect printout on the final iteration of :func:`sc.asd() <sc_asd.asd>` in verbose mode.
. Fixed incorrect plotting of non-cumulative data in :func:`sc.stackedbar() <sc_plotting.stackedbar>`.
. :func:`sc.download(..., save=False) <sc_utils.download>` now returns an :class:`sc.objdict <sc_odict.objdict>` (instead of an :class:`sc.odict <sc_odict.odict>`).
. :func:`sc.checktype(obj, 'arraylike') <sc_utils.checktype>` is now more robust to handling non-array-like objects (e.g., a ragged list of lists now returns ``False`` instead of raising an exception).
. :func:`sc.require() <sc_versioning.require>` now takes an optional ``message`` argument, allowing for a custom message if the requirement(s) aren't met.
. Removed ``object`` from the list of classes shown by :func:`sc.prepr() <sc_printing.prepr>` (since all objects derive from ``object``).

Page 1 of 6

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.