A session store backed by redis.
-
Vial can be installed using
pip
oreasy_install
.pip install vial
-
Clone the vial repository to your local computer.
git clone git://github.com/vial/python-vial.git
-
Change into the vial root directory.
cd /path/to/python-vial
-
Install the project and all its dependencies using
pip
.pip install .
Additional extra requirements may be specified in brackets following the
.
.# Install vial as well as the additional dependencies to use # the unit test suite. pip install ".[test]"
The session object is a standard mutable mapping with a few additional methods to facilitate a session.
>>> from vial import Vial
# By default the session connects to redis on `localhost:6379`.
>>> vial = Vial(host='localhost', port=9001)
>>> session = vial.Session()
>>> session.id
None
>>> session.save()
>>> session.id
'8379fh98302hf8hg8hrligh908h490nvn9gn389tb038n'
# Add some more values to the session.
>>> session['color'] = 'blue'
>>> session.save()
# Fetch the session and check the value.
>>> vial.Session(id=session.id)['color']
'blue'
This will create the session object bound to the passed identifier.
>>> from vial import Vial
>>> vial = Vial()
>>> session = vial.Session(id='8379fh98302hf8hg8hrligh908h490nvn9gn389tb038n')
# This will identify if the session is persisted in redis
>>> session.is_new
False
- Follow steps 1 and 2 of the manual installation instructions.
-
Initialize a virtual environment to develop in. This is done so as to ensure every contributor is working with close-to-identicial versions of packages.
mkvirtualenv vial
The
mkvirtualenv
command is available fromvirtualenvwrapper
which can be installed as follows:pip install virtualenvwrapper
-
Install vial in development mode with testing enabled. This will download all dependencies required for running the unit tests.
pip install -e ".[test]"
-
Run the unit tests.
py.test
Unless otherwise noted, all files contained within this project are liensed under the MIT opensource license. See the included file LICENSE or visit opensource.org for more information.