Repository navigation
Releases
Releases · crabxl/crabxl-python
crabxl-bindings 0.6.1
It uses the Rust core 0.4.2.
Changed
- Reading and writing large workbooks is faster, from the Rust core's
faster readers and writers.
Fixed
- Unstyled date and time cells written by the streaming writer share one
style instead of creating one per cell.
crabxl-openpyxl 0.6.0
Added
- The first release as a package of its own. Until crabxl 0.5.0, this
interface wascrabxl.openpyxlin the crabxl package; its version numbers
continue from there. - It supports Python 3.9 and newer. Import
crabxl_openpyxlin place of
openpyxl. Withpip install "crabxl[openpyxl]"on Python 3.13 or newer,
crabxl.openpyxlis the same module. - The wheel includes the openpyxl license for the code adapted from openpyxl.
crabxl-bindings 0.6.0
It uses the Rust core 0.4.1.
Added
- The first release as a package of its own: the native module of crabxl
0.6.0, for CPython 3.9 to 3.15. Its version numbers continue from crabxl.
crabxl 0.6.0
Changed
- CrabXL needs Python 3.13 or newer.
- The openpyxl interface is the new package crabxl-openpyxl, which supports
Python 3.9 and newer. Install it withpip install "crabxl[openpyxl]"to
keep usingcrabxl.openpyxl, which is the modulecrabxl_openpyxl: its
submodules and classes are the same objects. - The native module is the new package crabxl-bindings, a dependency of
crabxl, so the crabxl wheel is pure Python. Workbook.open,Reader.open,Writer.createand everywithblock are
typed to return the class they are called on, so a subclass gets its own
type.DataValidation.listis typed to accept numbers, which it saves as text.- Reading
Workbook.propertiesraisesFileFormatErrorwhen the file holds
an unreadable created or modified date, instead of returningNoneas if
the date were missing. name in book.defined_nameschecks workbook-wide names only, like indexing
andremove. Names limited to one sheet are still in the iteration.- A closed
ReaderraisesStateErrorfromsheet_namestoo. RowSpan.hide()andColumnSpan.hide()are now thehiddenproperty,
which also reads whether a row or column is hidden:
sheet.columns("D").hidden = True.
Fixed
Workbook.to_bytes, and saving or finishing into a binary file, no longer
copy the file contents once more.
0.5.0
It uses the Rust core 0.4.0.
Changed
- CrabXL needs Python 3.12 or newer. The public type aliases use the
typestatement (PEP 695). - A chart no longer holds its place:
sheet.charts.add(chart, at="E2:L18"),
as for pictures.Charttakes the kind, the series and the options.
Iteratingsheet.chartsgivesPlacedChartvalues. RowsandColumnsare nowRowSpanandColumnSpan, so they differ
fromRow, a row thatReaderreads.- A streaming sheet uses the collections of a workbook sheet:
sheet.merges.add(...),sheet.validations.add(...)and
sheet.conditional_formats.add(...)replacemerge,add_validation
andadd_conditional_format. freeze_panesandcolumns(...).widthof a streaming sheet read back the
values you set, instead ofNone.from crabxl import load_workbookand the other openpyxl names now raise
a plainImportError. Import them fromcrabxl.openpyxl.
Added
Workbook.openandReader.openaccept any bytes-like object, such as
bytearray,memoryviewormmap.- The worksheet collections of
ReaderandWriterare public types,
WorksheetReadersandWorksheetWriters, with anamesproperty. Source,Target,Limits,Numbers,DatesandVisibilityare
exported for type annotations.
0.4.0
It uses the Rust core 0.4.0.
Changed
- Tables, validations and conditional formats read back as the values you
add: iteratingsheet.validationsgivesDataValidationvalues, and
sheet.conditional_formatsgivesConditionalFormatvalues, instead of
tuples. Validation bounds read as numbers and list choices as a tuple. ConditionalFormattakesranges=likeDataValidation, and can apply
to several ranges:ConditionalFormat.cell(">", 5, ranges="B2:B9", ...).DataValidation.liststores its choices as a tuple, so rules are hashable.
list_fromandcustomdrop a leading=.Properties.createdandProperties.modifiedare timezone-aware
datetimevalues. Assigning a naivedatetimeraisesInvalidInputError.Table.totals_rowtakes part in equality.
Added
- Charts:
sheet.chartsadds, reads and removes column, bar, line, area,
pie, doughnut and scatter charts made ofSeries. - Printing:
sheet.page_setupreads and sets aPageSetupwith orientation,
paper size, scale, fit to pages,Margins, centering, grid lines, print
area and repeated title rows and columns. sheet.auto_filter,sheet.tab_color, andoutline_levelon
sheet.rows(...)andsheet.columns(...)to group rows and columns.DataValidation.dateandDataValidation.time. Date and time rules read
back withdatetime.dateanddatetime.timebounds.- Iterating
sheet.imagesgivesPlacedImagevalues.sheet.images,
sheet.chartsandsheet.conditional_formatshaveremove(ref). Table(totals_row=True)adds a table whose last row is a totals row. Its
cells hold text, a formula or nothing; Excel rejects other values there.- Tables read back
banded_rows; rules read back their comparison, second
bound, blank handling, prompt, error message and style. Merges,Tables,Validations,ConditionalFormats,Images,
DefinedNamesandValidationValueare exported fromcrabxl.crabxl.load_workbookand other names that moved tocrabxl.openpyxl
raise anImportErrorthat names the new location.
Fixed
- A worksheet renamed through one handle is renamed for every handle:
book.worksheets["Data"]gives the same object each time.
0.3.0
It uses the Rust core 0.3.0.
Changed
crabxlhas its own, fully typed API.Workbookcreates a workbook or
opens one to change it;ReaderandWriterstream rows with bounded
memory. See the documentation.- The openpyxl interface moved to
crabxl.openpyxl. Change
import crabxl as openpyxltoimport crabxl.openpyxl as openpyxl. Its
behavior is unchanged: the openpyxl 3.1.5 suite gives the same results.
Added
- Lossless saves: a save raises
UnsupportedErrorinstead of dropping
content CrabXL cannot keep. Open withdata_loss="allow"to permit it. - Row and column inserts and deletes update formulas on every sheet,
defined names, tables, rules, merges, row heights, charts, anchors and
internal hyperlinks. - Atomic saves to paths. An existing file keeps its permissions.
numbers="exact"returns non-integers asDecimal; integers of any size
are exactintvalues.- Date formats read by the parts they show:
datetime.datefor date-only
formats anddatetime.timefor time-only formats. - A typed exception hierarchy under
CrabXLError, withsheet,celland
partattributes. py.typedand a stub for the native module. The public package passes
mypy and pyright in strict mode.
0.2.2
It uses the Rust core 0.2.2.
It needs the Rust core fixes listed under Unreleased in the core changelog.
Fixed
- Freezing panes again, or unfreezing them, left selections for panes that no
longer exist, and Excel repaired the file. merge_cellsraisesValueErrorwhen the range overlaps another merged
range. Excel removed such merges as damaged content.- Write-only rows could hold at most about 8,000 cells or 1 MiB of text. They
now take all 16,384 columns, limited only by the memory budget. - Hyperlinks move with their cells on
insert_rows,insert_cols,
delete_rowsanddelete_cols. - Excel's
_xHHHH_escapes are decoded when reading, and literal text that
looks like one is escaped when writing. Tokenizeraccepts spill references such asA1#.
Changed
sheet.cell()anditer_rows()with cell objects are about 35% faster.- Text longer than 32,767 characters raises
ValueError. openpyxl cuts it
off without a warning.
0.2.1
It uses the Rust core 0.2.1.
Changed
- Loading no longer stops real workbooks at limits meant for hostile files.
The old limits rejected, for example, files with more than 1,024 sheets or
16,384 parts, 16 MiB of styles or names, or a cell over 64 KiB. The guards
that remain stop ZIP bombs, deeply nested XML and huge XML tokens, and the
default opens every file Excel writes.
Added
load_workbook(..., limits=...)takes"strict"for uploads from
strangers,"unlimited"for files you trust, or aResourceLimits.
ResourceLimits.strict()andResourceLimits.unlimited()give the presets,
and theCRABXL_LIMITSenvironment variable sets the preset for code that
cannot pass arguments, such as pandas.max_expansion_ratiostops ZIP bombs: an entry larger than 1 MiB may
expand at most 100 times.crabxl.LimitExceededError, aValueError, says which guard a file
exceeded and how to relax it.
Fixed
iter_rowswith all four limits no longer scans every cell of the sheet,
and assigning a font, fill, border or alignment no longer imports the
style module each time. Styling each appended row of a 34,000-row
workbook took about 1.5 times as long as in openpyxl; it is now slightly
faster than openpyxl.- Reading and writing cells one at a time does less work per cell. Reading
cell.valueno longer imports modules,ws.cell(row, column, value)
writes the cell once instead of twice, and checking text for illegal
characters no longer loops over every character in Python. - Reading a cell's font, fill, border, alignment or protection took about
three times as long as in openpyxl, and creating a newFontor
Alignmentfor each cell about 1.7 times. Both now take about as long as
in openpyxl. - On Windows, saving a workbook over a file that a loaded workbook still had
open failed with "access denied". It now replaces the file.
0.2.0
It uses the Rust core 0.2.0.
Added
Workbook.save(filename, calculate=True)calculates every formula first
and saves each result as the formula's cached value, so programs that read
cached values, such asopenpyxlwithdata_only=Trueor pandas, see
current results. It works for new and loaded workbooks, not write-only
ones. Array formulas are not calculated and lose their cached values.
Changed
- Wheels are about twice as large, because they include the calculation
engine.