perd 0.0.7a3__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 (36) hide show
  1. perd-0.0.7a3/MANIFEST.in +3 -0
  2. perd-0.0.7a3/PKG-INFO +280 -0
  3. perd-0.0.7a3/README.md +243 -0
  4. perd-0.0.7a3/per_datasets/__init__.py +26 -0
  5. perd-0.0.7a3/per_datasets/cli.py +197 -0
  6. perd-0.0.7a3/per_datasets/reservoir/__init__.py +9 -0
  7. perd-0.0.7a3/per_datasets/reservoir/load.py +67 -0
  8. perd-0.0.7a3/per_datasets/reservoir/load_random.py +45 -0
  9. perd-0.0.7a3/per_datasets/talkaholic/__init__.py +7 -0
  10. perd-0.0.7a3/per_datasets/talkaholic/reservoir.py +52 -0
  11. perd-0.0.7a3/per_datasets/utils/__init__.py +21 -0
  12. perd-0.0.7a3/per_datasets/utils/api.py +279 -0
  13. perd-0.0.7a3/per_datasets/utils/config.py +28 -0
  14. perd-0.0.7a3/per_datasets/utils/display.py +41 -0
  15. perd-0.0.7a3/per_datasets/utils/init.py +326 -0
  16. perd-0.0.7a3/per_datasets/utils/names/Fields.py +11 -0
  17. perd-0.0.7a3/per_datasets/utils/names/Filters.py +8 -0
  18. perd-0.0.7a3/per_datasets/utils/names/Partitions.py +5 -0
  19. perd-0.0.7a3/per_datasets/utils/names/__init__.py +5 -0
  20. perd-0.0.7a3/per_datasets/utils/units.py +6 -0
  21. perd-0.0.7a3/per_datasets/visual.py +567 -0
  22. perd-0.0.7a3/per_datasets/workflow.py +89 -0
  23. perd-0.0.7a3/per_datasets/workflows/__init__.py +6 -0
  24. perd-0.0.7a3/per_datasets/workflows/runtime.py +853 -0
  25. perd-0.0.7a3/perd.egg-info/PKG-INFO +280 -0
  26. perd-0.0.7a3/perd.egg-info/SOURCES.txt +34 -0
  27. perd-0.0.7a3/perd.egg-info/dependency_links.txt +1 -0
  28. perd-0.0.7a3/perd.egg-info/entry_points.txt +2 -0
  29. perd-0.0.7a3/perd.egg-info/requires.txt +18 -0
  30. perd-0.0.7a3/perd.egg-info/top_level.txt +1 -0
  31. perd-0.0.7a3/pyproject.toml +58 -0
  32. perd-0.0.7a3/requirements.txt +12 -0
  33. perd-0.0.7a3/setup.cfg +4 -0
  34. perd-0.0.7a3/tests/test_initialize.py +271 -0
  35. perd-0.0.7a3/tests/test_visual_streaming.py +169 -0
  36. perd-0.0.7a3/tests/test_workflow_runtime.py +631 -0
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include requirements.txt
3
+ recursive-include per_datasets *.py
perd-0.0.7a3/PKG-INFO ADDED
@@ -0,0 +1,280 @@
1
+ Metadata-Version: 2.4
2
+ Name: perd
3
+ Version: 0.0.7a3
4
+ Summary: A Python package for loading petroleum datasets
5
+ Author-email: PERD Team <data.per@uniben.edu>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/P-E-R-D/library-py
8
+ Project-URL: Bug Tracker, https://github.com/P-E-R-D/library-py/issues
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: ipython<=9.11.0
23
+ Requires-Dist: numpy<=2.4.2
24
+ Requires-Dist: plotly<=6.6.0
25
+ Requires-Dist: matplotlib<=3.10.8
26
+ Requires-Dist: pandas<=3.0.0
27
+ Requires-Dist: python-socketio<=5.16.1
28
+ Requires-Dist: requests<=2.32.5
29
+ Requires-Dist: websocket-client<=1.9.0
30
+ Requires-Dist: nbformat<=5.10.4
31
+ Requires-Dist: anywidget<=0.9.21
32
+ Requires-Dist: ipywidgets<=8.1.8
33
+ Requires-Dist: typing-extensions<=3.10.0.2; python_version < "3.10"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=6.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=2.0; extra == "dev"
37
+
38
+ # perd
39
+
40
+ A Python package for loading reservoir datasets from API endpoints.
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install perd
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ### Option 1: Using Global API Key (Recommended)
51
+
52
+ First, set your API key globally:
53
+
54
+ ```bash
55
+ # Set API key globally (works across all projects)
56
+ perd set-key "your_api_key_here"
57
+
58
+ # Or use interactive setup
59
+ perd interactive
60
+ ```
61
+
62
+ Then use in your Python code:
63
+
64
+ ```python
65
+ import per_datasets as pds
66
+
67
+ # Initialize without API key (uses global key)
68
+ pds.initialize()
69
+
70
+ # Load a random reservoir dataset
71
+ df_random = pds.reservoir.load_random()
72
+ print(f"Loaded dataset with shape: {df_random.shape}")
73
+ ```
74
+
75
+ ### Option 2: Using API Key in Code
76
+
77
+ ```python
78
+ import per_datasets as pds
79
+
80
+ # Initialize with your API key
81
+ pds.initialize('your_api_key_here')
82
+
83
+ # Load a random reservoir dataset
84
+ df_random = pds.reservoir.load_random()
85
+ print(f"Loaded dataset with shape: {df_random.shape}")
86
+ ```
87
+
88
+ ## Workflows
89
+
90
+ The package includes Dockerized workflows for common operations:
91
+
92
+ ### Available Workflows
93
+
94
+ 1. **Add Workflow** - Adds two numbers together
95
+ 2. **Subtract Workflow** - Subtracts one number from another
96
+ 3. **PINN Workflow** - Trains a Physics-Informed Neural Network (Transformer-based)
97
+
98
+ ### Running Workflows in Python
99
+
100
+ You can run workflows directly in Python:
101
+
102
+ ```python
103
+ from per_datasets.workflows import add, subtract, pinn
104
+
105
+ # Run simple workflows
106
+ print(add(5, 3)) # 8
107
+ print(subtract(10, 4)) # 6
108
+
109
+ # Run PINN training workflow
110
+ results = pinn(epochs=50)
111
+ print(f"Final Loss: {results['final_loss']}")
112
+
113
+ # Visualize the loss history dynamically
114
+ from per_datasets import visual # Or use pds.visual if imported as pds
115
+ visual.line_plot(results, y='loss_history', title="PINN Training Loss")
116
+ ```
117
+
118
+ ### Building Workflow Containers
119
+
120
+ ```bash
121
+ # Build all workflow Docker images
122
+ ./build_workflows.sh
123
+
124
+ # Or build individually
125
+ docker build -t perd-add-workflow -f per_datasets/workflows/add/Dockerfile .
126
+ docker build -t perd-subtract-workflow -f per_datasets/workflows/substract/Dockerfile .
127
+ ```
128
+
129
+ ### Running Workflows
130
+
131
+ ```bash
132
+ # Run add workflow
133
+ docker run --rm perd-add-workflow 5.2 3.8
134
+
135
+ # Run subtract workflow
136
+ docker run --rm perd-subtract-workflow 10.5 4.3
137
+ ```
138
+
139
+ See `per_datasets/workflows/README.md` for more details.
140
+
141
+ ## Command Line Interface
142
+
143
+ The package includes a CLI for managing API keys globally:
144
+
145
+ ```bash
146
+ # Set API key globally
147
+ perd set-key "your_api_key_here"
148
+
149
+ # Check configuration status
150
+ perd status
151
+
152
+ # Get stored API key (masked)
153
+ perd get-key
154
+
155
+ # Remove API key
156
+ perd remove-key
157
+
158
+ # Interactive setup
159
+ perd interactive
160
+
161
+ # Clear all configuration
162
+ perd clear
163
+
164
+ # Show help
165
+ perd --help
166
+ ```
167
+
168
+ ## Complete Usage Examples
169
+
170
+ ```
171
+ import per_datasets as pds
172
+
173
+ # Initialize (uses global key if available)
174
+ pds.initialize()
175
+
176
+ # Load a random reservoir dataset
177
+ df_random = pds.reservoir.load_random()
178
+ print(f"Loaded dataset with shape: {df_random.shape}")
179
+
180
+ # Load a specific dataset by ID
181
+ df_specific = pds.reservoir.load('your_dataset_id')
182
+
183
+ # Get information about available datasets
184
+ info = pds.get_dataset_info()
185
+ ```
186
+
187
+ ## API Reference
188
+
189
+ ### `initialize(api_key=None)`
190
+
191
+ Initialize the per_datasets module with API credentials.
192
+
193
+ **Parameters:**
194
+
195
+ - `api_key` (str, optional): The API key for authentication. If not provided, uses globally stored key.
196
+
197
+ **Note:** If no API key is provided and none is stored globally, raises a ValueError with instructions to set a global key.
198
+
199
+ ### `load_random()`
200
+
201
+ Loads a random reservoir model from the API endpoint and returns as pandas DataFrame.
202
+
203
+ **Returns:**
204
+
205
+ - `pandas.DataFrame`: A DataFrame containing the dataset
206
+
207
+ ## Configuration Management
208
+
209
+ The package stores configuration in `~/.per_datasets/config.json` by default:
210
+
211
+ ```
212
+ {
213
+ "api_key": "your_api_key_here"
214
+ }
215
+ ```
216
+
217
+ ### Benefits of Global Configuration:
218
+
219
+ - ✅ **No API key in code**: Keep sensitive keys out of your source code
220
+ - ✅ **Cross-project**: Use the same API key across multiple projects
221
+ - ✅ **Secure**: API keys are stored in user's home directory
222
+ - ✅ **Override**: Can still provide API key in code to override global setting
223
+ - ✅ **Easy management**: Use CLI commands to manage keys
224
+
225
+ ### Security Notes:
226
+
227
+ - API keys are stored in plain text in your home directory
228
+ - Only you can access the configuration file
229
+ - Consider using environment variables for production deployments
230
+
231
+ ## Dependencies
232
+
233
+ - requests>=2.25.1
234
+ - pandas>=1.3.0
235
+
236
+ ## License
237
+
238
+ MIT
239
+
240
+ ## Contributing
241
+
242
+ 1. Fork the repository
243
+ 2. Create a feature branch
244
+ 3. Make your changes
245
+ 4. Add tests if applicable
246
+ 5. Submit a pull request
247
+
248
+ ## Development
249
+
250
+ To set up the development environment:
251
+
252
+ ```bash
253
+ git clone https://github.com/P-E-R-D/library-py.git
254
+ cd perd
255
+ pip install -e .
256
+ ```
257
+
258
+ ## Building and Publishing
259
+
260
+ ### Automatic Deployment (Recommended)
261
+
262
+ This package uses GitHub Actions for automatic deployment to PyPI:
263
+
264
+ 1. **Make your changes** to the code
265
+ 2. **Update version numbers** in `per_datasets/__init__.py` and `pyproject.toml`
266
+ 3. **Create a git tag** with the new version:
267
+ ```bash
268
+ git tag v0.2.0
269
+ git push origin v0.2.0
270
+ ```
271
+ 4. **GitHub Actions automatically** builds and uploads to PyPI!
272
+
273
+ See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed setup instructions.
274
+
275
+ ### Manual Publishing
276
+
277
+ ```bash
278
+ python -m build
279
+ twine upload dist/*
280
+ ```
perd-0.0.7a3/README.md ADDED
@@ -0,0 +1,243 @@
1
+ # perd
2
+
3
+ A Python package for loading reservoir datasets from API endpoints.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install perd
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Option 1: Using Global API Key (Recommended)
14
+
15
+ First, set your API key globally:
16
+
17
+ ```bash
18
+ # Set API key globally (works across all projects)
19
+ perd set-key "your_api_key_here"
20
+
21
+ # Or use interactive setup
22
+ perd interactive
23
+ ```
24
+
25
+ Then use in your Python code:
26
+
27
+ ```python
28
+ import per_datasets as pds
29
+
30
+ # Initialize without API key (uses global key)
31
+ pds.initialize()
32
+
33
+ # Load a random reservoir dataset
34
+ df_random = pds.reservoir.load_random()
35
+ print(f"Loaded dataset with shape: {df_random.shape}")
36
+ ```
37
+
38
+ ### Option 2: Using API Key in Code
39
+
40
+ ```python
41
+ import per_datasets as pds
42
+
43
+ # Initialize with your API key
44
+ pds.initialize('your_api_key_here')
45
+
46
+ # Load a random reservoir dataset
47
+ df_random = pds.reservoir.load_random()
48
+ print(f"Loaded dataset with shape: {df_random.shape}")
49
+ ```
50
+
51
+ ## Workflows
52
+
53
+ The package includes Dockerized workflows for common operations:
54
+
55
+ ### Available Workflows
56
+
57
+ 1. **Add Workflow** - Adds two numbers together
58
+ 2. **Subtract Workflow** - Subtracts one number from another
59
+ 3. **PINN Workflow** - Trains a Physics-Informed Neural Network (Transformer-based)
60
+
61
+ ### Running Workflows in Python
62
+
63
+ You can run workflows directly in Python:
64
+
65
+ ```python
66
+ from per_datasets.workflows import add, subtract, pinn
67
+
68
+ # Run simple workflows
69
+ print(add(5, 3)) # 8
70
+ print(subtract(10, 4)) # 6
71
+
72
+ # Run PINN training workflow
73
+ results = pinn(epochs=50)
74
+ print(f"Final Loss: {results['final_loss']}")
75
+
76
+ # Visualize the loss history dynamically
77
+ from per_datasets import visual # Or use pds.visual if imported as pds
78
+ visual.line_plot(results, y='loss_history', title="PINN Training Loss")
79
+ ```
80
+
81
+ ### Building Workflow Containers
82
+
83
+ ```bash
84
+ # Build all workflow Docker images
85
+ ./build_workflows.sh
86
+
87
+ # Or build individually
88
+ docker build -t perd-add-workflow -f per_datasets/workflows/add/Dockerfile .
89
+ docker build -t perd-subtract-workflow -f per_datasets/workflows/substract/Dockerfile .
90
+ ```
91
+
92
+ ### Running Workflows
93
+
94
+ ```bash
95
+ # Run add workflow
96
+ docker run --rm perd-add-workflow 5.2 3.8
97
+
98
+ # Run subtract workflow
99
+ docker run --rm perd-subtract-workflow 10.5 4.3
100
+ ```
101
+
102
+ See `per_datasets/workflows/README.md` for more details.
103
+
104
+ ## Command Line Interface
105
+
106
+ The package includes a CLI for managing API keys globally:
107
+
108
+ ```bash
109
+ # Set API key globally
110
+ perd set-key "your_api_key_here"
111
+
112
+ # Check configuration status
113
+ perd status
114
+
115
+ # Get stored API key (masked)
116
+ perd get-key
117
+
118
+ # Remove API key
119
+ perd remove-key
120
+
121
+ # Interactive setup
122
+ perd interactive
123
+
124
+ # Clear all configuration
125
+ perd clear
126
+
127
+ # Show help
128
+ perd --help
129
+ ```
130
+
131
+ ## Complete Usage Examples
132
+
133
+ ```
134
+ import per_datasets as pds
135
+
136
+ # Initialize (uses global key if available)
137
+ pds.initialize()
138
+
139
+ # Load a random reservoir dataset
140
+ df_random = pds.reservoir.load_random()
141
+ print(f"Loaded dataset with shape: {df_random.shape}")
142
+
143
+ # Load a specific dataset by ID
144
+ df_specific = pds.reservoir.load('your_dataset_id')
145
+
146
+ # Get information about available datasets
147
+ info = pds.get_dataset_info()
148
+ ```
149
+
150
+ ## API Reference
151
+
152
+ ### `initialize(api_key=None)`
153
+
154
+ Initialize the per_datasets module with API credentials.
155
+
156
+ **Parameters:**
157
+
158
+ - `api_key` (str, optional): The API key for authentication. If not provided, uses globally stored key.
159
+
160
+ **Note:** If no API key is provided and none is stored globally, raises a ValueError with instructions to set a global key.
161
+
162
+ ### `load_random()`
163
+
164
+ Loads a random reservoir model from the API endpoint and returns as pandas DataFrame.
165
+
166
+ **Returns:**
167
+
168
+ - `pandas.DataFrame`: A DataFrame containing the dataset
169
+
170
+ ## Configuration Management
171
+
172
+ The package stores configuration in `~/.per_datasets/config.json` by default:
173
+
174
+ ```
175
+ {
176
+ "api_key": "your_api_key_here"
177
+ }
178
+ ```
179
+
180
+ ### Benefits of Global Configuration:
181
+
182
+ - ✅ **No API key in code**: Keep sensitive keys out of your source code
183
+ - ✅ **Cross-project**: Use the same API key across multiple projects
184
+ - ✅ **Secure**: API keys are stored in user's home directory
185
+ - ✅ **Override**: Can still provide API key in code to override global setting
186
+ - ✅ **Easy management**: Use CLI commands to manage keys
187
+
188
+ ### Security Notes:
189
+
190
+ - API keys are stored in plain text in your home directory
191
+ - Only you can access the configuration file
192
+ - Consider using environment variables for production deployments
193
+
194
+ ## Dependencies
195
+
196
+ - requests>=2.25.1
197
+ - pandas>=1.3.0
198
+
199
+ ## License
200
+
201
+ MIT
202
+
203
+ ## Contributing
204
+
205
+ 1. Fork the repository
206
+ 2. Create a feature branch
207
+ 3. Make your changes
208
+ 4. Add tests if applicable
209
+ 5. Submit a pull request
210
+
211
+ ## Development
212
+
213
+ To set up the development environment:
214
+
215
+ ```bash
216
+ git clone https://github.com/P-E-R-D/library-py.git
217
+ cd perd
218
+ pip install -e .
219
+ ```
220
+
221
+ ## Building and Publishing
222
+
223
+ ### Automatic Deployment (Recommended)
224
+
225
+ This package uses GitHub Actions for automatic deployment to PyPI:
226
+
227
+ 1. **Make your changes** to the code
228
+ 2. **Update version numbers** in `per_datasets/__init__.py` and `pyproject.toml`
229
+ 3. **Create a git tag** with the new version:
230
+ ```bash
231
+ git tag v0.2.0
232
+ git push origin v0.2.0
233
+ ```
234
+ 4. **GitHub Actions automatically** builds and uploads to PyPI!
235
+
236
+ See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed setup instructions.
237
+
238
+ ### Manual Publishing
239
+
240
+ ```bash
241
+ python -m build
242
+ twine upload dist/*
243
+ ```
@@ -0,0 +1,26 @@
1
+ """PER Datasets - A module for loading reservoir datasets."""
2
+
3
+ __version__ = "0.0.7-alpha-3"
4
+
5
+ from .talkaholic.reservoir import Reservoir
6
+ from .reservoir import load_random, load
7
+ from .utils.init import initialize
8
+ from .workflow import workflow, WorkflowStreamInput, WorkflowStreamOutput
9
+ from . import utils
10
+ from .visual import Visualizer
11
+
12
+ # Instantiate the visualizer as a singleton object for generic access.
13
+ visual = Visualizer()
14
+
15
+ __all__ = [
16
+ "load_random",
17
+ "load",
18
+ "Reservoir",
19
+ "__version__",
20
+ "initialize",
21
+ "workflow",
22
+ "WorkflowStreamInput",
23
+ "WorkflowStreamOutput",
24
+ "visual",
25
+ "utils",
26
+ ]