diff --git a/.gitignore b/.gitignore index c8886fda8138055380e7aee21df07425dc5323bb..e1ea87a665706d726355d6ac2d7a936499d563da 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ julia/ __pycache__ *.pyc dist/ -*.egg-info/ \ No newline at end of file +*.egg-info/ +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index 85a0fc3d8d138a668896b66c3df8f5c89404d5d0..5ffc455a8718145413c7e343a58613654506c715 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,13 @@ pip install git+https://git.dynare.org/Dynare/dynare-python.git ## Example -For an example on how to use the package, see `test/test_dynare.py`. \ No newline at end of file +For an example on how to use the package, see `test/test_dynare.py`. + +### Simple example + +```python +from dynare import dynare + +context = dynare("<path_to_model_file.mod>") +print(context) +``` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c3001b0f3dcaa0dfd0e5017f74a912e262732c48..976f30f8021138050b9068db6fc21aeac986ae6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "DynarePython" +name = "dynare" version = "0.1.0" description = "A Python wrapper for the Dynare.jl Julia package" authors = [ @@ -14,6 +14,7 @@ dependencies = [ "juliacall", "numpy", "pandas", + "scipy", ] requires-python = ">=3.8" classifiers = [ diff --git a/src/dynarepython/__init__.py b/src/dynare/__init__.py similarity index 96% rename from src/dynarepython/__init__.py rename to src/dynare/__init__.py index ce708a94085cfa0ffcad7e2a13badb9d68489c2d..ffc4bc82812a2d6313d1183d85b82936c8c6a2d8 100644 --- a/src/dynarepython/__init__.py +++ b/src/dynare/__init__.py @@ -1,6 +1,7 @@ import subprocess import logging from juliacall import Main as jl +from .dynare import dynare logging.basicConfig( @@ -45,3 +46,5 @@ def _run_once(): _run_once() + +__all__ = ["dynare"] \ No newline at end of file diff --git a/src/dynarepython/distributions.py b/src/dynare/distributions.py similarity index 100% rename from src/dynarepython/distributions.py rename to src/dynare/distributions.py diff --git a/src/dynarepython/dynare.py b/src/dynare/dynare.py similarity index 98% rename from src/dynarepython/dynare.py rename to src/dynare/dynare.py index 1040e2d26ebac6a53e1e6979812342965fc8f746..f94bd3ef11fea2318cf5694fc1ed8927d19a7256 100644 --- a/src/dynarepython/dynare.py +++ b/src/dynare/dynare.py @@ -3,10 +3,10 @@ import time import os from pathlib import Path from juliacall import Main as jl -from dynare_context import Context +from .dynare_context import Context -logger = logging.getLogger("DynarePython.dynare") +logger = logging.getLogger("dynare.dynare") def dynare(model: Path) -> Context: diff --git a/src/dynarepython/dynare_context.py b/src/dynare/dynare_context.py similarity index 99% rename from src/dynarepython/dynare_context.py rename to src/dynare/dynare_context.py index 7c705f49009cd0e07af40560380d9cd51b3f4e5b..aa7710c8895a01245ae76f1289ac1d3d2903bca8 100644 --- a/src/dynarepython/dynare_context.py +++ b/src/dynare/dynare_context.py @@ -9,7 +9,7 @@ import pandas as pd import scipy.stats as stats -logger = logging.getLogger("DynarePython.dynare_context") +logger = logging.getLogger("dynare.dynare_context") class SymbolType(Enum): diff --git a/src/dynarepython/juliapkg.json b/src/dynare/juliapkg.json similarity index 100% rename from src/dynarepython/juliapkg.json rename to src/dynare/juliapkg.json diff --git a/src/dynarepython/workspace.py b/src/dynare/workspace.py similarity index 99% rename from src/dynarepython/workspace.py rename to src/dynare/workspace.py index 284045c5296541bbf59a64841e58fecb15475b75..3ed2942828f26bb701c35ed67915122f1afb7ea1 100644 --- a/src/dynarepython/workspace.py +++ b/src/dynare/workspace.py @@ -355,9 +355,9 @@ class PyGsSolverWs: tmp2: np.ndarray g1: np.ndarray g2: np.ndarray - luws1: "PyLUWs" - luws2: "PyLUWs" - schurws: "PyGeneralizedSchurWs" + luws1: PyLUWs + luws2: PyLUWs + schurws: PyGeneralizedSchurWs @classmethod def from_julia(cls, d, n1): @@ -397,7 +397,7 @@ class PyLinearGsSolverWs: @dataclass class PyLinearCyclicReductionWs: - solver_ws: "PyCyclicReductionWs" + solver_ws: PyCyclicReductionWs ids: PyIndices a: List[float] b: List[float] diff --git a/test/test_dynare.py b/test/test_dynare.py index 082ea4a9eec4d4a4748754c10cad5d77cf2b1477..942e8590ab280b195a8cec990b181e6203e580d4 100644 --- a/test/test_dynare.py +++ b/test/test_dynare.py @@ -1,11 +1,4 @@ -import sys -import os from pathlib import Path - -# Add the ../src folder to the system path -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../src/dynarepython"))) - - from dynare import dynare