combocurve-api-helper 2.2.0__tar.gz → 2.2.2__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 (71) hide show
  1. {combocurve_api_helper-2.2.0/src/combocurve_api_helper.egg-info → combocurve_api_helper-2.2.2}/PKG-INFO +1 -1
  2. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/__init__.py +1 -1
  3. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/stream_properties.py +47 -7
  4. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/root.py +18 -11
  5. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2/src/combocurve_api_helper.egg-info}/PKG-INFO +1 -1
  6. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_api.py +12 -0
  7. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/LICENSE +0 -0
  8. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/README.md +0 -0
  9. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/pyproject.toml +0 -0
  10. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/setup.cfg +0 -0
  11. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/_batch.py +0 -0
  12. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/_csv_writer.py +0 -0
  13. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/_econ_model_base.py +0 -0
  14. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/_models_generated.py +0 -0
  15. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/assets/econModels.json +0 -0
  16. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/assets/wellHeader.json +0 -0
  17. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/base.py +0 -0
  18. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/company_models.py +0 -0
  19. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/config.py +0 -0
  20. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/directional.py +0 -0
  21. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/__init__.py +0 -0
  22. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/_csv_generated.py +0 -0
  23. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/actual_or_forecast.py +0 -0
  24. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/base.py +0 -0
  25. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/capex.py +0 -0
  26. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/csv_columns.py +0 -0
  27. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/date_settings.py +0 -0
  28. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/differentials.py +0 -0
  29. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/drift.py +0 -0
  30. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/enums.py +0 -0
  31. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/expenses.py +0 -0
  32. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/formats.py +0 -0
  33. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/ownership_reversion.py +0 -0
  34. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/pricing.py +0 -0
  35. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/production_taxes.py +0 -0
  36. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/registry.py +0 -0
  37. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/reserves_category.py +0 -0
  38. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_models/risking.py +0 -0
  39. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/econ_runs.py +0 -0
  40. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/exports.py +0 -0
  41. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/forecast_configurations.py +0 -0
  42. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/forecast_parameters.py +0 -0
  43. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/forecasts.py +0 -0
  44. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/models.py +0 -0
  45. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/ownership_qualifiers.py +0 -0
  46. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/production.py +0 -0
  47. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/projects.py +0 -0
  48. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/py.typed +0 -0
  49. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/scenarios.py +0 -0
  50. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/typecurves.py +0 -0
  51. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper/wells.py +0 -0
  52. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper.egg-info/SOURCES.txt +0 -0
  53. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper.egg-info/dependency_links.txt +0 -0
  54. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper.egg-info/requires.txt +0 -0
  55. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/src/combocurve_api_helper.egg-info/top_level.txt +0 -0
  56. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_assignment_write_generics.py +0 -0
  57. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_assignments_live.py +0 -0
  58. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_batch_write.py +0 -0
  59. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_docstring_slugs.py +0 -0
  60. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_docstrings_current.py +0 -0
  61. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_econ_models_config.py +0 -0
  62. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_econ_runs.py +0 -0
  63. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_exports.py +0 -0
  64. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_forecast_parameters.py +0 -0
  65. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_generated_models.py +0 -0
  66. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_keysort.py +0 -0
  67. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_production_delete.py +0 -0
  68. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_require_any_filter.py +0 -0
  69. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_root_urls_and_params.py +0 -0
  70. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_route_paths.py +0 -0
  71. {combocurve_api_helper-2.2.0 → combocurve_api_helper-2.2.2}/tests/test_scenario_assignments.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: combocurve-api-helper
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: A library mapped to ComboCurve's API.
5
5
  Author: David S. Fulford
6
6
  Maintainer: David S. Fulford
@@ -1,4 +1,4 @@
1
- __version__ = '2.2.0'
1
+ __version__ = '2.2.2'
2
2
 
3
3
  from ._batch import BatchChunk as BatchChunk
4
4
  from ._batch import BatchWriteResult as BatchWriteResult
@@ -5,7 +5,7 @@ from pydantic import BaseModel, ConfigDict, Field
5
5
  from . import formats
6
6
  from .base import Context, EconModelMapper, common_columns, model_identity
7
7
  from .csv_columns import COLUMNS
8
- from .formats import csv_to_num, num_to_csv_float
8
+ from .formats import csv_to_num, num_to_csv, num_to_csv_float
9
9
 
10
10
  # API group key -> CSV 'Key' column value.
