Skip to main content

Jingen generates files from Jinja2 based template files.

Usage:

Assuming a vars file mock_vars.py

VARS = {
    "test_var": "vars_file_test_value"
}

and a template file: mock.template:

I'M A MOCK TEMPLATE AND MY VAR IS: {{ test_var }}
from jingen.jingen import Jingen

template_file = "mock.template"
vars_source = "tests/resources/mock_vars.py"  # alternatively, can be a dict
output_file = "tests/resources/manual_test_result.file"
templates_dir = "tests/resources/"
make_file = True
verbose = True

i = Jingen(
    template_file=template_file,
    vars_source=vars_source,
    output_file=output_file,
    templates_dir=templates_dir,
    make_file=make_file,
    verbose=verbose)
output = i.generate()

print output
...
I'M A MOCK TEMPLATE AND MY VAR IS: vars_file_test_value

Output would be:

### DEBUG - generating template from tests/resources//mock.template
### DEBUG - creating file: tests/resources/manual_test_result.file with content:
I'M A MOCK TEMPLATE AND MY VAR IS: vars_file_test_value

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jingen-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file jingen-0.1.0.tar.gz.

File metadata

  • Download URL: jingen-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jingen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 905c65191fddebac248c36d165468f7316c4892c7b85a382a5bd363455246904
MD5 c33d83c0dfcd7a517f8d9bd6ba0083de
BLAKE2b-256 ffec6aee05ded82d9ba80ecb5517317cdc6fd0bf4766d3770102c80da669a451

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page