Skip to main content

Python monkey patching for humans.

Project description

Altered States is a reversible state tool. It changes values in an object. When the changes are not needed anymore, it is possible to reverse them.

Read more here:


  • Fixed issue in script
  • Added missing changelog


  • Altered States now runs on Python 3 (tested on 2.7, 3.5 and 3.6)
  • Dropped support for Python 2.6
  • Experimental support for Kenneth Reitz Pipenv tool
  • Corrected invalid use of os.modules in examples


  • Better handling of objects that override __getitem__ (thanks to @merwok).
  • Drop support for Python 2.5 (no sane way to solve issue #4 there).


  • Added a new API entry point: alter(), that can be used to perform a two-step reversible alteration.


  • Updated test suites to use @pytest.fixture notation for fixtures (now requires py.test > 2.3)
  • Fixes a bug causing os.environ not to be patchable.

Fixing bug #2 means switching the dict -like object check from isinstance(x, dict) to hasattr(x, ‘__getitem__’). This change is thought to not break backwards compatibility but if you encounter unexpected behaviour in dict / object detection this might be it. I’d be very interested to know about that if you do.


  • Alias Expando as E for optional terseness.


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.

Filename, size & hash SHA256 hash help File type Python version Upload date
altered_states-1.0.9-py2.7.egg (13.7 kB) Copy SHA256 hash SHA256 Egg 2.7
altered_states-1.0.9-py3.7.egg (14.0 kB) Copy SHA256 hash SHA256 Egg 3.7
altered_states-1.0.9.tar.gz (10.6 kB) Copy SHA256 hash SHA256 Source None

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