PyGeoModel 1.0.6__tar.gz → 1.0.8__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 (37) hide show
  1. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/PKG-INFO +2 -27
  2. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/PyGeoModel.egg-info/PKG-INFO +2 -27
  3. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/README.md +1 -25
  4. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/__init__.py +1 -1
  5. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/config.py +10 -5
  6. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/results.py +1 -1
  7. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/setup.py +1 -2
  8. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/tests/test_core_api.py +46 -0
  9. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/LICENSE +0 -0
  10. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/MANIFEST.in +0 -0
  11. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/PyGeoModel.egg-info/SOURCES.txt +0 -0
  12. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/PyGeoModel.egg-info/dependency_links.txt +0 -0
  13. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/PyGeoModel.egg-info/requires.txt +0 -0
  14. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/PyGeoModel.egg-info/top_level.txt +0 -0
  15. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/__init__.py +0 -0
  16. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/base.py +0 -0
  17. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/constants.py +0 -0
  18. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/openModel.py +0 -0
  19. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/openUtils/__init__.py +0 -0
  20. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/openUtils/exceptions.py +0 -0
  21. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/openUtils/http_client.py +0 -0
  22. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/openUtils/mdlUtils.py +0 -0
  23. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/openUtils/parameterValidator.py +0 -0
  24. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/ogmsServer2/openUtils/stateManager.py +0 -0
  25. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/client.py +0 -0
  26. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/consensus.py +0 -0
  27. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/context.py +0 -0
  28. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/data/__init__.py +0 -0
  29. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/data/computeModel.json +0 -0
  30. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/data/modelContext.txt +0 -0
  31. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/modeler.py +0 -0
  32. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/models.py +0 -0
  33. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/notebook.py +0 -0
  34. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/qa.py +0 -0
  35. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/pygeomodel/recommendation.py +0 -0
  36. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/scripts.py +0 -0
  37. {pygeomodel-1.0.6 → pygeomodel-1.0.8}/setup.cfg +0 -0
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyGeoModel
3
- Version: 1.0.6
3
+ Version: 1.0.8
4
4
  Summary: A Python package for integrating OpenGMS geographic model services.
5
5
  Home-page: https://github.com/MpLebron/PyGeoModel
6
6
  Author: Peilong Ma
7
7
  Author-email: mpl_gis@nnu.edu.cn
8
8
  Keywords: geographic modeling,GIS,OpenGMS,model services,geospatial analysis,jupyter
9
- Classifier: Development Status :: 4 - Beta
10
9
  Classifier: Intended Audience :: Science/Research
11
10
  Classifier: Topic :: Scientific/Engineering :: GIS
