Skip to content

stevewedig/value-objects-in-python

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Value Objects in Python

(GitHub has a rendered version of this readme: https://github.com/stevewedig/value-objects-in-python/)

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: 1_enter_vm.sh
  2. Provision and test inside the VM: 2_run_inside_vm.sh
  3. The provision script: 3_provision.sh

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:

Releases

No releases published

Packages

No packages published