Value Objects in Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Value Objects in Python

(GitHub has a rendered version of this readme:

This library makes it easy to implement value objects in Python. The library's rationale and usage instructions can be found in this blog post: Value Objects in Java & Python.

Alternative library

Vladimir Keleshev has an alternative Python library for value objects that makes some different design decisions. My library is a combination of techniques I've used before and Vladimir's technique of using __init__ to indicate field name, order, and default values.

Installation via Pip

The easiest way to install this library is to use Pip:

pip install value_objects

Installation via copying files

Alternatively you can just copy the library code directory into your own codebase.

Running Tox tests in Vagrant

Vagrant (with VirtualBox is a great way to run sandboxed experiments on your dev machine. I use Vagrant plus Tox to run this library's tests in Python 2.x and 3.x without affecting my dev machine. The three scripts I use are included in this project. After going through the quick Vagrant tutorial you'll be ready to try them out:

  1. Setup the VM on your dev machine:
  2. Provision and test inside the VM:
  3. The provision script:

Other blog posts

In addition to this project's blog post (Value Objects in Java & Python), you may also be interested in these posts of mine: