Cartesian configuration format file parser
Cartesian product variantization of parameters.
General syntax notes
Filter syntax:
, means OR
.. means AND
. means IMMEDIATELY-FOLLOWED-BY
(xx=yy) where xx=VARIANT_NAME and yy=VARIANT_VALUE
Example:
qcow2..(guest_os=Fedora).14, RHEL.6..raw..boot, smp2..qcow2..migrate..ide
means match all dicts whose names have:
(qcow2 AND ((guest_os=Fedora) IMMEDIATELY-FOLLOWED-BY 14)) OR ((RHEL IMMEDIATELY-FOLLOWED-BY 6) AND raw AND boot) OR (smp2 AND qcow2 AND migrate AND ide)
Note:
qcow2..Fedora.14 is equivalent to Fedora.14..qcow2.
qcow2..Fedora.14 is not equivalent to qcow2..14.Fedora.
ide, scsi is equivalent to scsi, ide.
Filters can be used in 3 ways:
only <filter> no <filter> <filter>:
The last one starts a conditional block.
Formal definition: Regexp come from python. They’re not deterministic, but more readable for people. Spaces between terminals and nonterminals are only for better reading of definitions.
The base of the definitions come verbatim as follows:
E = {\\n, #, :, "-", =, +=, <=, ~=, ?=, ?+=, ?<=, !, < , del, @, variants, include, only, no, name, value}
N = {S, DEL, FILTER, FILTER_NAME, FILTER_GROUP, PN_FILTER_GROUP, STAT, VARIANT, VAR-TYPE, VAR-NAME, VAR-NAME-F, VAR, COMMENT, TEXT, DEPS, DEPS-NAME-F, META-DATA, IDENTIFIER}``
I = I^n | n in N // indentation from start of line
// where n is indentation length.
I = I^n+x | n,x in N // indentation with shift
start symbol = S
end symbol = eps
S -> I^0+x STATV | eps
I^n STATV
I^n STATV
I^n STATV -> I^n STATV \\n I^n STATV | I^n STAT | I^n variants VARIANT
I^n STAT -> I^n STAT \\n I^n STAT | I^n COMMENT | I^n include INC
I^n STAT -> I^n del DEL | I^n FILTER
DEL -> name \\n
I^n STAT -> I^n name = VALUE | I^n name += VALUE | I^n name <= VALUE | I^n name ~= VALUE
I^n STAT -> I^n name ?= VALUE | I^n name ?+= VALUE | I^n name ?<= VALUE
VALUE -> TEXT \\n | 'TEXT' \\n | "TEXT" \\n
COMMENT_BLOCK -> #TEXT | //TEXT
COMMENT -> COMMENT_BLOCK\\n
COMMENT -> COMMENT_BLOCK\\n
TEXT = [^\\n] TEXT //python format regexp
I^n variants VAR #comments: add possibility for comment
I^n+x VAR-NAME: DEPS
I^n+x+x2 STATV
I^n VAR-NAME:
IDENTIFIER -> [A-Za-z0-9][A-Za-z0-9_-]*
VARIANT -> VAR COMMENT_BLOCK\\n I^n+x VAR-NAME
VAR -> VAR-TYPE: | VAR-TYPE META-DATA: | : // Named | unnamed variant
VAR-TYPE -> IDENTIFIER
variants _name_ [xxx] [zzz=yyy] [uuu]:
META-DATA -> [IDENTIFIER] | [IDENTIFIER=TEXT] | META-DATA META-DATA
I^n VAR-NAME -> I^n VAR-NAME \\n I^n VAR-NAME | I^n VAR-NAME-N \\n I^n+x STATV
VAR-NAME-N -> - @VAR-NAME-F: DEPS | - VAR-NAME-F: DEPS
VAR-NAME-F -> [a-zA-Z0-9\\._-]+ // Python regexp
DEPS -> DEPS-NAME-F | DEPS-NAME-F,DEPS
DEPS-NAME-F -> [a-zA-Z0-9\\._- ]+ // Python regexp
INC -> name \\n
FILTER_GROUP: STAT
STAT
I^n STAT -> I^n PN_FILTER_GROUP | I^n ! PN_FILTER_GROUP
PN_FILTER_GROUP -> FILTER_GROUP: \\n I^n+x STAT
PN_FILTER_GROUP -> FILTER_GROUP: STAT \\n I^n+x STAT
only FILTER_GROUP
no FILTER_GROUP
FILTER -> only FILTER_GROUP \\n | no FILTER_GROUP \\n
FILTER_GROUP -> FILTER_NAME
FILTER_GROUP -> FILTER_GROUP..FILTER_GROUP
FILTER_GROUP -> FILTER_GROUP,FILTER_GROUP
FILTER_NAME -> FILTER_NAME.FILTER_NAME
FILTER_NAME -> VAR-NAME-F | (VAR-NAME-F=VAR-NAME-F)
Direct parser use
Given the Cartesian configuration file example.cfg
variants:
- qemu_kvm_fedora:
- qemu_kvm_centos:
- qemu_kvm_ubuntu:
- qemu_kvm_kali:
- qemu_kvm_windows_7:
- qemu_kvm_windows_10:
variants:
- vm1:
main_vm = vm1
only qemu_kvm_centos, qemu_kvm_fedora
suffix _vm1
- vm2:
main_vm = vm2
only qemu_kvm_windows_10, qemu_kvm_windows_7
suffix _vm2
- vm3:
main_vm = vm3
only qemu_kvm_ubuntu, qemu_kvm_kali
suffix _vm3
join vm1 vm2 vm3
This can be parsed using cartconf as
./parse.py example.cfg
which will result in the following parameter dictionaries
dict 1: vm1.qemu_kvm_fedora.vm2.qemu_kvm_windows_7.vm3.qemu_kvm_ubuntu dict 2: vm1.qemu_kvm_fedora.vm2.qemu_kvm_windows_7.vm3.qemu_kvm_kali dict 3: vm1.qemu_kvm_fedora.vm2.qemu_kvm_windows_10.vm3.qemu_kvm_ubuntu dict 4: vm1.qemu_kvm_fedora.vm2.qemu_kvm_windows_10.vm3.qemu_kvm_kali
Avocado varianter plugin use
Given the Cartesian configuration file example.cfg
word = abc
variants:
- a:
x = va
word = ${x}
- b:
x = vb
variants:
- 1:
y = w1
- 2:
y = w2
word = ${y}
This can be parsed using the cartconf avocado varianter plugin as
avocado variants -C example.cfg -o aaa=bbb c=d --only a 1
which will result in a job with the following test parameters
dict 1: 1.a
_name_map_file = {'example.cfg': '1.a'}
_short_name_map_file = {'example.cfg': '1.a'}
aaa = bbb
c = d
dep = []
name = 1.a
shortname = 1.a
word = va
x = va
y = w1
Installation
Currently we recommend simple local installation via pip
cd cartconf pip install -e .
Metadata
Release files for avocado-framework-plugin-varianter-cartconf 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| avocado_framework_plugin_varianter_cartconf-0.0.1.tar.gz | 39.2 kB | Without provenance | Details for avocado_framework_plugin_varianter_cartconf-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| avocado_framework_plugin_varianter_cartconf-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for avocado_framework_plugin_varianter_cartconf-0.0.1-py3-none-any.whl |
Total release size: 70.6 kB
Release files / avocado_framework_plugin_varianter_cartconf-0.0.1.tar.gz
| Download URL | avocado_framework_plugin_varianter_cartconf-0.0.1.tar.gz |
|---|---|
| Size | 39.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4afd2067e6014d8e9336e91a55bb3acb47b591b52f141f318a165204264948f7
|
|
BLAKE2b-256 checksum How to use checksums |
c84604f6a0ece65ae0b50661ea087a9eef56216e933f1b1b542d5852fe454097
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / avocado_framework_plugin_varianter_cartconf-0.0.1-py3-none-any.whl
| Download URL | avocado_framework_plugin_varianter_cartconf-0.0.1-py3-none-any.whl |
|---|---|
| Size | 31.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca8e79797b0b498e37efe9c9028ec3d584a34b298b5ead23d724f525d7544659
|
|
BLAKE2b-256 checksum How to use checksums |
177c4f672221cbb4d58d47f7d4c74d02e291acf7292d4fa9a6525d45be6bafec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for avocado-framework-plugin-varianter-cartconf 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.