ModelFlowIb 2.61__tar.gz → 2.62__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. {modelflowib-2.61 → modelflowib-2.62}/ModelFlowIb.egg-info/PKG-INFO +1 -1
  2. {modelflowib-2.61 → modelflowib-2.62}/PKG-INFO +1 -1
  3. {modelflowib-2.61 → modelflowib-2.62}/modelclass.py +65 -41
  4. {modelflowib-2.61 → modelflowib-2.62}/modelreport.py +1 -1
  5. {modelflowib-2.61 → modelflowib-2.62}/pyproject.toml +1 -1
  6. {modelflowib-2.61 → modelflowib-2.62}/ModelFlowIb.egg-info/SOURCES.txt +0 -0
  7. {modelflowib-2.61 → modelflowib-2.62}/ModelFlowIb.egg-info/dependency_links.txt +0 -0
  8. {modelflowib-2.61 → modelflowib-2.62}/ModelFlowIb.egg-info/requires.txt +0 -0
  9. {modelflowib-2.61 → modelflowib-2.62}/ModelFlowIb.egg-info/top_level.txt +0 -0
  10. {modelflowib-2.61 → modelflowib-2.62}/modelBLfunk.py +0 -0
  11. {modelflowib-2.61 → modelflowib-2.62}/model_Excel.py +0 -0
  12. {modelflowib-2.61 → modelflowib-2.62}/model_cvx.py +0 -0
  13. {modelflowib-2.61 → modelflowib-2.62}/model_doable.py +0 -0
  14. {modelflowib-2.61 → modelflowib-2.62}/model_dynare.py +0 -0
  15. {modelflowib-2.61 → modelflowib-2.62}/model_financial_stability.py +0 -0
  16. {modelflowib-2.61 → modelflowib-2.62}/model_ifrs9.py +0 -0
  17. {modelflowib-2.61 → modelflowib-2.62}/model_latex.py +0 -0
  18. {modelflowib-2.61 → modelflowib-2.62}/model_latex_class.py +0 -0
  19. {modelflowib-2.61 → modelflowib-2.62}/model_run_numba.py +0 -0
  20. {modelflowib-2.61 → modelflowib-2.62}/modelclass2.py +0 -0
  21. {modelflowib-2.61 → modelflowib-2.62}/modeldash.py +0 -0
  22. {modelflowib-2.61 → modelflowib-2.62}/modeldashboot.py +0 -0
  23. {modelflowib-2.61 → modelflowib-2.62}/modeldashsidebar.py +0 -0
  24. {modelflowib-2.61 → modelflowib-2.62}/modeldekom.py +0 -0
  25. {modelflowib-2.61 → modelflowib-2.62}/modeldiff.py +0 -0
  26. {modelflowib-2.61 → modelflowib-2.62}/modeldisplay.py +0 -0
  27. {modelflowib-2.61 → modelflowib-2.62}/modelfeedback.py +0 -0
  28. {modelflowib-2.61 → modelflowib-2.62}/modelgrab.py +0 -0
  29. {modelflowib-2.61 → modelflowib-2.62}/modelgrabwf2.py +0 -0
  30. {modelflowib-2.61 → modelflowib-2.62}/modelhelp.py +0 -0
  31. {modelflowib-2.61 → modelflowib-2.62}/modelinvert.py +0 -0
  32. {modelflowib-2.61 → modelflowib-2.62}/modeljupyter.py +0 -0
  33. {modelflowib-2.61 → modelflowib-2.62}/modeljupytermagic.py +0 -0
  34. {modelflowib-2.61 → modelflowib-2.62}/modelmacrograb.py +0 -0
  35. {modelflowib-2.61 → modelflowib-2.62}/modelmanipulation.py +0 -0
  36. {modelflowib-2.61 → modelflowib-2.62}/modelmf.py +0 -0
  37. {modelflowib-2.61 → modelflowib-2.62}/modelnet.py +0 -0
  38. {modelflowib-2.61 → modelflowib-2.62}/modelnewton.py +0 -0
  39. {modelflowib-2.61 → modelflowib-2.62}/modelnormalize.py +0 -0
  40. {modelflowib-2.61 → modelflowib-2.62}/modelpattern.py +0 -0
  41. {modelflowib-2.61 → modelflowib-2.62}/modelpatternrev.py +0 -0
  42. {modelflowib-2.61 → modelflowib-2.62}/modelsandbox.py +0 -0
  43. {modelflowib-2.61 → modelflowib-2.62}/modelsandbox_Mixin.py +0 -0
  44. {modelflowib-2.61 → modelflowib-2.62}/modeltodo.py +0 -0
  45. {modelflowib-2.61 → modelflowib-2.62}/modeluserfunk.py +0 -0
  46. {modelflowib-2.61 → modelflowib-2.62}/modeluserfunk_old.py +0 -0
  47. {modelflowib-2.61 → modelflowib-2.62}/modelvis.py +0 -0
  48. {modelflowib-2.61 → modelflowib-2.62}/modelwidget.py +0 -0
  49. {modelflowib-2.61 → modelflowib-2.62}/modelwidget_input.py +0 -0
  50. {modelflowib-2.61 → modelflowib-2.62}/modelwidget_shinypy.py +0 -0
  51. {modelflowib-2.61 → modelflowib-2.62}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ModelFlowIb