11
11
  _KEY_TO_CSV = {
@@ -28,6 +28,18 @@ _CATEGORY_TO_CSV = {
28
28
  }
29
29
  _CATEGORY_FROM_CSV = {v: k for k, v in _CATEGORY_TO_CSV.items()}
30
30
 
31
+ # `btuContent` API key -> CSV 'Category' column value, for the 'btu'-Key rows. These
32
+ # reuse the ordinary Key/Category/Value/Unit columns (Key='btu'); the dedicated
33
+ # 'BTU (MBTU/MCF)' column is unrelated and always blank -- see StreamPropertiesMapper.
34
+ _BTU_KEY_TO_CSV = {'unshrunkGas': 'unshrunk gas', 'shrunkGas': 'shrunk gas'}
35
+ _BTU_CATEGORY_FROM_CSV = {v: k for k, v in _BTU_KEY_TO_CSV.items()}
36
+ _BTU_UNIT = 'mbtu/mcf'
37
+ # CC's real CSV export omits a 'btu' row for a category whose value equals this
38
+ # default (1000) rather than omitting btuContent from the CSV altogether -- confirmed
39
+ # against a live export dated 2026-09-06 showing unshrunkGas=1100/shrunkGas=900 as two
40
+ # 'btu' rows.
41
+ _BTU_DEFAULT = 1000
42
+
31
43
  # (StreamPropertyGroup python attribute name, API category key), in the same canonical
32
44
  # order as _CATEGORY_TO_CSV -- this is the order categories are emitted in real CC CSVs.
33
45
  _GROUP_CATEGORY_FIELDS: list[tuple[str, str]] = [
@@ -161,18 +173,43 @@ class StreamPropertiesMapper(EconModelMapper):
161
173
  )
162
174
  rows.append({c: row.get(c, '') for c in self.columns})
163
175
 
164
- # `btuContent` is intentionally NOT emitted here: CC's real Stream Properties
165
- # CSV export has no 'btu'-Key rows at all and a blank 'BTU (MBTU/MCF)' column.
166
- # Like Capex $/ft, btuContent has no CSV representation and does not round-trip.
176
+ btu_content = model.get('btuContent') or {}
177
+ for api_key, csv_category in _BTU_KEY_TO_CSV.items():
178
+ value = btu_content.get(api_key)
179
+ # CC's CSV omits the row when the value is the default (1000), not just
180
+ # when btuContent is absent -- checked per category, independently.
181
+ if value is None or value == _BTU_DEFAULT:
182
+ continue
183
+ row = dict(common)
184
+ row.update(
185
+ {
186
+ 'Key': 'btu',
187
+ 'Category': csv_category,
188
+ 'Criteria': '',
189
+ 'Value': num_to_csv(value),
190
+ 'Period': '',
191
+ 'Unit': _BTU_UNIT,
192
+ 'Gas Shrinkage Condition': '',
193
+ 'Rate Type': '',
194
+ 'Rate Rows Calculation Method': '',
195
+ }
196
+ )
197
+ rows.append({c: row.get(c, '') for c in self.columns})
167
198
 
168
199
  return rows
169
200
 
170
201
  def from_row_dicts(self, rows: list[dict[str, str]]) -> dict[str, Any]:
171
202
  groups: dict[str, dict[str, list[StreamPropertyRow]]] = {'yields': {}, 'shrinkage': {}, 'lossFlare': {}}
203
+ btu_content: dict[str, Any] = {}
172
204
  name, unique = model_identity(rows)
173
205
 
174
206
  for row in rows:
175
207
  key = row['Key']
208
+ if key == 'btu':
209
+ if row['Category'] not in _BTU_CATEGORY_FROM_CSV:
210
+ raise NotImplementedError(f'Unknown btu Category: {row["Category"]}')
211
+ btu_content[_BTU_CATEGORY_FROM_CSV[row['Category']]] = csv_to_num(row['Value'])
212
+ continue
176
213
  if key not in _KEY_FROM_CSV:
177
214
  raise NotImplementedError(f'Unknown Key: {key}')
178
215
  group_key = _KEY_FROM_CSV[key]
@@ -202,10 +239,13 @@ class StreamPropertiesMapper(EconModelMapper):
202
239
  # `rateType`/`rowsCalculationMethod` cannot be reconstructed: CC's CSV blanks
203
240
  # 'Rate Type'/'Rate Rows Calculation Method' unconditionally (see
204
241
  # StreamPropertyGroup docstring), so those fields are simply never set below and
205
- # are excluded on dump. `btuContent` cannot be reconstructed at all -- there are
206
- # no 'btu'-Key rows in the CSV to read it back from -- so it is omitted entirely
207
- # from the result.
242
+ # are excluded on dump. A btuContent category omitted from the CSV (because it
243
+ # was at the default, 1000) is likewise not reconstructed here -- only categories
244
+ # with an actual 'btu' row come back, so a model that never leaves the default
245
+ # for either category round-trips with no `btuContent` key at all.
208
246
  result: dict[str, Any] = {'name': name, 'unique': unique}
247
+ if btu_content:
248
+ result['btuContent'] = btu_content
209
249
  for group_key in ('yields', 'shrinkage', 'lossFlare'):
210
250
  group_kwargs: dict[str, Any] = {
211
251
  _CATEGORY_TO_ATTR[category]: StreamPropertyCategory(rows=category_rows)
@@ -110,12 +110,13 @@ class Root(APIBase):
110
110
  return f'{self.API_BASE_URL}/users/roles'
111
111
 
112
112
  def get_project_custom_columns_url(
113
- self, project_id: str, collection: str, filters: Optional[dict[str, str]] = None
113
+ self, project_id: str, custom_column: str, filters: Optional[dict[str, str]] = None
114
114
  ) -> str:
115
115
  """
116
- Returns the API url for a project's custom columns for a given collection.
116
+ Returns the API url for a project's custom columns. `custom_column` -- "Currently
117
+ only `headers` is supported" per the docs.
117
118
  """
118
- url = f'{self.API_BASE_URL}/projects/{project_id}/custom-columns/{collection}'
119
+ url = f'{self.API_BASE_URL}/projects/{project_id}/custom-columns/{custom_column}'
119
120
  if filters is None:
120
121
  return url
121
122
 
@@ -287,12 +288,19 @@ class Root(APIBase):
287
288
  return self._get_items(url, params)
288
289
 
289
290
  def get_project_custom_columns(
290
- self, project_id: str, collection: str, filters: Optional[dict[str, str]] = None
291
- ) -> Item:
291
+ self, project_id: str, custom_column: str, filters: Optional[dict[str, str]] = None
292
+ ) -> ItemList:
292
293
  """
293
- Returns a project's custom columns for a given collection (e.g. 'wells',
294
- 'daily-productions', 'monthly-productions'). The project-scoped counterpart
295
- to `get_custom_columns`.
294
+ Returns a project's custom well-header definitions. `custom_column` is
295
+ "Currently only `headers` is supported" per the docs -- unlike the sibling
296
+ `get_custom_columns`, whose `collection` argument is a collection name
297
+ ('wells', 'daily-productions', ...), this one is not. The project-scoped
298
+ counterpart to `get_custom_columns`.
299
+
300
+ The response is a list with one entry per project custom header -- 0 if the
301
+ project has none defined, or several for a project with multiple. Verified
302
+ live: a project with no custom headers returns `[]`; a project with several
303
+ returns one dict per header.
296
304
 
297
305
  https://docs.api.combocurve.com/api/get-project-custom-columns
298
306
 
@@ -305,6 +313,5 @@ class Root(APIBase):
305
313
  }
306
314
  ]
307
315
  """
308
- url = self.get_project_custom_columns_url(project_id, collection, filters)
309
- columns = self._get_items(url)
310
- return columns[0]
316
+ url = self.get_project_custom_columns_url(project_id, custom_column, filters)
317
+ return self._get_items(url)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: combocurve-api-helper
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: A library mapped to ComboCurve's API.
5
5
  Author: David S. Fulford
6
6
  Maintainer: David S. Fulford
@@ -31,3 +31,15 @@ class TestRoot:
31
31
  def test_custom_columns(self, api: ComboCurveAPI) -> None:
32
32
  result = api.get_custom_columns('wells')
33
33
  assert isinstance(result, dict)
34
+
35
+ def test_project_custom_columns(self, api: ComboCurveAPI) -> None:
36
+ # `custom_column='headers'` is the only value the live API accepts (verified
37
+ # 2026-09-06: every other value, including the collection names 'wells' /
38
+ # 'daily-productions' that `get_custom_columns` takes, 404s with
39
+ # CustomColumnHeaderNotFoundError). The response is a list -- 0 entries for a
40
+ # project with no custom headers, one per header for a project that has them.
41
+ project_id = os.environ.get('CC_DEV_PROJECT_ID', '65568dbb4a8039d4e89a2f4b')
42
+ result = api.get_project_custom_columns(project_id, 'headers')
43
+ assert isinstance(result, list)
44
+ for header in result:
45
+ assert {'headerName', 'headerLabel', 'headerType'} <= header.keys()