Slim Excel files safely with a Rust core
Project description
excel-slim
Excel file optimization with a Rust core and a Python-first API. The default path is lossless and deterministic, with optional lossy media optimization when explicitly enabled.
Highlights
- Python API:
excel_slim.optimize()andexcel_slim.analyze() - CLI mirrors Python options (no subprocess in Python)
- Lossless by default, lossy media is opt-in
- Deterministic output (stable ordering, timestamps)
- Handles
.xlsxand.xlsm(VBA pass-through)
Install
Python (published on PyPI)
pip install excel-slim
Python (from source)
python -m pip install maturin
maturin develop
CLI (from source)
cargo build -p excel-slim-cli --release
./target/release/excel-slim --help
Quick start
Python
import excel_slim
report = excel_slim.optimize(
"input.xlsx",
output="output.xlsx",
profile="safe",
xml=True,
zip=True,
vba="auto",
media="off",
)
info = excel_slim.analyze("input.xlsm")
CLI
excel-slim input.xlsx --report
excel-slim input.xlsm --xml --zip --vba=auto --media=lossless --report=json
Python API
analyze
info = excel_slim.analyze("input.xlsx")
Returns a dict with:
format:xlsx|xlsm|xls|csv|unknownsize_byteshas_vba,has_mediaxml_stats: worksheets, shared strings size, styles sizerecommendations,risks
optimize
report = excel_slim.optimize(
"input.xlsx",
output="output.xlsx",
profile="safe", # safe | balanced | aggressive
xml=True, # XML optimizations
zip=True, # ZIP repack
vba="auto", # auto | off | on
media="off", # off | lossless | lossy
report=True,
report_format="dict", # dict | json_string
)
optimize() returns an OptimizationReport with per-module savings and metadata.
Convenience API
from excel_slim import WorkbookOptimizer
opt = WorkbookOptimizer("input.xlsx")
opt.profile("safe").xml(True).zip(True).media("lossless")
report = opt.optimize("output.xlsx")
Profiles
safe: fast, lossless only. Skips heavy XML passes.balanced: enables style pruning for additional savings.aggressive: enables XML minify and best compression (slowest).
Determinism
- Stable ZIP ordering
- Fixed timestamps
- Consistent compression settings by profile
Safety
- Never executes macros or formulas
- VBA streams are preserved as-is
- Zip entry validation prevents path traversal
Development
Requirements
- Rust 1.70+
- Python 3.8+
- maturin (
python -m pip install maturin)
Build + test
cargo test
python -m pytest
Publish (PyPI)
This uses maturin to build and publish wheels.
maturin build --release
maturin publish --release
Set your token in the environment before publishing:
export MATURIN_PYPI_TOKEN="pypi-..."
Roadmap
See the engineering plan in the project brief for shared strings, styles pruning, VBA compression, media optimization, and XLS support phases.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file excel_slim-0.1.0.tar.gz.
File metadata
- Download URL: excel_slim-0.1.0.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e20744f82056f9abe325161344869b05f6c23a381ad506c0534dc99d54057bb
|
|
| MD5 |
c934d39792f7990fffb46badb7ab03ef
|
|
| BLAKE2b-256 |
5f8c2fa481f512c42c83697f21b10b2683622715ba5b7125e8bc651ef51f7d3a
|
File details
Details for the file excel_slim-0.1.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 813.8 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d8507d0edc9a77296c873fc889211c8ae538d8680aa7a5668e7b68129b15628
|
|
| MD5 |
59d5a6dd54791916768715ab8ab8429e
|
|
| BLAKE2b-256 |
bd61c36a751ed8f054bed2eba8c59129f1dec2f79999a533a4652490c0343347
|
File details
Details for the file excel_slim-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1b3ca1e717bb9bb9e9fd60b21ab1d4db0a279d079a535907a6d883f9b244f6b
|
|
| MD5 |
ea9111e3dca48b01c8c7c4ce28f6cfeb
|
|
| BLAKE2b-256 |
9afaf359bb814c4269c8c8bc48e48bb38c9f860abc04371e8a9a670e05dfef64
|
File details
Details for the file excel_slim-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 850.7 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2396f20a87c97eea6ec5d09dcd3e57e4dade99ca4cb5928aa69990d1c9dd62d2
|
|
| MD5 |
089d533cebfd796ea1ad632c3830fc84
|
|
| BLAKE2b-256 |
bd52ed6cff02675210e8933ebb6d90c2823d3bea2ed74cbc3712bd9b32a45922
|
File details
Details for the file excel_slim-0.1.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 813.0 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0f0d0d2d959ab26b9f57cc60c2d87a999295b283165dc095800e5eddb3ef30a
|
|
| MD5 |
3b2f90a4692d854536e1b6c18b0babfa
|
|
| BLAKE2b-256 |
8fbf7086c3d6f5eb21559c8177a6998050ba40ff36cb36a8e1615abcb9d411e5
|
File details
Details for the file excel_slim-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0676ad90585c92b2ef9d38b1c645d1cb768b9b4862ee33a659d219684e18ba26
|
|
| MD5 |
d693e170e29022fa23ee9ee2e22d97f9
|
|
| BLAKE2b-256 |
922139fd252f5350213a955d16eba63ff0248c9167b42aa93f41ee4bb8e5010c
|
File details
Details for the file excel_slim-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 850.5 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18fe332a379db3234a2459635f6613015afb818187242bf7363657f5bd5b2410
|
|
| MD5 |
801b5aff701529b2198ca4f0fd146c11
|
|
| BLAKE2b-256 |
36fe097679c452d7f985159daab219fb69d2ddb3537af9dceeffdc8ad410c446
|
File details
Details for the file excel_slim-0.1.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 813.1 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d12a4722979a6420e8d55810c81d5942462eb8a152ea5548077b588c201ea5a8
|
|
| MD5 |
22245bdd77258474c5d9f47b25ecb25e
|
|
| BLAKE2b-256 |
4014839a57dbf1d93fb06bdd69d153ab012427061f8fbd91e859f77795ff3b63
|
File details
Details for the file excel_slim-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fae051c5a63b78384e12830795071273977e082c166826c70883353eedc8b18a
|
|
| MD5 |
2d992fc7eb138b0bdc72f4a3823b1b96
|
|
| BLAKE2b-256 |
af44852d668665edf5efb09fc8eb7085bf67b26c0132b82621a7d7272f5d0ff9
|
File details
Details for the file excel_slim-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 850.6 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67554052883df52c24f6d68acc637a807f57ad998a65870e70bd3e3af6d266a6
|
|
| MD5 |
db12d4fe5f49a93dddfcf7d025e38f34
|
|
| BLAKE2b-256 |
8309c23ddad27a3afca1b3678907fa990ca24a1166613e67fdff244a60ab4572
|
File details
Details for the file excel_slim-0.1.0-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 813.1 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39b1f25227520f7f4fcd6f6570a52910ae1db0627b4f13db24e0dfdaa47c836b
|
|
| MD5 |
79cbc4e576fd30cdf5b61623bca4aaa4
|
|
| BLAKE2b-256 |
d1c82407e4a826178ee829ba2a6d2054f2b8943320ed01ba0c250c6a93e640ca
|
File details
Details for the file excel_slim-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0805ccae040071fd429edf88f558b031434897521a1631b0495b58b0253e18c
|
|
| MD5 |
ac556ebc6a65c4dcc5619b747cbdcd5c
|
|
| BLAKE2b-256 |
82b63c1c9a3b14230bf6f4265a1904a329c195b343e2484dde93a384d9c8956d
|
File details
Details for the file excel_slim-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 850.6 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c340ca5045039da488b8a9241936164cb3781ce8b5f22539bf94bc3e8dc2b570
|
|
| MD5 |
8c95cbe6c5c3c52d56f0462f48a2c35f
|
|
| BLAKE2b-256 |
4d437d7683928e2b9e3a02d1fd847cc0b6d3b8d2fce06d00fad52f4222b13d0c
|
File details
Details for the file excel_slim-0.1.0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 812.8 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8c9324ccd09ecdc95bbf8135f80beae67f09ad37b6f924705eeeea5dd6c82c6
|
|
| MD5 |
bb0954ef3026adb78caaf2aed3f62c4d
|
|
| BLAKE2b-256 |
1561255136e6d75929b231770e1aa2b4efaff53e1a8f181a63cf68af522c90c3
|
File details
Details for the file excel_slim-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a18c68c72e7932c03042d5e049975eaed20bb6bad37a0f28330b3211ed02b13
|
|
| MD5 |
d9cd80dd824307fae0e031ec14fd8fb2
|
|
| BLAKE2b-256 |
d53565606031917b7bf1a47b13e3c07ec40cd2b5f2f2010bb45496bf41b8b9db
|
File details
Details for the file excel_slim-0.1.0-cp38-cp38-macosx_11_0_arm64.whl.
File metadata
- Download URL: excel_slim-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 850.4 kB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a00ab1f5d6b252ca06531e9b9e04fa8e48b91ff8fa54f24fe4719b5ba736fef
|
|
| MD5 |
d1b7be7310567a573538c92c1195c443
|
|
| BLAKE2b-256 |
bbd12abb662917164d05a8cfb711ebb327837e21f8ce70b1f587e5d233fbf0a3
|