From 445eb035193fd0955e48036e5be52826fe877ffa Mon Sep 17 00:00:00 2001
From: Daniel Sali <daniel.sali@alphacruncher.com>
Date: Fri, 29 Nov 2024 16:13:11 +0100
Subject: [PATCH] Rename package to , add scipy dependency

---
 .gitignore                                     |  3 ++-
 README.md                                      | 11 ++++++++++-
 pyproject.toml                                 |  3 ++-
 src/{dynarepython => dynare}/__init__.py       |  3 +++
 src/{dynarepython => dynare}/distributions.py  |  0
 src/{dynarepython => dynare}/dynare.py         |  4 ++--
 src/{dynarepython => dynare}/dynare_context.py |  2 +-
 src/{dynarepython => dynare}/juliapkg.json     |  0
 src/{dynarepython => dynare}/workspace.py      |  8 ++++----
 test/test_dynare.py                            |  7 -------
 10 files changed, 24 insertions(+), 17 deletions(-)
 rename src/{dynarepython => dynare}/__init__.py (96%)
 rename src/{dynarepython => dynare}/distributions.py (100%)
 rename src/{dynarepython => dynare}/dynare.py (98%)
 rename src/{dynarepython => dynare}/dynare_context.py (99%)
 rename src/{dynarepython => dynare}/juliapkg.json (100%)
 rename src/{dynarepython => dynare}/workspace.py (99%)

diff --git a/.gitignore b/.gitignore
index c8886fd..e1ea87a 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 85a0fc3..5ffc455 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 c3001b0..976f30f 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 ce708a9..ffc4bc8 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 1040e2d..f94bd3e 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 7c705f4..aa7710c 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 284045c..3ed2942 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 082ea4a..942e859 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
 
 
-- 
GitLab