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.1.2

1 year ago

Added

  • Added new module util_deprecate with the function schedule_deprecation, which is generally useful for library maintenance.

Fixed

  • Fixed issue where ubelt Cacher triggered its own warnings
  • Fixed deprecated usage of LooseVersion

Changed

  • Tentative deprecation or backwards incompatible change in ub.Path.augment with suffix or prefix keywords

v1.1.1

1 year ago

Version 1.1.1 - Released 2022-06-09

Changed

  • Removed warning from ubelt.Cacher when depends is not specified.
  • ub.timestamp / ub.timeparse now respects a default_timezone argument and handles datetime.date objects.
  • Type stubs are now included in the distribution

Fixed

  • Issue #113, where a ub.find_exe test failed on Gentoo. Fixed by #114
  • Issue where older versions of CacheStamp would be interpreted as 1.1 stamps.

v1.1.0

1 year ago

Version 1.1.0 - Released 2022-06-03

Added

  • New method: ub.timeparse can parse the result of ub.timestamp into a datetime object. Can optionally use dateutil.parser.parse under the hood.
  • ub.Path.ls a convenience function that aliases list(path.iterdir()).
  • ub.Path.walk to wrap os.walk.

Changed

  • Register pathlib.Path with ub.repr2
  • Can now register global ub.repr2 extensions via ub.repr2.register
  • Can now register global ub.hash_data extensions via ub.hash_data.register
  • Removed deprecated arguments from ubelt.cmd.
  • ub.CacheStamp will now check the mtime and size to quickly check if the products have changed and force expiration.
  • ub.CacheStamp now takes an expires keyword arg, which will keep the cache valid only for the specified amount of time.
  • ub.CacheStamp now takes an hash_prefix keyword arg, which will check that it matches the hash of the product.
  • ub.cmd now has a system argument for modularity with os.system.
  • ub.cmd now accepts a timeout argument (tee support is pending).
  • ub.JobPool now contains a protected _prog variable allowing the user finer-grained progress controls.
  • ub.JobPool now contains a convenience method join that executes all jobs and returns a list of results.
  • ub.timestamp can now accept a datetime object as an argument, and will return the timestamp for that object.
  • The ubelt.util_download.grabdata function now uses CacheStamp instead of implementing its own stamp solution.
  • The ubelt.util_hash.HashableExtensions implementation was updated to use functools.singledispatch instead of the custom solution. This seems faster and should not have any API impact.

Deprecated

  • product and cfgstr arguments to CacheStamp.expired
  • product and cfgstr arguments to CacheStamp.renew
  • Passing hasher as an instance to functions like grabdata or CacheStamp can cause unexpected hashes as they may be used more than once.

Fixed

  • ub.hash_data now recognizes subclasses of registered types.
  • ub.timestamp() has been outputting incorrect (negated) UTC offsets. This is now fixed.
  • ub.timestamp() now works correctly when the year has less than 4 digits.

v1.0.1

2 years ago

Version 1.0.1 - Released 2022-02-20

Fixed

  • Bug where six was used but not listed as a dependency. Six is now removed as a dependency.
  • Fixed out of date docs in some places.

v1.0.0

2 years ago

Version 1.0.0 - Released 2022-02-15

Added

  • :func:ubelt.Path.appdir which functions like the get_app_*_dir methods in util_platform.
  • Add tail argument to :func:ubelt.Path.augment and :func:ubelt.util_path.augpath
  • Add json backend option to Cacher.

Changed

  • IndexableWalker behavior has been changed, each time iter is called it resets its global state.
  • Remove support for Python 2.7 and Python 3.5
  • Removed deprecated functions scheduled for removal.
  • :func:ubelt.util_dict.dict_diff now preserves original dictionary order in Python 3.7+.
  • ub.hash_data can now hash slice objects.
  • INTENTION OF BREAKING CHANGE NOTIFICATION: ubelt.util_format.repr2 may no longer sort dictionaries by default. Looking into a backwards compatible way to work around this.

v0.11.1

2 years ago

Version 0.11.1

This is the last planned release for the 0.x branch of ubelt. Adds a few minor updates and doc fixes to the tools introduced in 0.11.0.

The next 1.0.x branch will no longer support Python 2.7 and Python 3.5. This has a positive impact on import time:

https://twitter.com/erotemic/status/1480069712981680128

image

Note that moving forward we may remove support for Python 3.x branches as they reach end of life without incrementing the major version. Python 3.6 end of life is (23 Dec 2021), and Python 3.7 end of life is (27 Jun 2023).

Added

  • More ubelt.Path extensions for delete
  • Add timeout parameter to ubelt.download

v0.11.0

2 years ago

Version 0.11.0 - Released 2022-01-03

Added

  • Added ubelt.Path, as an extension and quicker-to-type version of pathlib.Path with extra functionality.
  • Added progkw as argument to JobPool.as_completed to control progress reporting
  • Added progkw as argument to ub.download / ub.grabdat to control progress reporting
  • Added util_zip with the zopen function. Access a file inside a zipfile with a standard open like interface.

Fixed

  • ubelt.hash_data now handles non-numeric float values.
  • ubelt.chunks now works correctly when nchunks is specified.

Changed

  • Changed default of _hashable_sequence types arg from True to False to be consistent, but kept existing types=True behavior in hashable extensions. Changes should be backwards compatible, but in the future we may introduce a breaking change to make hash behavior more consistent.

v0.10.2

2 years ago

Version 0.10.2 - Released 2021-12-07

Added

  • Added pyi type annotation files. (Used a custom script to export docstring type annotations)
  • Added default keyword argument to signature of ub.peek

Fixed

  • Added map function to the executor classes.
  • ub.Executor now correctly returns itself from __enter__
  • Docstrings now have better type annotations
  • ProgIter had a bug in time_thresh, where it was never used (modified adjustment rules).
  • Fixed performance regression in ProgIter (now less overhead than tqdm)

Changed

  • New CI GPG Keys: Erotemic-CI: 70858F4D01314BF21427676F3D568E6559A34380 for reference the old signing key was 98007794ED130347559354B1109AC852D297D757.
  • Verbose test from symlink previously showed "real -> link" which makes no sense because a link should be the object that "is pointing". Thus it now shows "link -> real"
  • ub.download should now generate less stdout text
  • New in-repo "dev" benchmarks

0.10.1

2 years ago

This is a minor release with documenation improvements and no functionality changes

0.10.0

2 years ago

Added

  • new hashing 36-character base with alias (alphanum / abc123 / 36)
  • Added "compact" argument to ub.repr2
  • added candidate utilities: named_product, varied_values to util_dict
  • added candidate utilities: compatible to util_func
  • Added util_indexable and IndexableWalker (ported from kwcoco)
  • Added util_futures with ub.JobPool and ub.Executor (ported from kwcoco)
  • Added util_download_manager with simple implementation of ub.DownloadManager
  • Added candidate functions to ubelt proper

Fixed

  • ubelt.download now errors earlier if the parent directory does not exist
  • PyTest no longer throws warnings
  • Fixed issue with download and ByteIO objects in 3.8
  • Bug in Python 3.8+ on win32 that did not account for the change on os.readlink behavior

Changed

  • Modified corner cases in ub.repr2 to move towards behavior that is easier to reason about.

  • Remove support for Python 3.4