PSLmodels / OG-USA

Overlapping-generations macroeconomic model for evaluating fiscal policy in the United States
https://pslmodels.github.io/OG-USA/
Creative Commons Zero v1.0 Universal
19 stars 34 forks source link

Can we have `ogusa_default_parameters.json` file available from `pip` install? #81

Closed jdebacker closed 1 month ago

jdebacker commented 10 months ago

I'm wondering if there is any way to package `ogusa_default_parameters.json with the PyPI distribution and allow users of that package to access this JSON file directly from the package. e.g., something like ogusa.ogusa_default_parameters.json

Is this possible?

In general, I want to best think through how users who don't want to clone the repo to bring down files locally can use the OG-USA default calibration from this package.

A possible solution is to have them install the package and then read the JSON file directly from the github URL. But wondering if there are other options.

jdebacker commented 1 month ago

We've figured this out. One can use:

with importlib.resources.open_text(
        "ogusa", "ogusa_default_parameters.json"
    ) as file:
        defaults = json.load(file)
    p.update_specifications(defaults)