3
- Version: 2.61
3
+ Version: 2.62
4
4
  Summary: A tool to solve and manage dynamic economic models
5
5
  Author-email: Ib Hansen <your@email.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ModelFlowIb
3
- Version: 2.61
3
+ Version: 2.62
4
4
  Summary: A tool to solve and manage dynamic economic models
5
5
  Author-email: Ib Hansen <your@email.com>
6
6
  License: MIT
@@ -2074,6 +2074,8 @@ class Model_help_Mixin():
2074
2074
  repo_name: str = 'wb-repos',
2075
2075
  branch: str = 'main',
2076
2076
  destination = './wb-repos',
2077
+ subfolder = '',
2078
+
2077
2079
  go = True,
2078
2080
  colab=False,
2079
2081
  silent=True,
@@ -2106,12 +2108,21 @@ class Model_help_Mixin():
2106
2108
  Copy files from src to dst if they do not already exist in dst.
2107
2109
  src and dst are Path objects or strings representing the source and destination directories.
2108
2110
  """
2111
+ # src_path = Path(src) / subfolder
2109
2112
  src_path = Path(src)
2113
+
2110
2114
  dst_path = Path(dst)
2111
-
2115
+ # print(f'Source {src_path.resolve()=}')
2116
+
2112
2117
  for item in src_path.glob('**/*'): # **/* means all files and directories recursively
2118
+ # print(f'{item=}')
2113
2119
  if item.is_file(): # Only proceed if it's a file
2114
2120
  relative_path = item.relative_to(src_path)
2121
+ # print(f'{relative_path.parts=}')
2122
+ if subfolder:
2123
+ # print(f'{relative_path.parts[1]} = {subfolder}')
2124
+ if relative_path.parts[1] != subfolder :
2125
+ continue
2115
2126
  relative_path_parts_except_first = relative_path.parts[1:]
2116
2127
  relative_path_except_first = Path(*relative_path_parts_except_first)
2117
2128
  destination_file = dst_path / relative_path_except_first
@@ -2153,7 +2164,7 @@ class Model_help_Mixin():
2153
2164
  return f"An error occurred: {e}"
2154
2165
 
2155
2166
 
2156
- new_location =Path(destination)
2167
+ new_location =Path(destination)
2157
2168
 
2158
2169
  # if reset:
2159
2170
  # if new_location.exists() and new_location.is_dir():
@@ -2162,6 +2173,9 @@ class Model_help_Mixin():
2162
2173
 
2163
2174
 
2164
2175
  copy_new_files_only(extract_to,new_location)
2176
+ if not silent:
2177
+ print(f'Start in : {new_location/subfolder}')
2178
+ print(f'Models copied to: {new_location.resolve()}')
2165
2179
  shutil.rmtree(extract_to)
2166
2180
  if go:
2167
2181
  if colab:
@@ -2169,22 +2183,66 @@ class Model_help_Mixin():
2169
2183
  colab=colab,
2170
2184
  owner = owner,
2171
2185
  repo_name = repo_name,
2172
- branch = branch,
2186
+ branch = branch, skipdir=2 if subfolder else 1
2173
2187
 
2174
2188
  )
2175
2189
  else:
2176
- model.display_toc_github('**Avaiable notebooks**',folder=new_location,colab=False)
2190
+ model.display_toc_github('**Avaiable notebooks**',folder=new_location,
2191
+ colab=False, skipdir=2 if subfolder else 1,
2192
+
2193
+ )
2177
2194
 
2178
2195
 
2179
2196
  return
2197
+
2198
+ @staticmethod
2199
+ def Worldbank_Models(owner: str = "worldbank",
2200
+ repo_name: str = 'MFMod-ModelFlow',
2201
+ branch: str = 'main',
2202
+ destination = './WorldbankModels',
2203
+ subfolder = 'models',
2204
+ go = True,
2205
+ silent=True,
2206
+ replace = False ,
2207
+ ):
2208
+ """
2209
+ Download an entire GitHub repository and extract it to a specified location.
2180
2210
 
