Skip to content

theoryforge (Python)

theoryforge treats a scientific theory as a versioned, machine-checkable object, so that building, developing and testing it becomes systematic and reproducible. It targets the familiar weaknesses of soft-science theorising: vague constructs, unfalsifiable claims, redundant 'jingle-jangle' constructs and amendments that quietly weaken the theory they were meant to strengthen. Each weakness becomes something the package can name and check.

The package scaffolds the three workflow modes (building, development and testing), scores a theory against a 12-item structural rigour checklist drawn from the methodology literature, generates diagrams and positions the theory within the bibliometric literature. This is the Python twin of the R package of the same name, and the two return identical results (see the API reference for the shared specification behind that guarantee).

For the fuller rationale, what each rigour check establishes, and exactly how every reported value is computed, see Methodological foundations. For a step-by-step walkthrough, see Get started. The repository README gives an overview and the API reference lists every function.

Try it in your browser (no install)

The interactive web app runs this package entirely client-side via Pyodide. Load a theory, run any of the operations it offers, from the rigour checklist through to the literature map, and export both the visualisation (SVG/PNG) and the Python code to reproduce it.

Install

pip install theoryforge

A first look

import theoryforge as tf

t = tf.read("panic-network.theory.yaml")
t.check()                       # 12-item rigour checklist + gate
t.severity()                    # operationalised severity rubric
t.preregister()                 # preregistration document
corpus = tf.read_corpus("panic-corpus.yaml")
t.landscape(corpus)             # under-theorised fronts + redundancy risk

Author

theoryforge is written and maintained by Pablo Bernabeu. The R and Python packages share one specification and are released under the MIT licence.

Archived on Zenodo: DOI