Skip to main content

My personal library collecting some useful snippets.

Project description


This is my personal collection of snippets that I use in multiple projects. Each one feels a bit to small to merit it’s own library.

So what does it include?

  • memoize decorator (caching)
  • a storage class wrapping a dict.
  • unittest assert functions.
  • Functions for handling large JSON documents.
  • list_dir(path) -> (dirnames, filenames)
  • PID file locking
  • A synchronization decorator

Feedback and getting involved

Send feedback and bug reports by email to hcs at furuvik dot net.



Release date: 2015-09-14

  • Now only supports Python 3.4
  • Improved thread safety for Lock
  • Bugfix for file handling i daemon
  • Code cleanup and some more tests


Release date: 2014-02-11

  • Added support to path.watch_files_callback for controlled shutdown
  • Lock, improved exception handling for edge case.


Release date: 2013-11-19

  • Fix for daemon, started even if it already was started.


Release date: 2013-04-16

  • Fix for daemon sigterm handler


Release date: 2013-04-15

  • Added logging to Daemon


Release date: 2013-04-11

  • fixed bug relating to daemon handle sigterm
  • Added option to to force recalc of cached value for memoized call


Release date: 2013-03-21

  • Added unicode support to eq_str


Release date: 2012-11-16

  • Compatible with python 2.7 and 3.3
  • Fixed problem in Lock, timeouts where not used when other thread in same process had the lock.


Release date: 2012-11-10

No changes since 1.3rc6


Release date: 2012–

  • Storage: added storagify and unstoragify (to/from json style data structure)


Release date: 2011-12-19

  • lock: Improved exception messages (added locking pid).
  • lock: Added some debug logging.


Release date: 2011-09-13

  • Storage: Added generic support for key normalization.


Release date: 2011-09-06

  • Storage: Added support for running case_insensitive.
  • Storage: Added support for default_factory.


Release date: 2011-08-25

  • Storage: Minor fixes
  • daemon: A new module for creating a UNIX daemon.
  • lock: Added the option to steal a lock.


Release date: 2011-07-11

  • PEP8 compliant
  • Better test coverage
  • added IDLock class to lock module
  • Memoize optimization
  • path.watch_file


Release date: 2011-05-31

  • Memoize: bugfixes


Release date: 2011-05-17

  • ItemStore: fixed bugs in rename and move


Release date: 2011-04-26

  • Memoize: Added support for instance methods


Release date: 2011-04-11

  • Added timeout to lockfile


Release date: 2011-04-06

  • Added locking to itemstore
  • Added a file change watcher
  • Some bugfixes
  • PEP8 cleanup


Release date: 2011-02-11

  • Optimized Store.__contains__
  • memoized functions can now be recursive


  • 1.3 will only support Python 2.6 and 2.7
  • Testing using py.test instead of nose
  • added hcs_utils.path.walkfiles() recursive file generator
  • hcs_utils.itemstore Kind of on disk object/file/directory store
  • some smaller functionality
  • bunch of fixes


Release date: 2011-01-07

No changes since 1.2rc5


Release date: 2010-11-30

  • unittest.eq_json, sorted output so that it can be used with dicts.
  • unittest switched place on ndiff arguments


Release date: 2010-06-15

  • Dropped support for Python 2.5
  • Added hcs_utils.collections.ListBuilder, a nice way to manually build lists.
  • Added hcs_utils.lock.Lock, Interprocess locking using a PID symlink.
  • Added hcs_utils.path.scan_for_new_files()
  • Added hcs_utils.path.tempdir context.
  • Added and __iter__
  • Added* Storage vs. json helpers
  • Added hcs_utils.threading.synchronization decorator.
  • Memoize is now thread safe.
  • hcs_utils.path.list_dir now returns a namedtuple


Release date: 2010-04-22

  • Fixed unpickeling of Storage objects.


Release date: 2010-04-18

  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hcs_utils, version 2.0
Filename, size File type Python version Upload date Hashes
Filename, size hcs_utils-2.0.tar.gz (38.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page