rn-forge-data 0.1.2__tar.gz → 0.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rn-forge-data
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Excel and tabular data helpers for Python programming
5
5
  Author: Rohit Narayanan
6
6
  Author-email: Rohit Narayanan <rohit.nn@gmail.com>
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
14
  Classifier: Programming Language :: Python :: 3.14
15
15
  Classifier: Typing :: Typed
16
- Requires-Dist: rn-forge-commons>=0.8.0,<0.9
16
+ Requires-Dist: rn-forge-commons>=0.8.0,<0.11
17
17
  Requires-Dist: openpyxl>=3.1.5
18
18
  Requires-Dist: tablib[xlsx]>=3.8
19
19
  Requires-Dist: pandas>=3.0.3 ; extra == 'pandas'
@@ -37,6 +37,31 @@ Excel and tabular data helpers for Python programming, built on
37
37
  `rn-forge-commons`. The base install carries `openpyxl` and `tablib[xlsx]`; the
38
38
  `pandas` extra adds the pandas adapter.
39
39
 
40
+ ## Install
41
+
42
+ ```toml
43
+ dependencies = ["rn-forge-data>=0.1,<0.2"]
44
+ ```
45
+
46
+ The `pandas` extra adds `pandas` for `rn_forge.data.pandas`.
47
+
48
+ ## Minimum example
49
+
50
+ ```python
51
+ from rn_forge.data import ExcelUtils
52
+
53
+ workbook = ExcelUtils.new_workbook()
54
+ sheet = workbook.active
55
+ sheet.append(["id", "total"])
56
+ sheet.append([1001, 42.5])
57
+ ExcelUtils.write_workbook(workbook, "build/orders.xlsx")
58
+ ```
59
+
60
+ ## Errors
61
+
62
+ `write_xlsx` raises `KeyError` when `column_formats` names a column the dataset
63
+ lacks. The pandas helpers raise `AppException` for a missing required field.
64
+
40
65
  - `rn_forge.data` — the core: `ExcelUtils`, `CellFormat`, `WorkbookTemplate` and
41
66
  `write_xlsx`. The facade re-exports the core only.
42
67
  - `rn_forge.data.pandas` — the pandas adapter, behind the `pandas` extra:
@@ -10,6 +10,31 @@ Excel and tabular data helpers for Python programming, built on
10
10
  `rn-forge-commons`. The base install carries `openpyxl` and `tablib[xlsx]`; the
11
11
  `pandas` extra adds the pandas adapter.
12
12
 
13
+ ## Install
14
+
15
+ ```toml
16
+ dependencies = ["rn-forge-data>=0.1,<0.2"]
17
+ ```
18
+
19
+ The `pandas` extra adds `pandas` for `rn_forge.data.pandas`.
20
+
21
+ ## Minimum example
22
+
23
+ ```python
24
+ from rn_forge.data import ExcelUtils
25
+
26
+ workbook = ExcelUtils.new_workbook()
27
+ sheet = workbook.active
28
+ sheet.append(["id", "total"])
29
+ sheet.append([1001, 42.5])
30
+ ExcelUtils.write_workbook(workbook, "build/orders.xlsx")
31
+ ```
32
+
33
+ ## Errors
34
+
35
+ `write_xlsx` raises `KeyError` when `column_formats` names a column the dataset
36
+ lacks. The pandas helpers raise `AppException` for a missing required field.
37
+
13
38
  - `rn_forge.data` — the core: `ExcelUtils`, `CellFormat`, `WorkbookTemplate` and
14
39
  `write_xlsx`. The facade re-exports the core only.
15
40
  - `rn_forge.data.pandas` — the pandas adapter, behind the `pandas` extra:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rn-forge-data"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "Excel and tabular data helpers for Python programming"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -16,7 +16,7 @@ classifiers = [
16
16
  ]
17
17
  requires-python = ">=3.14"
18
18
  dependencies = [
19
- "rn-forge-commons>=0.8.0,<0.9",
19
+ "rn-forge-commons>=0.8.0,<0.11",
20
20
  "openpyxl>=3.1.5",
21
21
  "tablib[xlsx]>=3.8",
22
22
  ]
@@ -35,11 +35,19 @@ Changelog = "https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-data/
35
35
  Issues = "https://github.com/rn-forge/pykit/issues"
36
36
 
37
37
  [build-system]
38
- requires = ["uv_build>=0.11.28,<0.12.0"]
38
+ requires = ["uv_build>=0.13.7,<0.14.0"]
39
39
  build-backend = "uv_build"
40
40
 
41
+ [tool.pyright]
42
+ typeCheckingMode = "strict"
43
+ reportMissingTypeStubs = false
44
+ reportUnnecessaryTypeIgnoreComment = "error"
45
+ venv = ".venv"
46
+ venvPath = "../.."
47
+
41
48
  [tool.uv.build-backend]
42
49
  module-name = "rn_forge.data"
50
+ source-exclude = ["**/.DS_Store"]
43
51
 
44
52
  [tool.uv.sources.rn-forge-commons]
45
53
  workspace = true
@@ -61,7 +69,7 @@ addopts = "-ra --import-mode=importlib"
61
69
 
62
70
  [dependency-groups]
