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.

Download
ActivePython
INSTALL>
pypm install pyqa

How to install pyqa

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install pyqa
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.6.1 Available View build log
0.5.2 Available View build log
Windows (64-bit)
0.6.1 Available View build log
0.5.2 Available View build log
Mac OS X (10.5+)
0.6.1 Available View build log
0.5.2 Available View build log
Linux (32-bit)
0.6.1 Available View build log
0.5.2 Available View build log
Linux (64-bit)
0.6.1 Available View build log
0.5.2 Available View build log
 
License
MIT
Dependencies
Imports
Lastest release
version 0.6.1 on Nov 17th, 2011

pyqa makes it easier to write terminal based tools which ask the user a bunch of questions and then generate some configuration file based on the answers.

Usage

See /demos for some working examples.

pyqa provides single function, "ask". It expects a set of questions given in a specific format. The following description is in YAML but you are free to use any other markup language as long as the output matches:

---
id: project_name # id to use at the template
q: Could you please give the project name? # question shown to the user
---
id: license
q: Please pick a license for your project?
choices: # if choices field is used, the user will see these as numbered choice
    - BSD
    - GPL
    - MIT
---
id: use_fizzler
q: Are you sure you want to use fizzler?
type: boolean -- this will accept either true or false answer and emits True/False

Note that keywords "Yes" and "No" seem to be converted to booleans by YAML. If you need to use those within choices, remember to use explicit form (ie. "Yes" instead of Yes).

After the user has finished answering "ask" will return the results in a format like this:

{'project_name': 'myproject', 'license': 'BSD', 'use_fizzler': True}

This format happens to be compatible with pystache (Python version of mustache) and no doubt with many other template engines. Just pass that data to your favorite engine, render and output the file somewhere. Voilá!

License

pyqa is available under MIT license. See LICENSE for more details.

Subscribe to package updates

Last updated Nov 17th, 2011

Download Stats

Last month:2

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.