Prototype of LSST DocHub (www.lsst.io) as a static website generator.
The DocHub project is an effort to index LSST's meta information — such as documents, software, tickets, and conversations — to make them accessible from a single website and API. Read more about the DocHub concept in SQR-013: LSST DocHub Design.
#/usr/bin/env python from dochubproto import DocHubProto p = DocHubProto() idx = p.render_index()
DocHubProto uses the following environment variables:
KEEPER_URL(defaulthttps://keeper.lsst.codes).LOGLEVEL(defaultWARNING).TEMPLATE_DIR: directory containing Jinja2 templates (defaulttemplates).UL_TEMPLATE_NAME: relative path to template for individual document items (defaultdoclist.jinja2).IDX_TEMPLATE_NAME: relative path to theindex.htmltemplate (defaultindex.jinja2).MAX_DOCUMENT_DATA_AGE: maximum cache age in seconds of a document (default3600).
check_state()returns one of:STATE_EMPTY('empty')STATE_READY('ready')STATE_REFRESHING('refreshing')STATE_STALE('stale')
A document is 'stale' if it is older than
MAX_DOCUMENT_DATA_AGE.get_document_data()andget_fresh_document_data()return adictwhose keys are document sections (e.g.DMTN) and within each section, a list ordered by document handle (e.g.dmtn-038).render()returns an HTML unordered list entity created from the document data, encoded as UTF-8.render_index()returns an HTML document created from the document data, encoded as UTF-8.debug(),info(),warning(),error(), andcritical()each log a message at the specified level; it uses a structlog logger to log JSON output via apikit.