Skip to main content

An Alviss powered Template renderer where the context input can be files and entire directory structures can be rendered.

Project description

CCP Stencil

An Alviss and Jinja2 powered template renderer where the context input can be files and entire directory structures can be rendered.

This is a generalized variant of the "CCP Borg Bootstrapper" project bootstrapping and build and deployment tool which used entire "template" projects that were rendered to bootstrap entire projects and to render CI/CD manifests on demand.

The rest of this readme is (at the moment) just a "sketch" for how this package should work and was written before any actual code or functionality.

Context

  • No context (Weird use case...?!?)
  • kwargs context (via code)
  • Dict context (via code)
  • Alviss file context (json/yaml + inheritance)
  • Args context (from commandline)

Template

  • String template (via code)
  • File template
  • Args template (from commandline)
  • Directory template

Renderer

  • String renderer (via code)
  • Stdout renderer (for commandline)
  • File renderer
  • Directory renderer

Other features...?

  • ENV var rendering (can be done via ${ENV:FOO} in Alviss input)?
  • Meta-data header in files for Directory rendering that controls file names and/or if they should be rendered or not
    • Skip-if tag for skipping file rendering
    • Some meta-tag that can control the output name of a file via the FileRenderer
  • Meta-data file for directories in Directory rendering that control the directory name?
  • Proper Jinja2 Environment Template Loader to enable Jinja's include/extend stuff?
  • Custom macros/scripts/filters?

Use Cases

  • From commandline (main use case, e.g. rendering CI/CD manifests)
  • From code

Command Line Use Case Examples

Using these as a basis for functionality (this is written before any actual code)!

Example 1

$ ccp-stencil -i context.yaml -t template.html -o result.html
  • Alviss file input: -i context.yaml
  • Template file input: -t template.html
  • Render file output: -o result.html

Example 2

$ ccp-stencil -a name=Bob -a age=7 -a color=Red -s "My name is {{name}} and I am {{age}} years old and my favorite color is {{color}}"
My name is Bob and I am 7 years old and my favorite color is Red
  • Args input: -a name=Bob -a age=7 -a color=Red
  • String template input: -s "My name is {name} and I am {age} years old and my favorite color is {color}"
  • Print (stdout) output: No argument, this is default!

Example 3

$ ccp-stencil -T templates/ -O build/
  • No context input: No argument, this is default!
  • Template directory input: -T templates/
  • Render directory output: -O build/

Project details


Download files

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

Source Distribution

ccpstencil-0.8.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccpstencil-0.8.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file ccpstencil-0.8.0.tar.gz.

File metadata

  • Download URL: ccpstencil-0.8.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for ccpstencil-0.8.0.tar.gz
Algorithm Hash digest
SHA256 2aa40a8bf77725a04e2077ad10d50977e9052a2d4b7257266a1a3f9a7e60a6ec
MD5 0858fabdac25c7be71371bd88fec89ba
BLAKE2b-256 fc8c811bf8d72c198ff979d5a3f86a04913becc080faaa5285f4429c2b72ef1c

See more details on using hashes here.

File details

Details for the file ccpstencil-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: ccpstencil-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for ccpstencil-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c67d0bff0d08e35482b1d9c1448b899e3203e41484c8740c8ecde17b2bdb4b19
MD5 a2817d4d83f2fd4e7ab23315e4b06bfe
BLAKE2b-256 98f9c78a4a264eb947c3b33f8f4611afdd02fc6afb102f6063ba90d45e8f1848

See more details on using hashes here.

Supported by

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