63
71
  dev = [
64
- "assertpy>=1.1",
72
+ "assertpy>=2.35",
65
73
  "pandas-stubs>=3.0.5",
66
74
  "pyright>=1.1.411",
67
75
  "pytest>=9.1.1",
@@ -1,26 +1,26 @@
1
1
  [project]
2
2
  name = "rn-forge-data"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "Excel and tabular data helpers for Python programming"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Rohit Narayanan", email = "rohit.nn@gmail.com" }]
7
7
  license = "MIT"
8
8
  license-files = ["LICENSE"]
9
9
  classifiers = [
10
- "Development Status :: 3 - Alpha",
11
- "Intended Audience :: Developers",
12
- "Operating System :: OS Independent",
13
- "Programming Language :: Python :: 3",
14
- "Programming Language :: Python :: 3 :: Only",
15
- "Programming Language :: Python :: 3.14",
16
- "Typing :: Typed",
10
+ "Development Status :: 3 - Alpha",
11
+ "Intended Audience :: Developers",
12
+ "Operating System :: OS Independent",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3 :: Only",
15
+ "Programming Language :: Python :: 3.14",
16
+ "Typing :: Typed",
17
17
  ]
18
18
  requires-python = ">=3.14"
19
19
  # Internal requirements are version ranges (ADR-0004).
20
20
  dependencies = [
21
- "rn-forge-commons>=0.8.0,<0.9",
22
- "openpyxl>=3.1.5",
23
- "tablib[xlsx]>=3.8",
21
+ "rn-forge-commons>=0.8.0,<0.11",
22
+ "openpyxl>=3.1.5",
23
+ "tablib[xlsx]>=3.8",
24
24
  ]
25
25
 
26
26
  [project.optional-dependencies]
@@ -33,11 +33,19 @@ Changelog = "https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-data/
33
33
  Issues = "https://github.com/rn-forge/pykit/issues"
34
34
 
35
35
  [build-system]
36
- requires = ["uv_build>=0.11.28,<0.12.0"]
36
+ requires = ["uv_build>=0.13.7,<0.14.0"]
37
37
  build-backend = "uv_build"
38
38
 
39
+ [tool.pyright]
40
+ typeCheckingMode = "strict"
41
+ reportMissingTypeStubs = false
42
+ reportUnnecessaryTypeIgnoreComment = "error"
43
+ venv = ".venv"
44
+ venvPath = "../.."
45
+
39
46
  [tool.uv.build-backend]
40
47
  module-name = "rn_forge.data"
48
+ source-exclude = ["**/.DS_Store"]
41
49
 
42
50
  [tool.uv.sources]
43
51
  rn-forge-commons = { workspace = true }
@@ -57,18 +65,18 @@ addopts = "-ra --import-mode=importlib"
57
65
 
58
66
  [dependency-groups]
59
67
  dev = [
60
- "assertpy>=1.1",
61
- "pandas-stubs>=3.0.5",
62
- "pyright>=1.1.411",
63
- "pytest>=9.1.1",
64
- "pytest-cov>=7.1.0",
65
- "pytest-randomly>=4.1.0",
66
- "rn-forge-data[pandas]",
67
- "ruff>=0.15.21",
68
+ "assertpy>=2.35",
69
+ "pandas-stubs>=3.0.5",
70
+ "pyright>=1.1.411",
71
+ "pytest>=9.1.1",
72
+ "pytest-cov>=7.1.0",
73
+ "pytest-randomly>=4.1.0",
74
+ "rn-forge-data[pandas]",
75
+ "ruff>=0.15.21",
68
76
  ]
69
77
  docs = [
70
- "mkdocs>=1.6.1",
71
- "mkdocs-material>=9.7.6",
72
- "mkdocstrings[python]>=1.0.6",
73
- "rn-forge-data[pandas]",
78
+ "mkdocs>=1.6.1",
79
+ "mkdocs-material>=9.7.6",
80
+ "mkdocstrings[python]>=1.0.6",
81
+ "rn-forge-data[pandas]",
74
82
  ]
@@ -390,10 +390,7 @@ def write_xlsx(
390
390
  sheet = workbook.create_sheet(sheet_title)
391
391
  if headers:
392
392
  sheet.append(headers)
393
- rows = cast(
394
- "list[tuple[Any, ...]]", list(cast("Any", dataset))
395
- ) # tablib is untyped
396
- for row in rows:
393
+ for row in cast("Any", dataset): # tablib is untyped
397
394
  cells: list[Any] = []
398
395
  for index, value in enumerate(row):
399
396
  cell = WriteOnlyCell(sheet, value=value)
@@ -112,12 +112,19 @@ class PandasUtils:
112
112
  field_name: str,
113
113
  required: bool = True,
114
114
  ) -> str:
115
- """Return *field_name* from *row* as a string.
116
-
117
- NaN values are returned as an empty string ``""``.
115
+ """Return *field_name* from *row* as a stripped string.
116
+
117
+ | Value | ``required=False`` | ``required=True`` |
118
+ | -- | -- | -- |
119
+ | ``None``, ``float("nan")``, ``pandas.NA``, ``pandas.NaT`` | ``""`` | Raises ``AppException("Field is required: <name>")`` |
120
+ | ``0`` | ``"0"`` | ``"0"`` |
121
+ | ``0.0`` | ``"0.0"`` | ``"0.0"`` |
122
+ | ``False`` | ``"False"`` | ``"False"`` |
123
+ | ``""`` or whitespace-only string | ``""`` | ``""`` |
124
+ | Other non-missing value | ``str(value).strip()`` | ``str(value).strip()`` |
118
125
  """
119
126
  field_value = PandasUtils.get_field(row, field_name, required)
120
- result = str(field_value or "").strip()
127
+ result = "" if field_value is None else str(field_value).strip()
121
128
  _LOGGER.trace(
122
129
  "PandasUtils.get_string_field | field={} | required={} | result={}",
123
130
  field_name,
File without changes