12
11
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -91,20 +90,6 @@ result = modeler.invoke(
91
90
  result.to_json("execution_record.json")
92
91
  ```
93
92
 
94
- OpenGMS execution uses the bundled public demo token by default. For stable or private use, configure your own OpenGMS token:
95
-
96
- ```bash
97
- export OGMS_TOKEN="your-token"
98
- ```
99
-
100
- Optional endpoint overrides:
101
-
102
- ```bash
103
- export OGMS_BASE_PORTAL_URL="http://222.192.7.75"
104
- export OGMS_BASE_MANAGER_URL="http://222.192.7.75/managerServer"
105
- export OGMS_BASE_DATA_URL="http://222.192.7.75/dataTransferServer"
106
- ```
107
-
108
93
  ## Notebook Interface
109
94
 
110
95
  ```python
@@ -124,18 +109,8 @@ answer = modeler.ask_model("SWAT_Model", "What input data are required?")
124
109
  answer.to_json("qa_record.json")
125
110
  ```
126
111
 
127
- The recommendation service automatically builds notebook/data context and calls the configured Dify workflow. `DIFY_API_KEY` is required for `suggest_model()` because the context-aware recommendation logic is implemented in that workflow. Q&A uses OpenGMS model metadata and, when configured, an OpenAI-compatible web-enabled model.
112
+ The recommendation service automatically builds notebook/data context and calls the configured recommendation workflow. Q&A uses OpenGMS model metadata and an OpenAI-compatible web-enabled model. The main notebook workflow is designed to run out of the box for demonstration use.
128
113
 
129
114
  ## Relation to OpenGMS
130
115
 
131
116
  OpenGMS provides the model-service platform and online execution infrastructure. PyGeoModel is a Python client package that exposes OpenGMS model-service discovery, metadata inspection, task invocation, and result records to Python and notebook workflows.
132
-
133
- ## Development
134
-
135
- Run the lightweight test suite with:
136
-
137
- ```bash
138
- python -m unittest discover -s tests
139
- ```
140
-
141
- The source distribution should not include real API keys, local `.env` files, bytecode caches, generated C files, `.pyd` binaries, or previous build artifacts.
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyGeoModel
3
- Version: 1.0.6
3
+ Version: 1.0.8
4
4
  Summary: A Python package for integrating OpenGMS geographic model services.
5
5
  Home-page: https://github.com/MpLebron/PyGeoModel
6
6
  Author: Peilong Ma
7
7
  Author-email: mpl_gis@nnu.edu.cn
8
8
  Keywords: geographic modeling,GIS,OpenGMS,model services,geospatial analysis,jupyter
9
- Classifier: Development Status :: 4 - Beta
10
9
  Classifier: Intended Audience :: Science/Research
11
10
  Classifier: Topic :: Scientific/Engineering :: GIS
12
11
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -91,20 +90,6 @@ result = modeler.invoke(
91
90
  result.to_json("execution_record.json")
92
91
  ```
93
92
 
94
- OpenGMS execution uses the bundled public demo token by default. For stable or private use, configure your own OpenGMS token:
95
-
96
- ```bash
97
- export OGMS_TOKEN="your-token"
98
- ```
99
-
100
- Optional endpoint overrides:
101
-
102
- ```bash
103
- export OGMS_BASE_PORTAL_URL="http://222.192.7.75"
104
- export OGMS_BASE_MANAGER_URL="http://222.192.7.75/managerServer"
105
- export OGMS_BASE_DATA_URL="http://222.192.7.75/dataTransferServer"
106
- ```
107
-
108
93
  ## Notebook Interface
109
94
 
110
95
  ```python
@@ -124,18 +109,8 @@ answer = modeler.ask_model("SWAT_Model", "What input data are required?")
124
109
  answer.to_json("qa_record.json")
125
110
  ```
126
111
 
127
- The recommendation service automatically builds notebook/data context and calls the configured Dify workflow. `DIFY_API_KEY` is required for `suggest_model()` because the context-aware recommendation logic is implemented in that workflow. Q&A uses OpenGMS model metadata and, when configured, an OpenAI-compatible web-enabled model.
112
+ The recommendation service automatically builds notebook/data context and calls the configured recommendation workflow. Q&A uses OpenGMS model metadata and an OpenAI-compatible web-enabled model. The main notebook workflow is designed to run out of the box for demonstration use.
128
113
 
129
114
  ## Relation to OpenGMS
130
115
 
131
116
  OpenGMS provides the model-service platform and online execution infrastructure. PyGeoModel is a Python client package that exposes OpenGMS model-service discovery, metadata inspection, task invocation, and result records to Python and notebook workflows.
132
-
133
- ## Development
134
-
135
- Run the lightweight test suite with:
136
-
137
- ```bash
138
- python -m unittest discover -s tests
139
- ```
140
-
141
- The source distribution should not include real API keys, local `.env` files, bytecode caches, generated C files, `.pyd` binaries, or previous build artifacts.
@@ -45,20 +45,6 @@ result = modeler.invoke(
45
45
  result.to_json("execution_record.json")
46
46
  ```
47
47
 
48
- OpenGMS execution uses the bundled public demo token by default. For stable or private use, configure your own OpenGMS token:
49
-
50
- ```bash
51
- export OGMS_TOKEN="your-token"
52
- ```
53
-
54
- Optional endpoint overrides:
55
-
56
- ```bash
57
- export OGMS_BASE_PORTAL_URL="http://222.192.7.75"
58
- export OGMS_BASE_MANAGER_URL="http://222.192.7.75/managerServer"
59
- export OGMS_BASE_DATA_URL="http://222.192.7.75/dataTransferServer"
60
- ```
61
-
62
48
  ## Notebook Interface
63
49
 
64
50
  ```python
@@ -78,18 +64,8 @@ answer = modeler.ask_model("SWAT_Model", "What input data are required?")
78
64
  answer.to_json("qa_record.json")
79
65
  ```
80
66
 
81
- The recommendation service automatically builds notebook/data context and calls the configured Dify workflow. `DIFY_API_KEY` is required for `suggest_model()` because the context-aware recommendation logic is implemented in that workflow. Q&A uses OpenGMS model metadata and, when configured, an OpenAI-compatible web-enabled model.
67
+ The recommendation service automatically builds notebook/data context and calls the configured recommendation workflow. Q&A uses OpenGMS model metadata and an OpenAI-compatible web-enabled model. The main notebook workflow is designed to run out of the box for demonstration use.
82
68
 
83
69
  ## Relation to OpenGMS
84
70
 
85
71
  OpenGMS provides the model-service platform and online execution infrastructure. PyGeoModel is a Python client package that exposes OpenGMS model-service discovery, metadata inspection, task invocation, and result records to Python and notebook workflows.
86
-
87
- ## Development
88
-
89
- Run the lightweight test suite with:
90
-
91
- ```bash
92
- python -m unittest discover -s tests
93
- ```
94
-
95
- The source distribution should not include real API keys, local `.env` files, bytecode caches, generated C files, `.pyd` binaries, or previous build artifacts.
@@ -5,7 +5,7 @@ from .modeler import GeoModeler
5
5
  from .models import ModelInput, ModelOutput, ModelService, ModelSummary
6
6
  from .results import QAResult, RecommendationResult, TaskResult
7
7
 
8
- __version__ = "1.0.6"
8
+ __version__ = "1.0.8"
9
9
 
10
10
  __all__ = [
11
11
  "GeoModeler",
@@ -9,6 +9,11 @@ from pathlib import Path
9
9
 
10
10
 
11
11
  PUBLIC_DEMO_OGMS_TOKEN = '6U3O1Sy5696I5ryJFaYCYVjcIV7rhd1MKK0QGX9A7zafogi8xTdvejl6ISUP1lEs'
12
+ PUBLIC_DEMO_DIFY_API_KEY = 'app-CuNONc6hSct2ap07nmUgcaw9'
13
+ PUBLIC_DEMO_DIFY_BASE_URL = 'https://api.dify.ai/v1'
14
+ PUBLIC_DEMO_OPENAI_API_KEY = 'sk-4bp5a1DcdLSHCiw1401270055f47424b9eA58cAd587266A3'
15
+ PUBLIC_DEMO_OPENAI_BASE_URL = 'https://aihubmix.com/v1'
16
+ PUBLIC_DEMO_OPENAI_MODEL = 'gpt-5.2-low'
12
17
 
13
18
 
14
19
  @dataclass(frozen=True)
@@ -47,11 +52,11 @@ def get_llm_config() -> LLMConfig:
47
52
  dify = local.get("dify", {})
48
53
  consensus = local.get("consensus", {})
49
54
  return LLMConfig(
50
- openai_api_key=openai.get("api_key") or os.environ.get("OPENAI_API_KEY"),
51
- openai_base_url=openai.get("base_url") or os.environ.get("OPENAI_BASE_URL") or LLMConfig.openai_base_url,
52
- openai_model=openai.get("model") or os.environ.get("OPENAI_MODEL") or LLMConfig.openai_model,
53
- dify_api_key=dify.get("api_key") or os.environ.get("DIFY_API_KEY"),
54
- dify_base_url=dify.get("base_url") or os.environ.get("DIFY_BASE_URL") or LLMConfig.dify_base_url,
55
+ openai_api_key=os.environ.get("OPENAI_API_KEY") or openai.get("api_key") or PUBLIC_DEMO_OPENAI_API_KEY,
56
+ openai_base_url=os.environ.get("OPENAI_BASE_URL") or openai.get("base_url") or PUBLIC_DEMO_OPENAI_BASE_URL,
57
+ openai_model=os.environ.get("OPENAI_MODEL") or openai.get("model") or PUBLIC_DEMO_OPENAI_MODEL,
58
+ dify_api_key=os.environ.get("DIFY_API_KEY") or dify.get("api_key") or PUBLIC_DEMO_DIFY_API_KEY,
59
+ dify_base_url=os.environ.get("DIFY_BASE_URL") or dify.get("base_url") or PUBLIC_DEMO_DIFY_BASE_URL,
55
60
  consensus_api_key=consensus.get("api_key") or os.environ.get("CONSENSUS_API_KEY"),
56
61
  consensus_base_url=consensus.get("base_url") or os.environ.get("CONSENSUS_BASE_URL") or LLMConfig.consensus_base_url,
57
62
  )
@@ -29,7 +29,7 @@ class TaskResult:
29
29
  params: dict[str, Any] = field(default_factory=dict)
30
30
  uploaded_inputs: dict[str, Any] = field(default_factory=dict)
31
31
  endpoint: str | None = None
32
- pygeomodel_version: str = "1.0.6"
32
+ pygeomodel_version: str = "1.0.8"
33
33
  execution_time: float | None = None
34
34
  created_at: float = field(default_factory=time.time)
35
35
 
@@ -11,7 +11,7 @@ def read_readme():
11
11
 
12
12
  setup(
13
13
  name="PyGeoModel",
14
- version="1.0.6",
14
+ version="1.0.8",
15
15
  author="Peilong Ma",
16
16
  author_email="mpl_gis@nnu.edu.cn",
17
17
  description="A Python package for integrating OpenGMS geographic model services.",
@@ -41,7 +41,6 @@ setup(
41
41
  },
42
42
  python_requires=">=3.8",
43
43
  classifiers=[
44
- "Development Status :: 4 - Beta",
45
44
  "Intended Audience :: Science/Research",
46
45
  "Topic :: Scientific/Engineering :: GIS",
47
46
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
@@ -323,6 +323,52 @@ class CoreApiTests(unittest.TestCase):
323
323
  else:
324
324
  os.environ["OGMS_TOKEN"] = original_env
325
325
 
326
+ def test_llm_config_uses_public_demo_credentials_as_fallback(self):
327
+ import pygeomodel.config as config_module
328
+
329
+ env_keys = ["DIFY_API_KEY", "DIFY_BASE_URL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "OPENAI_MODEL"]
330
+ original_env = {key: os.environ.get(key) for key in env_keys}
331
+ original_loader = config_module._load_local_api_keys
332
+ try:
333
+ config_module._load_local_api_keys = lambda: {}
334
+ for key in env_keys:
335
+ os.environ.pop(key, None)
336
+
337
+ cfg = config_module.get_llm_config()
338
+ self.assertEqual(cfg.dify_api_key, config_module.PUBLIC_DEMO_DIFY_API_KEY)
339
+ self.assertEqual(cfg.dify_base_url, config_module.PUBLIC_DEMO_DIFY_BASE_URL)
340
+ self.assertEqual(cfg.openai_api_key, config_module.PUBLIC_DEMO_OPENAI_API_KEY)
341
+ self.assertEqual(cfg.openai_base_url, config_module.PUBLIC_DEMO_OPENAI_BASE_URL)
342
+ self.assertEqual(cfg.openai_model, config_module.PUBLIC_DEMO_OPENAI_MODEL)
343
+
344
+ config_module._load_local_api_keys = lambda: {
345
+ "dify": {"api_key": "local-dify", "base_url": "https://local-dify.example/v1"},
346
+ "openai": {
347
+ "api_key": "local-openai",
348
+ "base_url": "https://local-openai.example/v1",
349
+ "model": "local-model",
350
+ },
351
+ }
352
+ cfg = config_module.get_llm_config()
353
+ self.assertEqual(cfg.dify_api_key, "local-dify")
354
+ self.assertEqual(cfg.openai_api_key, "local-openai")
355
+ self.assertEqual(cfg.openai_model, "local-model")
356
+
357
+ os.environ["DIFY_API_KEY"] = "env-dify"
358
+ os.environ["OPENAI_API_KEY"] = "env-openai"
359
+ os.environ["OPENAI_MODEL"] = "env-model"
360
+ cfg = config_module.get_llm_config()
361
+ self.assertEqual(cfg.dify_api_key, "env-dify")
362
+ self.assertEqual(cfg.openai_api_key, "env-openai")
363
+ self.assertEqual(cfg.openai_model, "env-model")
364
+ finally:
365
+ config_module._load_local_api_keys = original_loader
366
+ for key, value in original_env.items():
367
+ if value is None:
368
+ os.environ.pop(key, None)
369
+ else:
370
+ os.environ[key] = value
371
+
326
372
  def test_recommendation_result_has_notebook_rich_display(self):
327
373
  from pygeomodel import RecommendationResult
328
374
 
File without changes
File without changes
File without changes
File without changes
File without changes