2211
+ Parameters:
2212
+ owner: The owner of the GitHub repository.
2213
+ repo_name: The name of the repository.
2214
+ branch: The branch to download.
2215
+ destination: The local path where the repository should be extracted.
2216
+ go: display toc of notebooks
2217
+ silent: keep silent
2218
+
2219
+ Returns:
2220
+ A message indicating whether the download was successful or not.
2221
+ """
2222
+
2223
+ return model.download_github_repo(owner = owner,
2224
+ repo_name = repo_name,
2225
+ branch = branch,
2226
+ destination = destination ,
2227
+ subfolder = subfolder,
2228
+ go = go ,
2229
+ silent=silent,
2230
+ replace = replace,
2231
+ colab=model.is_running_in_colab()
2232
+ )
2233
+
2234
+
2235
+
2236
+
2237
+
2181
2238
  @staticmethod
2182
2239
  def display_toc_github(text='**Jupyter notebooks**',folder='.',all=False,nocwd=False,
2183
2240
  colab=True,
2184
2241
  owner: str = "IbHansen",
2185
2242
  repo_name: str = 'wb-repos',
2186
2243
  branch: str = 'main',
2187
- destination = './wb-repos',
2244
+ destination = './wb-repos',
2245
+ skipdir = 1,
2188
2246
 
2189
2247
  ):
2190
2248
  '''In a jupyter notebook this function displays a clickable table of content of all
@@ -2213,7 +2271,7 @@ class Model_help_Mixin():
2213
2271
  blanks = ''.join(
2214
2272
  ['&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;']*len(dir.parts))
2215
2273
  if len(dir.parts):
2216
- thisdir = Path(*dir.parts[1:])
2274
+ thisdir = Path(*dir.parts[skipdir:])
2217
2275
  display(HTML(f'{blanks}<b>{str(thisdir)}</b>'))
2218
2276
  else:
2219
2277
  display(
@@ -2236,41 +2294,7 @@ class Model_help_Mixin():
2236
2294
 
2237
2295
 
2238
2296
 
2239
- @staticmethod
2240
- def Worldbank_Models(owner: str = "worldbank",
2241
- repo_name: str = 'MFMod-ModelFlow',
2242
- branch: str = 'main',
2243
- destination = './WorldbankModels',
2244
- go = True,
2245
- silent=True,
2246
- replace = False ,
2247
- ):
2248
- """
2249
- Download an entire GitHub repository and extract it to a specified location.
2250
-
2251
- Parameters:
2252
- owner: The owner of the GitHub repository.
2253
- repo_name: The name of the repository.
2254
- branch: The branch to download.
2255
- destination: The local path where the repository should be extracted.
2256
- go: display toc of notebooks
2257
- silent: keep silent
2258
-
2259
- Returns:
2260
- A message indicating whether the download was successful or not.
2261
- """
2262
-
2263
- return model.download_github_repo(owner = owner,
2264
- repo_name = repo_name,
2265
- branch = branch,
2266
- destination = destination ,
2267
- go = go ,
2268
- silent=silent,
2269
- replace = replace,
2270
- colab=model.is_running_in_colab()
2271
- )
2272
-
2273
-
2297
+
2274
2298
 
2275
2299
 
2276
2300
  @staticmethod
@@ -796,7 +796,7 @@ class LatexRepo:
796
796
  if xx0.returncode:
797
797
  wb.open(latex_dir.absolute(), new=1)
798
798
 
799
- raise Exception(f'Error creating PDF file, {xx0.returncode}, is latex installed. If so look in the latex file, {latex_file}')
799
+ raise Exception(f'Error creating PDF file, {xx0.returncode},\n is latex installed?. If so look in the latex file, {latex_file}')
800
800
 
801
801
  if pdfopen:
802
802
  fileurl = f'file://{pdf_file.resolve()}'
@@ -7,7 +7,7 @@ where = ["."]
7
7
 
8
8
  [project]
9
9
  name = "ModelFlowIb"
10
- version = "2.61"
10
+ version = "2.62"
11
11
  description = "A tool to solve and manage dynamic economic models"
12
12
  authors = [{name = "Ib Hansen", email = "your@email.com"}]
13
13
  license = { text = "MIT" }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes