Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install vault

How to install vault

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install vault
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.2 Available View build log
0.1 Available View build log
Windows (64-bit)
0.2 Available View build log
0.1 Available View build log
Mac OS X (10.5+)
0.2 Available View build log
0.1 Available View build log
Linux (32-bit)
0.2 Available View build log
0.1 Available View build log
Linux (64-bit)
0.2 Available View build log
0.1 Available View build log
Lastest release
version 0.2 on Jan 5th, 2011

What is it?

Use case

It's a common requirement for shell scripts and python programs to store third-party passwords (SMTP passwords, secret API keys etc) and use them later. Where do you save them?

Solutions and Pitfalls
  • Many people save this sensitive information as environment variables, because it is the most straightforward method. But it has serious security implications, particularly on shared hosting servers (That's why I don't like shared hosting. I wonder why people still use shared hosting when VPS is so cheap. For example, you can get a 256MB VPS slice from Rackspace Cloud for as cheap as $11 per month).
  • Another approach recommended by several people is to store the passwords in a text file, remove read permissions for all others except the owner and read that file from your program at runtime to retrieve the passwords. But it too has security issues. What if you forgot to exclude this file from your VCS or from your backups?
My Solution
  • My solution is a light wrapper around the excellent python-keyring library. Keyring allows us to store sensitive information in GnomeKeyring (for Gnome environments) or KDEWallet (for KDE environments) or Win32CryptoRegistry (for Windows). Vault makes it a little more convenient to use it in shell scripts.

How to use it?

Python Programs
  • Just call

    vault.get(service, key)
  • If the (key, value) pair for the service exists already, it simply returns the value.

  • Otherwise it will prompt the user for the value and saves it.

  • If you have to change the value of the key in future, simply call

    vault.set(service, key, new_value)
Shell Scripts
  • To get the password for testuser@gmail.com

    password=`python -m vault get gmail.com testuser`
  • If the password is not found, it will prompt the user, saves it and populates password.

  • To change the value of the key in future

    python -m vault set gmail.com testuser new_password

Latest Version

The latest version of this project can be found at : http://bitbucket.org/sramana/vault


The documentation is distributed along with source repository in docs/ directory (in ReStructuredText format). You can run "make html" in that directory to generate HTML version.

Alternatively, you can browse the online documentation at http://packages.python.org/vault/


  • Run "pip install vault".
  • Alternatively, if you have downloaded the source, run "python setup.py install" in the unzipped source directory.


This project is licensed under New BSD license.

Contribution and Feedback

Contributions and Feedback are most welcome. Please email the author with your comments.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.