elixcee 0.1.0__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.
- elixcee-0.1.0/.github/workflows/publish.yml +80 -0
- elixcee-0.1.0/.gitignore +15 -0
- elixcee-0.1.0/CHANGELOG.md +145 -0
- elixcee-0.1.0/Cargo.lock +1040 -0
- elixcee-0.1.0/Cargo.toml +24 -0
- elixcee-0.1.0/FUNCTIONS.md +362 -0
- elixcee-0.1.0/FUNCTIONS_ja.md +364 -0
- elixcee-0.1.0/PKG-INFO +5 -0
- elixcee-0.1.0/README.md +212 -0
- elixcee-0.1.0/README_ja.md +174 -0
- elixcee-0.1.0/elixcee.pyi +182 -0
- elixcee-0.1.0/pyproject.toml +13 -0
- elixcee-0.1.0/src/formula/ast.rs +26 -0
- elixcee-0.1.0/src/formula/eval.rs +4446 -0
- elixcee-0.1.0/src/formula/mod.rs +7 -0
- elixcee-0.1.0/src/formula/parser.rs +406 -0
- elixcee-0.1.0/src/lib.rs +920 -0
- elixcee-0.1.0/src/parser/ast.rs +138 -0
- elixcee-0.1.0/src/parser/mod.rs +1755 -0
- elixcee-0.1.0/src/reader.rs +571 -0
- elixcee-0.1.0/src/vm/mod.rs +2749 -0
- elixcee-0.1.0/tests/prop_tests.proptest-regressions +7 -0
- elixcee-0.1.0/tests/prop_tests.rs +300 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
name: Build and Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
linux:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
target: [x86_64, aarch64]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: PyO3/maturin-action@v1
|
|
20
|
+
with:
|
|
21
|
+
target: ${{ matrix.target }}
|
|
22
|
+
args: --release --out dist --find-interpreter
|
|
23
|
+
manylinux: auto
|
|
24
|
+
- uses: actions/upload-artifact@v4
|
|
25
|
+
with:
|
|
26
|
+
name: wheels-linux-${{ matrix.target }}
|
|
27
|
+
path: dist
|
|
28
|
+
|
|
29
|
+
windows:
|
|
30
|
+
runs-on: windows-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: PyO3/maturin-action@v1
|
|
34
|
+
with:
|
|
35
|
+
args: --release --out dist --find-interpreter
|
|
36
|
+
- uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: wheels-windows
|
|
39
|
+
path: dist
|
|
40
|
+
|
|
41
|
+
macos:
|
|
42
|
+
runs-on: macos-latest
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@v4
|
|
45
|
+
- uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
args: --release --out dist --target universal2-apple-darwin --find-interpreter
|
|
48
|
+
- uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: wheels-macos
|
|
51
|
+
path: dist
|
|
52
|
+
|
|
53
|
+
sdist:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
- uses: PyO3/maturin-action@v1
|
|
58
|
+
with:
|
|
59
|
+
command: sdist
|
|
60
|
+
args: --out dist
|
|
61
|
+
- uses: actions/upload-artifact@v4
|
|
62
|
+
with:
|
|
63
|
+
name: wheels-sdist
|
|
64
|
+
path: dist
|
|
65
|
+
|
|
66
|
+
publish:
|
|
67
|
+
needs: [linux, windows, macos, sdist]
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
environment:
|
|
70
|
+
name: pypi
|
|
71
|
+
url: https://pypi.org/p/elixcee
|
|
72
|
+
permissions:
|
|
73
|
+
id-token: write
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/download-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
pattern: wheels-*
|
|
78
|
+
merge-multiple: true
|
|
79
|
+
path: dist
|
|
80
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
elixcee-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [0.1.0] — Initial Release
|
|
10
|
+
|
|
11
|
+
### Added — VBA Parser & Interpreter
|
|
12
|
+
|
|
13
|
+
- **Sub / End Sub** with parameter passing
|
|
14
|
+
- **Variable assignment** and arithmetic expressions
|
|
15
|
+
- **Cell read/write** via `Cells(row, col).Value` and `Range("A1").Value`
|
|
16
|
+
- **For / Next** loops with optional `Step`
|
|
17
|
+
- **For Each** iteration over cell ranges
|
|
18
|
+
- **If / ElseIf / Else / End If** conditional branches
|
|
19
|
+
- **Do While / Loop** and **While / Wend** loops
|
|
20
|
+
- **Select Case** with value, range (`To`), and comparison (`Is`) patterns
|
|
21
|
+
- **Exit For**, **Exit Do**, **Exit Sub**, **Exit Function**
|
|
22
|
+
- **Function / End Function** with return values; **Call** statement
|
|
23
|
+
- **On Error Resume Next**, **On Error GoTo label**, **Resume**, **GoTo**
|
|
24
|
+
- **With / End With** blocks (plain and `With Sheets("name")`)
|
|
25
|
+
- **Const** declarations; `Option Explicit` / `Option Base` ignored
|
|
26
|
+
- **Dim** variable declarations; `Dim arr(n)` and `ReDim [Preserve]` arrays
|
|
27
|
+
- **Type ... End Type** user-defined types with typed field initialization
|
|
28
|
+
- **Public / Private / Friend / Static** modifiers on Sub/Function (modifier ignored)
|
|
29
|
+
- **Debug.Print** / **Debug.Assert** as no-ops
|
|
30
|
+
- **MsgBox** — configurable skip or RuntimeError
|
|
31
|
+
- Range operations: `ClearContents`, `Clear`, `Copy`, `Delete`, `Insert`, `Sort`, `Offset.Value`
|
|
32
|
+
- Sheet operations: `Sheets.Add`, `Sheets.Delete`, `Sheets("name").Cells`
|
|
33
|
+
- `Application.Calculation` (Manual / Automatic); `ScreenUpdating`, `EnableEvents`, `DisplayAlerts`, `StatusBar`, `Cursor`, `CutCopyMode` as no-ops
|
|
34
|
+
- `WorksheetFunction.*` prefix forwarding to formula engine
|
|
35
|
+
- `Cells(Rows.Count, col).End(xlUp).Row` and related `.End(dir).Row/Column` — indexed with `BTreeSet` for O(log n) performance
|
|
36
|
+
|
|
37
|
+
### Added — Named Ranges
|
|
38
|
+
|
|
39
|
+
- `Range("A1:B5").Name = "MyName"` registers a workbook-level named range
|
|
40
|
+
- All Range operations (Read/Write/Clear/Delete/Insert/Sort/Copy/ForEach) transparently resolve named range strings
|
|
41
|
+
|
|
42
|
+
### Added — Formula Engine (200+ functions)
|
|
43
|
+
|
|
44
|
+
#### Arithmetic & Statistical
|
|
45
|
+
`SUM`, `AVERAGE`, `AVERAGEIF`, `AVERAGEIFS`, `MIN`, `MAX`, `MINIFS`, `MAXIFS`,
|
|
46
|
+
`COUNT`, `COUNTA`, `COUNTIF`, `COUNTIFS`, `COUNTBLANK`,
|
|
47
|
+
`SUMIF`, `SUMIFS`, `SUMPRODUCT`, `PRODUCT`, `MEDIAN`, `MODE.MULT`,
|
|
48
|
+
`LARGE`, `SMALL`, `RANK`, `PERCENTILE` / `PERCENTILE.INC`, `PERCENTRANK` / `PERCENTRANK.INC`,
|
|
49
|
+
`ROUND`, `ROUNDUP`, `ROUNDDOWN`, `INT`, `TRUNC`, `MOD`,
|
|
50
|
+
`RAND`, `RANDBETWEEN`, `SUBTOTAL`, `AGGREGATE`
|
|
51
|
+
|
|
52
|
+
#### Statistical
|
|
53
|
+
`STDEV` / `STDEV.S`, `STDEVP` / `STDEV.P`, `VAR` / `VAR.S`, `VARP` / `VAR.P`
|
|
54
|
+
|
|
55
|
+
#### Math & Trigonometry
|
|
56
|
+
`ABS`, `SQRT`, `POWER`, `EXP`, `LN`, `LOG`, `LOG10`, `PI`,
|
|
57
|
+
`SIN`, `COS`, `TAN`, `ASIN`, `ACOS`, `ATAN`, `ATAN2`, `DEGREES`, `RADIANS`,
|
|
58
|
+
`FLOOR` / `FLOOR.MATH`, `CEILING` / `CEILING.MATH`, `MROUND`
|
|
59
|
+
|
|
60
|
+
#### Logical
|
|
61
|
+
`IF`, `IFS`, `SWITCH`, `AND`, `OR`, `NOT`, `XOR`, `IFERROR`
|
|
62
|
+
|
|
63
|
+
#### Text
|
|
64
|
+
`LEFT`, `RIGHT`, `MID`, `LEFTB`, `RIGHTB`, `MIDB`,
|
|
65
|
+
`LEN`, `LENB`, `UPPER`, `LOWER`, `PROPER`, `TRIM`,
|
|
66
|
+
`FIND`, `SEARCH`, `SUBSTITUTE`, `REPLACE`,
|
|
67
|
+
`CONCATENATE`, `CONCAT`, `TEXTJOIN`, `TEXT`, `VALUE`, `EXACT`,
|
|
68
|
+
`CHAR`, `UNICHAR`, `CODE`, `UNICODE`, `ASC`, `JIS`
|
|
69
|
+
|
|
70
|
+
#### Date & Time
|
|
71
|
+
`DATE`, `TODAY`, `NOW`, `YEAR`, `MONTH`, `DAY`, `WEEKDAY`, `DAYS`,
|
|
72
|
+
`EDATE`, `EOMONTH`, `DATEDIF`, `DATEVALUE`,
|
|
73
|
+
`TIME`, `TIMEVALUE`, `HOUR`, `MINUTE`, `SECOND`,
|
|
74
|
+
`NETWORKDAYS`, `NETWORKDAYS.INTL`, `WORKDAY.INTL`
|
|
75
|
+
|
|
76
|
+
#### Lookup & Reference
|
|
77
|
+
`VLOOKUP`, `HLOOKUP`, `XLOOKUP`, `LOOKUP`,
|
|
78
|
+
`INDEX`, `MATCH`, `XMATCH`, `CHOOSE`,
|
|
79
|
+
`ROW`, `COLUMN`, `INDIRECT`, `OFFSET`, `ADDRESS`
|
|
80
|
+
|
|
81
|
+
#### Information
|
|
82
|
+
`ISBLANK`, `ISERROR`, `ISERR`, `ISNA`, `ISNUMBER`, `ISTEXT`, `ISLOGICAL`, `ISNONTEXT`
|
|
83
|
+
|
|
84
|
+
#### Array / Spill
|
|
85
|
+
`FILTER`, `UNIQUE`, `SORT`, `SORTBY`, `SEQUENCE`, `TRANSPOSE`,
|
|
86
|
+
`TOCOL`, `TOROW`, `WRAPCOLS`, `WRAPROWS`, `RANDARRAY`
|
|
87
|
+
|
|
88
|
+
#### Lambda & Higher-Order
|
|
89
|
+
`LET`, `LAMBDA`, `MAP`, `REDUCE`, `SCAN`, `BYROW`, `BYCOL`
|
|
90
|
+
|
|
91
|
+
### Added — Formula Engine Features
|
|
92
|
+
|
|
93
|
+
- **Topological sort** for formula recalculation (`topo_sort_formulas`): formulas are evaluated in dependency order; circular references fall back to best-effort ordering
|
|
94
|
+
- **Application.Calculation** mode — Manual suppresses recalc; switching to Automatic triggers full recalc
|
|
95
|
+
- A1-notation and R1C1-notation cell references; range references (`A1:B10`)
|
|
96
|
+
- DBCS byte semantics (`LENB`, `LEFTB`, `RIGHTB`, `MIDB`) matching Excel's 2-byte-per-CJK rule
|
|
97
|
+
- Excel 1900 leap-year bug compatibility in date serial arithmetic
|
|
98
|
+
|
|
99
|
+
### Added — Python API
|
|
100
|
+
|
|
101
|
+
| Method | Description |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `Vm(on_msgbox=)` | Create a VM; `"skip"` or `"error"` on MsgBox |
|
|
104
|
+
| `vm.run(vba, name)` | Execute a Sub |
|
|
105
|
+
| `vm.set_cell(r, c, v)` / `get_cell(r, c)` | 1-based cell read/write |
|
|
106
|
+
| `vm.cells()` | All non-empty cells as `{(r, c): value}` |
|
|
107
|
+
| `vm.cells_df()` | Active sheet as pandas DataFrame (requires pandas) |
|
|
108
|
+
| `vm.variables()` | VBA variables as `{name: value}` |
|
|
109
|
+
| `vm.set_cell_formula(r, c, f)` | Set and evaluate a formula string |
|
|
110
|
+
| `vm.set_cell_formula_batch(d)` | Batch formula set: `{(r,c): formula}` |
|
|
111
|
+
| `vm.recalculate()` | Re-evaluate all formula cells |
|
|
112
|
+
| `vm.set_sheet(name)` / `active_sheet()` / `sheet_names()` | Sheet management |
|
|
113
|
+
| `vm.get_sheet(name)` | Cells of a named sheet |
|
|
114
|
+
| `vm.save_workbook(path)` | Save to `.xlsx` or `.ods` |
|
|
115
|
+
| `vm.named_ranges` | Dict of registered named ranges |
|
|
116
|
+
| `elixcee.run_macro(vba, name)` | One-shot macro runner |
|
|
117
|
+
| `elixcee.load_workbook(path)` | Load `.xlsx` / `.ods` into a `Vm` |
|
|
118
|
+
|
|
119
|
+
- `Variant::Date` → Python `datetime.date` conversion
|
|
120
|
+
- `Variant::Error` → Python `ExcelError` class with `.code` attribute (bidirectional)
|
|
121
|
+
- Type stubs `elixcee.pyi` for IDE completion
|
|
122
|
+
|
|
123
|
+
### Added — File I/O
|
|
124
|
+
|
|
125
|
+
- **Read**: `.xlsx`, `.xlsm`, `.ods` — hand-written XML parser (no calamine at runtime)
|
|
126
|
+
- **Write**: `.xlsx` — hand-written XML + zip; `.ods` — hand-written XML + zip
|
|
127
|
+
- Multi-sheet support: all sheets loaded on `load_workbook`; saved on `save_workbook`
|
|
128
|
+
|
|
129
|
+
### Performance
|
|
130
|
+
|
|
131
|
+
- `Cells.End` searches (`xlUp`, `xlDown`, `xlToLeft`, `xlToRight`) use a lazy `BTreeSet` index — O(log n) per query after O(n) rebuild on cell mutation
|
|
132
|
+
- Zero-copy formula parse caching via `recalculate_all` with topological ordering
|
|
133
|
+
|
|
134
|
+
### Dependencies (runtime)
|
|
135
|
+
|
|
136
|
+
| Library | Purpose |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `pyo3` | Python bindings |
|
|
139
|
+
| `zip` | XLSX / ODS archive read-write |
|
|
140
|
+
|
|
141
|
+
`calamine` is kept as a `[dev-dependencies]` oracle for diff-testing the hand-written reader.
|
|
142
|
+
|
|
143
|
+
### Tests
|
|
144
|
+
|
|
145
|
+
299 unit tests covering parser, formula engine, VM interpreter, file round-trips, and diff tests against calamine.
|