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 grampg

How to install grampg

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install grampg
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.2.0 Available View build log
Windows (64-bit)
0.2.0 Available View build log
Mac OS X (10.5+)
0.2.0 Available View build log
Linux (32-bit)
0.2.0 Available View build log
0.1.3 Available View build log
0.1.2 Available View build log
Linux (64-bit)
0.2.0 Available View build log
0.1.3 Available View build log
0.1.2 Available View build log
GNU Affero General Public License (LICENSE.txt)
Lastest release
version 0.2.0 on Nov 20th, 2012

Copyright 2012 Elvio Toccalino.


The grampg (cue to Grumpy Admin Password Generator, and pronounced "grummpeegee") is a small python2 library which allows to generate passwords according to (possibly complicated) user specs. The idea is simple: build an instance, feed it your desired specifications, then generate as many passwords as you want. Each password generated will be independent of the others, except from the fact that all of them will comply with the specs.

The objectives for the grampg are flexibility and easy of use. grampg fulfills by providing a kind interface to the user: When building the password generator the user writes the spec as if it were being pronounced. In this fashion, a set of complex rules is expressed in a declarative line.


Typical usage follows the pattern outlined before: build a generator instance, feed it your specs, collect your passwords. This brief explanation fails to explain how, which is the main attractive of the grampg. As an example, consider the following:

Your admin needs your system to produce passwords of between 5 and 10 letters, at least 4 numbers, adding up to 10 characters total. Oh, and since this passwords may be used in some-mail-system, they should start with a letter.

The constrains, or specs, are quite contrived, but they can be fed to grampg simply:

from grampg import PasswordGenerator
passwords = (PasswordGenerator().of().between(5, 10, 'letters')
                                     .at_least(4, 'numbers')
return [passwords.generate() for i in xrange(so_many_passwords)]

Only one generator instance is created, and then used to produce as many passwords as are required.

Other character sets available by default are 'lower_letters', 'upper_letters', and 'alphanumeric', but the user is free to build generator instances with any character sets desired (as well as overriding the defaults). For example:

passwords = (PasswordGenerator({'special': list('%$#!*'), 'letters': list('abcde')})
                              .of().exactly(3, special).at_most(2, 'special').done())

For more examples, execute and read the many_passwords.py program (which lives in grampg/demo), a simple program that spits passwords according to somewhat realistic specifications. There is also the usecases.py file, which consists of many uses of the grampg and their expected output (both valid and not).


The grampg package includes the following files which purpose is to serve as test bed:

Unit test suite.
Integration tests.
Regression tests. Like integration, but actual examples that went awry and are now fixed.


The name sucks, I know. It's meant as a silly joke to the person who inspired the code creation.


The grampg software package (including tests, documentation and demonstration programs) is licensed under the GNU Affero GPL version 3.0. A copy of the license is included with the grampg package. For details about the license, visit http://www.gnu.org/licenses/agpl.html.

Subscribe to package updates

Last updated Nov 20th, 2012

Download Stats

Last month:3

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.