Skip to main content

Questionnaire DSL

A DSL for describing questionnaires with a simple terminal interpreter.

Example:

Q[type]: Project type
1[lang]. Language project
2[gen]. Generator project

Q[type=lang, extension]: File extension (e.g. "*.que"):
___ /\*\.[a-z0-9]+/

Q[package]: Package name
___ /[a-z][a-z0-9_]*$/

Q: Author name
___

Q: Author email
___

Q: This question is to
   test multiline feature and indenting.
   1. Working
   2. Not working.
      This is also to test multiline in choices.

Each question is of the form Q: or Q[<comma separated terms>]. If [] with terms is given, each term is either a question ID or a boolean expression of the form <lhs>=<rhs> where <lhs> is a reference to previous question ID while <rhs> is a value of the previous question which must be satisfied for this question to be used. This is handy if the questions that follows depends on the answer. See File extension question above which is asked only for language projects (thus type=lang, the type is a reference to the previous question).

The type of the question is either free-form (specified by ___) or choice if enumerated options are given.

Both question and option can span multiple lines (like in the last question).

For free-form question an optional regular expression can be given inside // (see Package name above). This regex is an input validator.

This package provides an interpreter of the questionnaire txquestionnaire.questionnaire_interpreter(model, data=None) which accepts the model created by parsing of questionnaire description using this language and optionally a dictionary of default answers keyed by either question ID if given or question number. The interpreter will run the questionnaire on the console and return a dictionary of collected data. The values for options are ordinal numbers or IDs if given (like in Project type above -- lang, gen).

Please see tests for the detailed usage.

Metadata

Release files for textx-lang-questionnaire 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textx-lang-questionnaire 0.2.0
File Size Uploaded
textx-lang-questionnaire-0.2.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textx-lang-questionnaire 0.2.0
File Interpreter ABI Platform
textx_lang_questionnaire-0.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.4 kB

Release files / textx-lang-questionnaire-0.2.0.tar.gz

Download URL textx-lang-questionnaire-0.2.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ec0c92d0cf9968229ee1175f4f9aaf4efb21d84dae7657addc26e95c1be8f7f
BLAKE2b-256 checksum
How to use checksums
167eee17e12554a28ec997e0292e0b39cde5fdceeb0ba8a7c4085342f36a4e6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

Release files / textx_lang_questionnaire-0.2.0-py2.py3-none-any.whl

Download URL textx_lang_questionnaire-0.2.0-py2.py3-none-any.whl
Size 5.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8b885ff7b74322b210ebce022ea0b3a3cce9d768823a7edc370fd8ec8258fcab
BLAKE2b-256 checksum
How to use checksums
9dbad1a1dd39acab4a0d1c564efd86d34a8dfb22196fa9c97f71b2347870a920
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page