Skip to main content

run DYNARE from python and access its workspace

Project description

This is a slim Python API to Dynare. It runs the *.mod file, displays the resulting output, and then provides access to the Dynare workspace. It works with both, Matlab and Octave.

For fellow linux users (and probably mac users as well), this also provides a script to execute Dynare from comand line.

NOTE: This is at a very early stage and not well-tested (and not tested at all on Windows). Comments via the bug tracker are very welcome.


The declared goal of this project is to provide access to Dynare without having to learn and use Matlab / Octave. This reflects the acknowledgement that the translation of the Dynare codebase to a more efficient open source alternative is a major effort which may take a while. Meanwhile, pynare encourages young researchers to focus on modern open source languages and, as the whole interface is pure Python, still allows them to use Dynare without Matlab.


Package import and running a modfile:

from pynare import pynare
modfile = '/path/to/greatmodel.mod'
mod = pynare(modfile)

This will give you the usual info about how the Blanchard-Kahn conditions are messed up. Then access the attributes:

mod.workspace                   # will give you the matlab workspace
print(mod.workspace['beta'])    # it contains all the parameters
>>> 0.995                       # likely to be the case

I also added the oo_ Dynare-object, which contains a lot of usefull stuff. Note that you could have also accessed it via mod.workspace['oo_'].

mod.oo_.keys()              # it is a dict, so browse it via `keys()`
irfs = mod.oo_['irfs']      # for instance get your impulse response functions (it's again a dict). Maybe plot them?

Just evoking pynare from the comand prompt/shell is as simple as

pynare modelpath/crazy.mod

Installation via pip

Installation is as simply as running (Windows user from the Anaconda Prompt):

pip install pynare

Of course, installing Dynare remains your responibility.

If you care for the bleeding edge developing version (which, at this stage, is recommended), the handy way is to install via the git-command. If you hav not yet installed git, Windows users get it here: (Linux users just use the repo of their distro). Then:

pip install git+

Project details

Release history Release notifications

This version


Download files

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

Files for pynare, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size pynare-0.1.5-py3-none-any.whl (6.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pynare-0.1.5.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page