Ubelt Versions Save

A Python utility library with a stdlib like feel and extra batteries. Paths, Progress, Dicts, Downloads, Caching, Hashing: ubelt makes it easy!

v1.3.5

1 month ago

Added:

  • New wrapper around pathlib.Path.chmod in ubelt.Path.chmod. Can now specify string codes like "u+x" or "+rw". Old stat logic works as it previously did.

Changed:

  • Allow the argument to ubelt.cmd to be a PathLike object, which we will expect to be an executable.

Fixed

  • ub.modname_to_modpath now handles cases where editable packages have modules where the name is different than the package.
  • Fixed deprecated usage of ast.Num

What's Changed

Full Changelog: https://github.com/Erotemic/ubelt/compare/v1.3.4...v1.3.5

v1.3.4

6 months ago

Added

  • Add backend option to highlight_code which can be "pygments" or "rich".
  • Support for Python 3.12

Changed

  • Improve speed of inplace dictionary set operations.

Fixed

  • Align in the case of nobraces=1 for ubelt.urepr.

v1.3.3

10 months ago

Fixed

  • Bug where the first call to ub.hash_data would error if it was given a ndarray with object type.
  • Actually exposed ChDir.

Changed

  • Docs and typing improvements

v1.3.2

10 months ago

Fixed

  • Bug where the first call to ub.hash_data would error if it was given a ndarray with object type.

Notes

  • Skipped a release version due to a bad github tag.

v1.3.0

10 months ago

Version 1.3.0 - 2022-06-14

Changed

  • Removed experimental warning from Path.copy and Path.move; they are now well enough tested.
  • The util_format submodule has been renamed to util_repr. The util_format is now a deprecated alias for util_repr.
  • Stub out merge methods for SetDict.
  • Renamed FormatterExtensions to ReprExtensions, with the former now being a deprecated alias.
  • ubelt.cmd now returns an object that ducktypes subprocess.CompletedProcess.
  • ubelt.cmd now contains a capture argument which will disable capturing of output.
  • ubelt.cmd ...detaching now only prints if verbosity is > 1

v1.2.4

1 year ago

Version 1.2.4

Added

  • Added ChDir to util_path.
  • Add transient option to JobPool so references to futures are released after they are yielded to the user.
  • Added "base32" as an option for hash_data. Note that it is unpadded, hence non-RFC compliant.
  • Added pattern as a convenience option to ubelt.Path.ls.

Changed

  • Updated vendored ProgIter to match progiter 1.3.0
  • The download progress bar now gives more relevant information and updates less frequently.
  • IndexableWalker.allclose can now take unwrapped objects.

Fixed

  • ubelt.cmd now respects cwd when system=True.

v1.2.3

1 year ago

Added

  • Support for FreeBSD in util_platform
  • ub.Path.copy and ub.Path.move
  • Tentative Python 3.11 support
  • ub.utext which is a repr2 with new defaults.
  • ub.IndexableWalker.allclose method to replace indexable_allclose

Changed

  • ub.schedule_deprecation can now accept the strings "soon" or "now" for "when" arguments.
  • ub.schedule_deprecation can now accept stacklevel as as an argument.
  • ub.Path.apppdir can now be called without arguments.
  • Deprecate TempDir
  • ub.Timer can now accept ns as a keyword to enable nanosecond resolution.
  • ProgIter.format_message return value has changed.
  • ub.Path.mkdir now returns itself
  • Speedup dict_hist in the basic case by 2x

Fixed

  • Issue in indexable_allclose where tolerances were not respected.
  • Issue in modname_to_modpath with exclude and editable installs.
  • Incompatibility with pathlib in PythonPathContext
  • Fixed issue in progiter with line clears
  • Issue in import_module_from_modname with editable installs where it would try to match modules that had the requested module as a prefix.
  • The timeout argument is now respected in the thread / process case of JobPool

v1.2.2

1 year ago

Added

  • Add ubelt.util_dict.UDict.take.
  • Added __add__, __radd__, startswith, and endswith methods to ubelt.Path to make it a better drop-in replacement for string based paths.

Changed

  • Reverse dunder methods of ubelt.SetDict now promote the type.
  • Add cls keyword argument to ubelt.SetDict methods.
  • Deprecate: ensure_app_cache_dir, ensure_app_config_dir, ensure_app_data_dir, get_app_cache_dir, get_app_config_dir, get_app_data_dir, readfrom, writeto, ensure_unicode.
  • Initial work on new Path methods for move and copy.
  • CacheStamp.renew now does nothing and returns None if the stamp is disabled.
  • AutoDict, SetDict, and UDict are now always ordered. In Python 3.6 it inherits from OrderedDict. Otherwise it uses regular dict, which will be ordered in 3.7+
  • AutoDict now inherits from UDict.
  • PathLike objects can now be used in args to ub.cmd when the command is an iterable.

Deprecated

  • deprecate AutoOrderedDict, which is now indistinguishable from AutoDict

Fixed

  • Tentative fixes for new __editable__ based install path with ub.modname_to_modpath

v1.2.1

1 year ago

Version 1.2.1 - Released 2022-08-06

Fixed

  • Implemented inplace and reverse versions of dictionary set operations
  • Added copy to setdict

v1.2.0

1 year ago

Version 1.2.0 - Released 2022-08-02

Added

  • Added keywords argument to ub.compatible.
  • Added warncls argument to ub.schedule_deprecation.
  • Experimental SetDict, UDict and aliases sdict, udict.

Fixed

  • Race condition on win32 in ubelt.symlink
  • Issue with ubelt.memoize_method where the method name and docstring were not wrapped correctly.
  • The timeout argument now works correctly with ub.cmd when tee=True.
  • Added appname to ubelt.download which was supposed to exist as indicated by the docs, but didn't.
  • The resources used by ubelt.cmd are now properly closed.

Changed

  • ub.compatible no longer errors on positional only functions, instead it returns the keyword-compatible arguments.
  • An issue in ubelt.symlink with unintuitive behavior when an empty string was given as the link path. This now raises an error.
  • The main implementations of ubelt.sorted_vals and ubelt.map_vals were renamed to ubelt.sorted_values and ubelt.map_values, but the old names are still available as aliases.
  • Positional arguments in Path.augment have been modified.
  • In Path.augment, deprecate overloaded suffix and introduce stemsuffix as an alternative.
  • Added cls to a lot of util_dict funcs