Sciris

Latest version: v3.2.0

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

Scan your dependencies

Page 3 of 6

2.0.3

--------------------------
. Added ``sc.linregress()`` as a simple way to perform linear regression (fit a line of best fit).
. Improved ``sc.printarr()`` formatting.
. Reverted incompatibility with older Matplotlib versions introduced in version 2.0.2.

2.0.2

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

Parallelization
~~~~~~~~~~~~~~~
. The default parallelizer has been changed from ``multiprocess`` to ``concurrent.futures``. The latter is faster, but less robust (e.g., it can't parallelize lambda functions). If an error is encountered, it will automatically fall back to the former.
. For debugging, instead of ``sc.parallelize(..., serial=True)``, you can also now use ``sc.parallelize(..., parallelizer='serial')``.
. Arguments to ``sc.parallelize()`` are now no longer usually deepcopied, since usually they are automatically during the pickling/unpickling process. However, deepcopying has been retained for ``serial`` and ``thread`` parallelizers; to *not* deepcopy, use e.g. ``parallelizer='thread-nocopy'``.

Bugfixes
~~~~~~~~
. ``sc.autolist()`` now correctly handles input arguments, and can be added on to other objects. (Previously, if an object was added to an ``sc.autolist``, it would itself become an ``sc.autolist``.)
. ``sc.cat()`` now has the same default behavior as ``np.concatenate()`` for 2D arrays (i.e., concatenating rows). Use ``sc.cat(.., axis=None)`` for the previous behavior.
. ``sc.dataframe.from_dict()`` and ``sc.dataframe.from_records()`` now return an ``sc.dataframe`` object (previously they returned a ``pd.DataFrame`` object).

Other changes
~~~~~~~~~~~~~
. ``sc.dataframe.cat()`` will concatenate multiple objects (dataframes, arrays, etc.) into a single dataframe.
. ``sc.dataframe().concat()`` now by default does *not* modify in-place.
. Colormaps are now also available with a ``sciris-`` prefix, e.g. ``sciris-alpine``, as well as their original names (to avoid possible name collisions).
. Added ``packaging`` as a dependency and removed the (deprecated) ``minimal`` install option.

2.0.1

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

New features
~~~~~~~~~~~~
. ``sc.asciify()`` converts a Unicode input string to the closest ASCII equivalent.
. ``sc.dataframe().disp()`` flexibly prints a dataframe (by default, all rows/columns).

Improvements
~~~~~~~~~~~~
. ``sc.findinds()`` now allows a wider variety of numeric-but-non-array inputs.
. ``sc.sanitizefilename()`` now handles more characters, including Unicode, and has many new options.
. ``sc.odict()`` now allows you to delete by index instead of key.
. ``sc.download()`` now creates folders if they do not already exist.
. ``sc.checktype(obj, 'arraylike')`` now returns ``True`` for pandas ``Series`` objects.
. ``sc.promotetoarray()`` now converts pandas ``Series`` or ``DataFrame`` objects into arrays.
. ``sc.savetext()`` can now save arrays (like ``np.savetxt()``).

Bugfixes
~~~~~~~~
. Fixed a bug with addition (concatenation) for ``sc.autolist()``.
. Fixed a bug with the ``_copy`` argument for ``sc.mergedicts()`` being ignored.
. ``sc.checkmem()`` no longer uses compression, giving more accurate estimates.
. Fixed a bug with ``sc.options()`` setting the plot style automatically; a ``'default'`` style was also added that restores Matplotlib defaults (which is now the Sciris default as well; use ``'sciris'`` or ``'simple'`` for the Sciris style).
. Fixed a bug with ``packaging.version`` not being found on some systems.
. Fixed an issue with colormaps attempting to be re-registered, which caused warnings.

2.0.0

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

This version contains a number of major improvements, including:

. **New functions**: new functions for downloading (``sc.download()``), paths (``sc.rmpath()``), and data handling (``sc.loadyaml()``) have been added.
. **Better parallelization**: ``sc.parallel()`` now allows more flexibility in choosing the pool, including ``concurrent.futures``. There's a new ``sc.resourcemonitor()`` for monitoring or limiting resources during big runs.
. **Improved dataframe**: ``sc.dataframe()`` is now implemented as an extension of a pandas DataFrame.

New features
~~~~~~~~~~~~
. ``sc.resourcemonitor()`` provides memory or CPU limits, as well as monitors running processes.
. ``sc.download()`` downloads multiple files in parallel.
. ``sc.rmpath()`` removes both files and folders, with an optional interactive mode.
. ``sc.ispath()`` is an alias for ``isinstance(obj, pathlib.Path)``.
. ``sc.loadyaml()`` and ``sc.saveyaml()`` load and save YAML files, respectively.
. ``sc.loadzip()`` extracts (or reads data from) zip files.
. ``sc.count()`` counts the number of matching elements in an array (similar to ``np.count_nonzero()``, but more flexible with e.g. float vs. int mismatches).
. ``sc.rmnans()`` and ``sc.fillnans()`` have been added as aliases of ``sc.sanitize()`` with default options.
. ``sc.strsplit()`` will automatically split common types of delimited strings (e.g. ``sc.strsplit('a b c')``).
. ``sc.parse_env()`` parses environment variables into common types (e.g., will interpret ``'False'`` as ``False``).
. ``sc.LazyModule()`` handles lazily loaded modules (see ``sc.importbyname()`` for usage).
. ``sc.randsleep()`` sleeps for a nondeterministic period of time.

Bugfixes
~~~~~~~~
. ``sc.mergedicts()`` now handles keyword arguments (previously they were silently ignored). Non-dict inputs also now raise an error by default rather than being silently ignored (except for ``None``).
. ``sc.savespreadsheet()`` now allows NaNs to be saved.
. ``sc.loadspreadsheet()`` has been updated to match current ``pd.read_excel()`` syntax.
. ``Spreadsheet`` objects no longer pickle the binary spreadsheet (in some cases reducing size by 50%).
. File-saving functions now have a ``sanitizepath`` argument (previously, some used file path sanitization and others didn't). They also now return the full path of the saved file.

Improvements
~~~~~~~~~~~~

Major
^^^^^
. If a copy/deepcopy is not possible, ``sc.cp()``/``sc.dcp()`` now raise an exception by default (previously, they silenced it).
. ``sc.dataframe()`` has been completely revamped, and is now a backwards-compatible extension of ``pd.DataFrame()``.
. ``sc.parallelize()`` now supports additional parallelization options, e.g. ``concurrent.futures``, and new ``maxcpu``/``maxmem`` arguments.

Time/date
^^^^^^^^^
. ``sc.timer()`` now has ``plot()`` and ``total()`` methods, as well as ``indivtimings`` and ``cumtimings`` properties. It also has new methods ``tocout()`` and ``ttout()``, which return output by default (rather than print a string).
. ``sc.daterange()`` now accepts ``datedelta`` arguments, e.g. ``sc.daterange('2022-02-22', weeks=2)``.
. ``sc.date()`` can now read ``np.datetime64`` objects.

Plotting
^^^^^^^^
. ``sc.animation()`` now defaults to ``ffmpeg`` for saving.
. ``sc.commaticks()`` can now set both ``x`` and ``y`` axes in a single call.
. ``sc.savefig()`` by default now creates folders if they don't exist.
. ``sc.loadmetadata()`` can now read metadata from JPG files.

Math
^^^^
. ``sc.findinds()`` can now handle multiple inputs, e.g. ``sc.findinds(data>0.1, data<0.5)``.
. ``sc.checktype()`` now includes boolean arrays as being ``arraylike``, and has a new ``'bool'`` option.
. ``sc.sanitize()`` can now handle multidimensional arrays.

Files
^^^^^
. ``sc.urlopen()`` can now save to files.
. ``sc.savezip()`` can now save data to zip files (instead of just compressing files).
. ``sc.path()`` is more flexible, including handling ``None`` inputs.
. ``sc.Spreadsheet()`` now has a ``new()`` method that creates a blank workbook.

Other
^^^^^
. Added ``dict_keys()``, ``dict_values()``, and ``dict_items()`` methods for ``sc.odict()``.
. ``sc.checkmem()`` now returns a dictionary of sizes rather than prints to screen.
. ``sc.importbyname()`` can now load multiple modules, and load them lazily.
. ``sc.prettyobj()`` and ``sc.dictobj()`` now both take either positional or keyword arguments, e.g. ``sc.prettyobj(a=3)`` or ``sc.dictobj({'a':3})``.

Housekeeping
~~~~~~~~~~~~
. ``pyyaml`` has been added as a dependency.
. Profiling and load balancing functions have beem moved from ``sc.sc_utils`` and ``sc.sc_parallel`` to a new submodule, ``sc.sc_profiling``.
. Most instances of ``DeprecationWarning`` have been changed to ``FutureWarning``.
. Python 2 compatibility functions (e.g. ``sc.loadobj2or3()``) have been moved to a separate module, ``sc.sc_legacy``, which is no longer imported by default.
. Added style and contributing guides.
. Added official support for Python 3.7-3.10.
. ``sc.wget()`` was renamed ``sc.urlopen()``.
. Sciris now has a "lazy loading" option, which does not import submodules, meaning loading is effectively instant. To use, set the environment variable ``SCIRIS_LAZY=1``, then load submodules via e.g. ``from sciris import sc_odict as sco``.

Regression information
~~~~~~~~~~~~~~~~~~~~~~
. The default for ``sc.cp()`` and ``sc.dcp()`` changed from ``die=False`` to ``die=True``, which may cause previously caught exceptions to be uncaught. For previous behavior, use ``sc.dcp(..., die=False)``.
. The argument ``maxload`` (in ``sc.loadbalancer()``, ``sc.parallelize()``, etc.) has been renamed ``maxcpu`` (for consistency with the new ``maxmem`` argument).
. Previously ``sc.loadbalancer(maxload=None)`` was interpreted as a default load limit (0.8); ``None`` is now interpreted as no limit.
. Legacy load functions have been moved to a separate module and must be used from there, e.g. ``sc.sc_legacy.loadobj2or3()``.

1.3.3

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

Plotting
~~~~~~~~
. Added ``sc.savefig()``, which is like ``pl.savefig()`` but stores additional metadata in the figure -- the file that created the figure, git hash, even the entire contents of ``pip freeze`` if desired. Useful for making figures more reproducible.
. Likewise, ``sc.loadmetadata()`` will load the metadata from a PNG/SVG file saved with ``sc.savefig()``.
. Added ``sc.animation()`` as a more flexible alternative to ``sc.savemovie()``. While ``sc.savemovie()`` works directly with Matplotlib artists, ``sc.animation()`` works with entire figure objects so if you can plot it, you can animate it.
. Split ``sc.dateformatter()`` into two: ``sc.dateformatter()`` reformats axes that already use dates (e.g. ``pl.plot(sc.daterange('2022-01-01', '2022-01-31'), pl.rand(31))``), while ``sc.datenumformatter()`` reformats axes that use numbers (e.g. ``pl.plot(np.arange(31), pl.rand(31))``).
. Added flexibility for ``sc.boxoff()`` to turn off any sides of the box.

Other changes
~~~~~~~~~~~~~
. Added ``sc.capture()``, which will redirect ``stdout`` to a string, e.g. ``with sc.capture() as txt: print('This will be stored in "txt"')``. This is very useful for writing tests against text that is supposed to be printed out.
. Added quick aliases for ``sc.colorize()``, e.g. ``sc.printgreen('This is like print(), but green')``. Colors available are red, green, blue, cyan, yellow, magenta.
. Keyword arguments are now allowed for ``sc.mergedicts()``, e.g. ``sc.mergedicts({'a':1}, b=2)``. Existing keywords have been renamed to start with an underscore, e.g. ``_strict``.
. Added an ``every`` argument to ``sc.progressbar()``, to not update on every step.
. Fixed labeling bugs in several corner cases for ``sc.timer()``.
. Added an explicit ``start`` argument to ``sc.timedsleep()``.
. Added additional flexibility to ``sc.getcaller()``, including storing the code of the calling line.

1.3.2

--------------------------
. Additional flexibility in ``sc.timer()``: it now stores a list of times (``timer.timings``), allows auto-generated labels (``sc.timer(auto=True)``, and has a new method ``timer.tt()`` (short for ``toctic``) that will restart the timer (i.e. time diff rather than cumulative time).
. Fixed a bug preventing the label from being passed in ``timer.toc()``.
. Fixed a bug blocking ``style=None`` in ``sc.dateformatter()``, and added an argument to allow using the ``y`` axis.

Page 3 of 6

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.