| 1 |
Changes |
| 2 |
======= |
| 3 |
|
| 4 |
Version 1.7.20 |
| 5 |
-------------- |
| 6 |
|
| 7 |
## Whats Changed |
| 8 |
|
| 9 |
* Fix filldown RuntimeError on header-only tables |
| 10 |
By :user:`sarathfrancis90`, :issue:`698`. |
| 11 |
* feat: modernize python dependencies in CI |
| 12 |
By :user:`juarezr`, :issue:`702`. |
| 13 |
|
| 14 |
Version 1.7.19 |
| 15 |
-------------- |
| 16 |
|
| 17 |
## Whats Changed |
| 18 |
|
| 19 |
* Add drop=if_exists support to todb |
| 20 |
By :user:`akashmalbari`, :issue:`695`. |
| 21 |
|
| 22 |
Version 1.7.18 |
| 23 |
-------------- |
| 24 |
|
| 25 |
## Whats Changed |
| 26 |
|
| 27 |
* Fix tojson() output for stdin-backed CSV input |
| 28 |
By :user:`akashmalbari`, :issue:`693`. |
| 29 |
* feat: add argument ownsb to fromdb function |
| 30 |
By :user:`juarezr`, :issue:`694`. |
| 31 |
|
| 32 |
Version 1.7.17 |
| 33 |
-------------- |
| 34 |
|
| 35 |
## Whats Changed |
| 36 |
|
| 37 |
* ci: added readthedocs settings file |
| 38 |
By :user:`juarezr`, :issue:`677`. |
| 39 |
|
| 40 |
* build and publish a wheel |
| 41 |
By :user:`dimbleby`, :issue:`679`. |
| 42 |
|
| 43 |
* Added ability to infer JSON column type into db_create.py |
| 44 |
By :user:`muhammadbadar1998`, :issue:`682`. |
| 45 |
|
| 46 |
* fix: mitigate code injection related in #672 |
| 47 |
By :user:`juarezr`, :issue:`681`. |
| 48 |
|
| 49 |
* Add ``drop='if_exists'`` support to :func:`petl.io.db.todb`. |
| 50 |
:issue:`666`. |
| 51 |
|
| 52 |
Version 1.7.16 |
| 53 |
-------------- |
| 54 |
|
| 55 |
* CI: added jobs for testing petl with python 3.13 and macos-13 on Intel platform |
| 56 |
By :user:`juarezr`, :issue:`675`. |
| 57 |
|
| 58 |
* CI: workaround for actions/setup-python as Github removed support for python 3.7 |
| 59 |
By :user:`juarezr`, :issue:`675`. |
| 60 |
|
| 61 |
* Fix: Joining tables with uneven rows gives wrong result. |
| 62 |
By :user:`MichalKarol`. |
| 63 |
|
| 64 |
Version 1.7.15 |
| 65 |
-------------- |
| 66 |
|
| 67 |
* Add unit tests for randomtable, dummytable, and their supporting functions and classes. |
| 68 |
By :user:`bmos`, :issue:`657`. |
| 69 |
|
| 70 |
* Fix: DeprecationWarning: Seeding based on hashing is deprecated since Python 3.9 and will be removed in a subsequent version. |
| 71 |
By :user:`bmos`, :issue:`657`. |
| 72 |
|
| 73 |
Version 1.7.14 |
| 74 |
-------------- |
| 75 |
|
| 76 |
* Enhancement: Fix other functions to conform with PEP 479 |
| 77 |
By :user:`augustomen`, :issue:`645`. |
| 78 |
|
| 79 |
* CI: fix build as SQLAlchemy 2 is not supported yet |
| 80 |
By :user:`juarezr`, :issue:`635`. |
| 81 |
|
| 82 |
* CI: workaround for actions/setup-python#672 as Github removed python 2.7 and 3.6 |
| 83 |
By :user:`juarezr`, :issue:`649`. |
| 84 |
|
| 85 |
* CI: Gh actions upgrade |
| 86 |
By :user:`juarezr`, :issue:`639`. |
| 87 |
|
| 88 |
Version 1.7.13 |
| 89 |
-------------- |
| 90 |
|
| 91 |
* Fix in case a custom protocol was registered in fsspec |
| 92 |
By :user:`timheb`, :issue:`647`. |
| 93 |
|
| 94 |
Version 1.7.12 |
| 95 |
-------------- |
| 96 |
|
| 97 |
* Fix: calling functions to*() should output by default to stdout |
| 98 |
By :user:`juarezr`, :issue:`632`. |
| 99 |
|
| 100 |
* Add python3.11 for the build and testing |
| 101 |
By :user:`juarezr`, :issue:`635`. |
| 102 |
|
| 103 |
* Add support for writing to JSONL files |
| 104 |
By :user:`mzaeemz`, :issue:`524`. |
| 105 |
|
| 106 |
Version 1.7.11 |
| 107 |
-------------- |
| 108 |
|
| 109 |
* Fix generator support in fromdicts to use file cache |
| 110 |
By :user:`arturponinski`, :issue:`625`. |
| 111 |
|
| 112 |
Version 1.7.10 |
| 113 |
-------------- |
| 114 |
|
| 115 |
* Fix fromtsv() to pass on header argument |
| 116 |
By :user:`jfitzell`, :issue:`622`. |
| 117 |
|
| 118 |
Version 1.7.9 |
| 119 |
------------- |
| 120 |
|
| 121 |
* Feature: Add improved support for working with Google Sheets |
| 122 |
By :user:`juarezr`, :issue:`615`. |
| 123 |
|
| 124 |
* Maintanance: Improve test helpers testing |
| 125 |
By :user:`juarezr`, :issue:`614`. |
| 126 |
|
| 127 |
Version 1.7.8 |
| 128 |
------------- |
| 129 |
|
| 130 |
* Fix iterrowslice() to conform with PEP 479 |
| 131 |
By :user:`arturponinski`, :issue:`575`. |
| 132 |
|
| 133 |
* Cleanup and unclutter old and unused files in repository |
| 134 |
By :user:`juarezr`, :issue:`606`. |
| 135 |
|
| 136 |
* Add tohtml with css styles test case |
| 137 |
By :user:`juarezr`, :issue:`609`. |
| 138 |
|
| 139 |
* Fix sortheader() to not overwrite data for duplicate column names |
| 140 |
By :user:`arturponinski`, :issue:`392`. |
| 141 |
|
| 142 |
* Add NotImplementedError to IterContainer's __iter__ |
| 143 |
By :user:`arturponinski`, :issue:`483`. |
| 144 |
|
| 145 |
* Add casting of headers to strings in toxlsx and appendxlsx |
| 146 |
By :user:`arturponinski`, :issue:`530`. |
| 147 |
|
| 148 |
* Fix sorting of rows with different length |
| 149 |
By :user:`arturponinski`, :issue:`385`. |
| 150 |
|
| 151 |
Version 1.7.7 |
| 152 |
------------- |
| 153 |
|
| 154 |
* New pull request template. No python changes. |
| 155 |
By :user:`juarezr`, :issue:`594`. |
| 156 |
|
| 157 |
Version 1.7.6 |
| 158 |
------------- |
| 159 |
|
| 160 |
* Fix convertall does not work when table header has non-string elements |
| 161 |
By :user:`dnicolodi`, :issue:`579`. |
| 162 |
|
| 163 |
* Fix todataframe() to do not iterate the table multiple times |
| 164 |
By :user:`dnicolodi`, :issue:`578`. |
| 165 |
|
| 166 |
* Fix broken aggregate when supplying single key |
| 167 |
By :user:`MalayGoel`, :issue:`552`. |
| 168 |
|
| 169 |
* Migrated to pytest |
| 170 |
By :user:`arturponinski`, :issue:`584`. |
| 171 |
|
| 172 |
* Testing python 3.10 on Github Actions. No python changes. |
| 173 |
By :user:`juarezr`, :issue:`591`. |
| 174 |
|
| 175 |
* codacity: upgrade to latest/main github action version. No python changes. |
| 176 |
By :user:`juarezr`, :issue:`585`. |
| 177 |
|
| 178 |
* Publish releases to PyPI with Github Actions. No python changes. |
| 179 |
By :user:`juarezr`, :issue:`593`. |
| 180 |
|
| 181 |
Version 1.7.5 |
| 182 |
------------- |
| 183 |
|
| 184 |
* Added Decimal to numeric types |
| 185 |
By :user:`blas`, :issue:`573`. |
| 186 |
|
| 187 |
* Add support for ignore_workbook_corruption parameter in xls |
| 188 |
By :user:`arturponinski`, :issue:`572`. |
| 189 |
|
| 190 |
* Add support for generators in the petl.fromdicts |
| 191 |
By :user:`arturponinski`, :issue:`570`. |
| 192 |
|
| 193 |
* Add function to support fromdb, todb, appenddb via clickhouse_driver |
| 194 |
By :user:`superjcd`, :issue:`566`. |
| 195 |
|
| 196 |
* Fix fromdicts(...).header() raising TypeError |
| 197 |
By :user:`romainernandez`, :issue:`555`. |
| 198 |
|
| 199 |
Version 1.7.4 |
| 200 |
------------- |
| 201 |
|
| 202 |
* Use python 3.6 instead of 2.7 for deploy on travis-ci. No python changes. |
| 203 |
By :user:`juarezr`, :issue:`550`. |
| 204 |
|
| 205 |
Version 1.7.3 |
| 206 |
------------- |
| 207 |
|
| 208 |
* Fixed SQLAlchemy 1.4 removed the Engine.contextual_connect method |
| 209 |
By :user:`juarezr`, :issue:`545`. |
| 210 |
|
| 211 |
* How to use convert with custom function and reference row |
| 212 |
By :user:`javidy`, :issue:`542`. |
| 213 |
|
| 214 |
Version 1.7.2 |
| 215 |
------------- |
| 216 |
|
| 217 |
* Allow aggregation over the entire table (without a key) |
| 218 |
By :user:`bmaggard`, :issue:`541`. |
| 219 |
|
| 220 |
* Allow specifying output field name for simple aggregation |
| 221 |
By :user:`bmaggard`, :issue:`370`. |
| 222 |
|
| 223 |
* Bumped version of package dependency on lxml from 4.4.0 to 4.6.2 |
| 224 |
By :user:`juarezr`, :issue:`536`. |
| 225 |
|
| 226 |
Version 1.7.1 |
| 227 |
------------- |
| 228 |
|
| 229 |
* Fixing conda packaging failures. |
| 230 |
By :user:`juarezr`, :issue:`534`. |
| 231 |
|
| 232 |
|
| 233 |
Version 1.7.0 |
| 234 |
------------- |
| 235 |
|
| 236 |
* Added `toxml()` as convenience wrapper over `totext()`. |
| 237 |
By :user:`juarezr`, :issue:`529`. |
| 238 |
|
| 239 |
* Document behavior of multi-field convert-with-row. |
| 240 |
By :user:`chrullrich`, :issue:`532`. |
| 241 |
|
| 242 |
* Allow user defined sources from fsspec for :ref:`remote I/O <io_remotes>`. |
| 243 |
By :user:`juarezr`, :issue:`533`. |
| 244 |
|
| 245 |
|
| 246 |
Version 1.6.8 |
| 247 |
------------- |
| 248 |
|
| 249 |
* Allow using a custom/restricted xml parser in `fromxml()`. |
| 250 |
By :user:`juarezr`, :issue:`527`. |
| 251 |
|
| 252 |
|
| 253 |
Version 1.6.7 |
| 254 |
------------- |
| 255 |
|
| 256 |
* Reduced memory footprint for JSONL files, huge improvement. |
| 257 |
By :user:`fahadsiddiqui`, :issue:`522`. |
| 258 |
|
| 259 |
|
| 260 |
Version 1.6.6 |
| 261 |
------------- |
| 262 |
|
| 263 |
* Added python version 3.8 and 3.9 to tox.ini for using in newer distros. |
| 264 |
By :user:`juarezr`, :issue:`517`. |
| 265 |
|
| 266 |
* Fixed compatibility with python3.8 in `petl.timings.clock()`. |
| 267 |
By :user:`juarezr`, :issue:`484`. |
| 268 |
|
| 269 |
* Added json lines support in `fromjson()`. |
| 270 |
By :user:`fahadsiddiqui`, :issue:`521`. |
| 271 |
|
| 272 |
|
| 273 |
Version 1.6.5 |
| 274 |
------------- |
| 275 |
|
| 276 |
* Fixed `fromxlsx()` with read_only crashes. |
| 277 |
By :user:`juarezr`, :issue:`514`. |
| 278 |
|
| 279 |
|
| 280 |
Version 1.6.4 |
| 281 |
------------- |
| 282 |
|
| 283 |
* Fixed exception when writing to S3 with ``fsspec`` ``auto_mkdir=True``. |
| 284 |
By :user:`juarezr`, :issue:`512`. |
| 285 |
|
| 286 |
|
| 287 |
Version 1.6.3 |
| 288 |
------------- |
| 289 |
|
| 290 |
* Allowed reading and writing Excel files in remote sources. |
| 291 |
By :user:`juarezr`, :issue:`506`. |
| 292 |
|
| 293 |
* Allow `toxlsx()` to add or replace a worksheet. |
| 294 |
By :user:`churlrich`, :issue:`502`. |
| 295 |
|
| 296 |
* Improved avro: improve message on schema or data mismatch. |
| 297 |
By :user:`juarezr`, :issue:`507`. |
| 298 |
|
| 299 |
* Fixed build for failed test case. By :user:`juarezr`, :issue:`508`. |
| 300 |
|
| 301 |
|
| 302 |
Version 1.6.2 |
| 303 |
------------- |
| 304 |
|
| 305 |
* Fixed boolean type detection in toavro(). By :user:`juarezr`, :issue:`504`. |
| 306 |
|
| 307 |
* Fix unavoidable warning if fsspec is installed but some optional package is |
| 308 |
not installed. |
| 309 |
By :user:`juarezr`, :issue:`503`. |
| 310 |
|
| 311 |
|
| 312 |
Version 1.6.1 |
| 313 |
------------- |
| 314 |
|
| 315 |
* Added `extras_require` for the `petl` pip package. |
| 316 |
By :user:`juarezr`, :issue:`501`. |
| 317 |
|
| 318 |
* Fix unavoidable warning if fsspec is not installed. |
| 319 |
By :user:`juarezr`, :issue:`500`. |
| 320 |
|
| 321 |
|
| 322 |
Version 1.6.0 |
| 323 |
------------- |
| 324 |
|
| 325 |
* Added class :class:`petl.io.remotes.RemoteSource` using package **fsspec** |
| 326 |
for reading and writing files in remote servers by using the protocol in the |
| 327 |
url for selecting the implementation. |
| 328 |
By :user:`juarezr`, :issue:`494`. |
| 329 |
|
| 330 |
* Removed classes :class:`petl.io.source.s3.S3Source` as it's handled by fsspec |
| 331 |
By :user:`juarezr`, :issue:`494`. |
| 332 |
|
| 333 |
* Removed classes :class:`petl.io.codec.xz.XZCodec`, :class:`petl.io.codec.xz.LZ4Codec` |
| 334 |
and :class:`petl.io.codec.zstd.ZstandardCodec` as it's handled by fsspec. |
| 335 |
By :user:`juarezr`, :issue:`494`. |
| 336 |
|
| 337 |
* Fix bug in connection to a JDBC database using jaydebeapi. |
| 338 |
By :user:`miguelosana`, :issue:`497`. |
| 339 |
|
| 340 |
|
| 341 |
Version 1.5.0 |
| 342 |
------------- |
| 343 |
|
| 344 |
* Added functions :func:`petl.io.sources.register_reader` and |
| 345 |
:func:`petl.io.sources.register_writer` for registering custom source helpers for |
| 346 |
hanlding I/O from remote protocols. |
| 347 |
By :user:`juarezr`, :issue:`491`. |
| 348 |
|
| 349 |
* Added function :func:`petl.io.sources.register_codec` for registering custom |
| 350 |
helpers for compressing and decompressing files with other algorithms. |
| 351 |
By :user:`juarezr`, :issue:`491`. |
| 352 |
|
| 353 |
* Added classes :class:`petl.io.codec.xz.XZCodec`, :class:`petl.io.codec.xz.LZ4Codec` |
| 354 |
and :class:`petl.io.codec.zstd.ZstandardCodec` for compressing files with `XZ` and |
| 355 |
the "state of art" `LZ4` and `Zstandard` algorithms. |
| 356 |
By :user:`juarezr`, :issue:`491`. |
| 357 |
|
| 358 |
* Added classes :class:`petl.io.source.s3.S3Source` and |
| 359 |
:class:`petl.io.source.smb.SMBSource` reading and writing files to remote |
| 360 |
servers using int url the protocols `s3://` and `smb://`. |
| 361 |
By :user:`juarezr`, :issue:`491`. |
| 362 |
|
| 363 |
|
| 364 |
Version 1.4.0 |
| 365 |
------------- |
| 366 |
|
| 367 |
* Added functions :func:`petl.io.avro.fromavro`, :func:`petl.io.avro.toavro`, |
| 368 |
and :func:`petl.io.avro.appendavro` for reading and writing to |
| 369 |
`Apache Avro <https://avro.apache.org/docs/current/spec.html>` files. Avro |
| 370 |
generally is faster and safer than text formats like Json, XML or CSV. |
| 371 |
By :user:`juarezr`, :issue:`490`. |
| 372 |
|
| 373 |
|
| 374 |
Version 1.3.0 |
| 375 |
------------- |
| 376 |
|
| 377 |
.. note:: |
| 378 |
The parameters to the :func:`petl.io.xlsx.fromxlsx` function have changed |
| 379 |
in this release. The parameters ``row_offset`` and ``col_offset`` are no longer |
| 380 |
supported. Please use ``min_row``, ``min_col``, ``max_row`` and ``max_col`` instead. |
| 381 |
|
| 382 |
* A new configuration option `failonerror` has been added to the :mod:`petl.config` |
| 383 |
module. This option affects various transformation functions including |
| 384 |
:func:`petl.transform.conversions.convert`, :func:`petl.transform.maps.fieldmap`, |
| 385 |
:func:`petl.transform.maps.rowmap` and :func:`petl.transform.maps.rowmapmany`. |
| 386 |
The option can have values `True` (raise any exceptions encountered during conversion), |
| 387 |
`False` (silently use a given `errorvalue` if any exceptions arise during conversion) or |
| 388 |
`"inline"` (use any exceptions as the output value). The default value is `False` which |
| 389 |
maintains compatibility with previous releases. By :user:`bmaggard`, :issue:`460`, |
| 390 |
:issue:`406`, :issue:`365`. |
| 391 |
|
| 392 |
* A new function :func:`petl.util.timing.log_progress` has been added, which behaves |
| 393 |
in a similar way to :func:`petl.util.timing.progress` but writes to a Python logger. |
| 394 |
By :user:`dusktreader`, :issue:`408`, :issue:`407`. |
| 395 |
|
| 396 |
* Added new function :func:`petl.transform.regex.splitdown` for splitting a value into |
| 397 |
multiple rows. By :user:`John-Dennert`, :issue:`430`, :issue:`386`. |
| 398 |
|
| 399 |
* Added new function :func:`petl.transform.basics.addfields` to add multiple new fields |
| 400 |
at a time. By :user:`mjumbewu`, :issue:`417`. |
| 401 |
|
| 402 |
* Pass through keyword arguments to :func:`xlrd.open_workbook`. By :user:`gjunqueira`, |
| 403 |
:issue:`470`, :issue:`473`. |
| 404 |
|
| 405 |
* Added new function :func:`petl.io.xlsx.appendxlsx`. By :user:`victormpa` and :user:`alimanfoo`, |
| 406 |
:issue:`424`, :issue:`475`. |
| 407 |
|
| 408 |
* Fixes for upstream API changes in openpyxl and intervaltree modules. N.B., the arguments |
| 409 |
to :func:`petl.io.xlsx.fromxlsx` have changed for specifying row and column offsets |
| 410 |
to match openpyxl. (:issue:`472` - :user:`alimanfoo`). |
| 411 |
|
| 412 |
* Exposed `read_only` argument in :func:`petl.io.xlsx.fromxlsx` and set default to |
| 413 |
False to prevent truncation of files created by LibreOffice. By :user:`mbelmadani`, |
| 414 |
:issue:`457`. |
| 415 |
|
| 416 |
* Added support for reading from remote sources with gzip or bz2 compression |
| 417 |
(:issue:`463` - :user:`H-Max`). |
| 418 |
|
| 419 |
* The function :func:`petl.transform.dedup.distinct` has been fixed for the case |
| 420 |
where ``None`` values appear in the table. By :user:`bmaggard`, :issue:`414`, |
| 421 |
:issue:`412`. |
| 422 |
|
| 423 |
* Changed keyed sorts so that comparisons are only by keys. By :user:`DiegoEPaez`, |
| 424 |
:issue:`466`. |
| 425 |
|
| 426 |
* Documentation improvements by :user:`gamesbook` (:issue:`458`). |
| 427 |
|
| 428 |
|
| 429 |
Version 1.2.0 |
| 430 |
------------- |
| 431 |
|
| 432 |
Please note that this version drops support for Python 2.6 (:issue:`443`, |
| 433 |
:issue:`444` - :user:`hugovk`). |
| 434 |
|
| 435 |
* Function :func:`petl.transform.basics.addrownumbers` now supports a "field" |
| 436 |
argument to allow specifying the name of the new field to be added |
| 437 |
(:issue:`366`, :issue:`367` - :user:`thatneat`). |
| 438 |
* Fix to :func:`petl.io.xlsx.fromxslx` to ensure that the underlying workbook is |
| 439 |
closed after iteration is complete (:issue:`387` - :user:`mattkatz`). |
| 440 |
* Resolve compatibility issues with newer versions of openpyxl |
| 441 |
(:issue:`393`, :issue:`394` - :user:`henryrizzi`). |
| 442 |
* Fix deprecation warnings from openpyxl (:issue:`447`, :issue:`445` - |
| 443 |
:user:`scardine`; :issue:`449` - :user:`alimanfoo`). |
| 444 |
* Changed exceptions to use standard exception classes instead of ArgumentError |
| 445 |
(:issue:`396` - :user:`bmaggard`). |
| 446 |
* Add support for non-numeric quoting in CSV files (:issue:`377`, :issue:`378` |
| 447 |
- :user:`vilos`). |
| 448 |
* Fix bug in handling of mode in MemorySource (:issue:`403` - :user:`bmaggard`). |
| 449 |
* Added a get() method to the Record class (:issue:`401`, :issue:`402` - |
| 450 |
:user:`dusktreader`). |
| 451 |
* Added ability to make constraints optional, i.e., support validation on |
| 452 |
optional fields (:issue:`399`, :issue:`400` - :user:`dusktreader`). |
| 453 |
* Added support for CSV files without a header row (:issue:`421` - |
| 454 |
:user:`LupusUmbrae`). |
| 455 |
* Documentation fixes (:issue:`379` - :user:`DeanWay`; :issue:`381` - |
| 456 |
:user:`PabloCastellano`). |
| 457 |
|
| 458 |
Version 1.1.0 |
| 459 |
------------- |
| 460 |
|
| 461 |
* Fixed :func:`petl.transform.reshape.melt` to work with non-string key |
| 462 |
argument (`#209 <https://github.com/petl-developers/petl/issues/209>`_). |
| 463 |
* Added example to docstring of :func:`petl.transform.dedup.conflicts` to |
| 464 |
illustrate how to analyse the source of conflicts when rows are merged from |
| 465 |
multiple tables |
| 466 |
(`#256 <https://github.com/petl-developers/petl/issues/256>`_). |
| 467 |
* Added functions for working with bcolz ctables, see :mod:`petl.io.bcolz` |
| 468 |
(`#310 <https://github.com/petl-developers/petl/issues/310>`_). |
| 469 |
* Added :func:`petl.io.base.fromcolumns` |
| 470 |
(`#316 <https://github.com/petl-developers/petl/issues/316>`_). |
| 471 |
* Added :func:`petl.transform.reductions.groupselectlast`. |
| 472 |
(`#319 <https://github.com/petl-developers/petl/issues/319>`_). |
| 473 |
* Added example in docstring for :class:`petl.io.sources.MemorySource` |
| 474 |
(`#323 <https://github.com/petl-developers/petl/issues/323>`_). |
| 475 |
* Added function :func:`petl.transform.basics.stack` as a simpler |
| 476 |
alternative to :func:`petl.transform.basics.cat`. Also behaviour of |
| 477 |
:func:`petl.transform.basics.cat` has changed for tables where the header |
| 478 |
row contains duplicate fields. This was part of addressing a bug in |
| 479 |
:func:`petl.transform.basics.addfield` for tables where the header |
| 480 |
contains duplicate fields |
| 481 |
(`#327 <https://github.com/petl-developers/petl/issues/327>`_). |
| 482 |
* Change in behaviour of :func:`petl.io.json.fromdicts` to preserve |
| 483 |
ordering of keys if ordered dicts are used. Also added |
| 484 |
:func:`petl.transform.headers.sortheader` to deal with unordered |
| 485 |
cases |
| 486 |
(`#332 <https://github.com/petl-developers/petl/issues/332>`_). |
| 487 |
* Added keyword `strict` to functions in the :mod:`petl.transform.setops` |
| 488 |
module to enable users to enforce strict set-like behaviour if desired |
| 489 |
(`#333 <https://github.com/petl-developers/petl/issues/333>`_). |
| 490 |
* Added `epilogue` argument to :func:`petl.util.vis.display` to enable further |
| 491 |
customisation of content of table display in Jupyter notebooks |
| 492 |
(`#337 <https://github.com/petl-developers/petl/issues/337>`_). |
| 493 |
* Added :func:`petl.transform.selects.biselect` as a convenience for |
| 494 |
obtaining two tables, one with rows matching a condition, the other with |
| 495 |
rows not matching the condition |
| 496 |
(`#339 <https://github.com/petl-developers/petl/issues/339>`_). |
| 497 |
* Changed :func:`petl.io.json.fromdicts` to avoid making two passes through |
| 498 |
the data |
| 499 |
(`#341 <https://github.com/petl-developers/petl/issues/341>`_). |
| 500 |
* Changed :func:`petl.transform.basics.addfieldusingcontext` to enable |
| 501 |
running calculations |
| 502 |
(`#343 <https://github.com/petl-developers/petl/issues/343>`_). |
| 503 |
* Fix behaviour of join functions when tables have no non-key fields |
| 504 |
(`#345 <https://github.com/petl-developers/petl/issues/345>`_). |
| 505 |
* Fix incorrect default value for 'errors' argument when using codec module |
| 506 |
(`#347 <https://github.com/petl-developers/petl/issues/347>`_). |
| 507 |
* Added some documentation on how to write extension classes, see :doc:`intro` |
| 508 |
(`#349 <https://github.com/petl-developers/petl/issues/349>`_). |
| 509 |
* Fix issue with unicode field names |
| 510 |
(`#350 <https://github.com/petl-developers/petl/issues/350>`_). |
| 511 |
|
| 512 |
Version 1.0 |
| 513 |
----------- |
| 514 |
|
| 515 |
Version 1.0 is a new major release of :mod:`petl`. The main purpose of |
| 516 |
version 1.0 is to introduce support for Python 3.4, in addition to the |
| 517 |
existing support for Python 2.6 and 2.7. Much of the functionality |
| 518 |
available in :mod:`petl` versions 0.x has remained unchanged in |
| 519 |
version 1.0, and most existing code that uses :mod:`petl` should work |
| 520 |
unchanged with version 1.0 or with minor changes. However there have |
| 521 |
been a number of API changes, and some functionality has been migrated |
| 522 |
from the `petlx`_ package, described below. |
| 523 |
|
| 524 |
If you have any questions about migrating to version 1.0 or find any |
| 525 |
problems or issues please email [email protected]. |
| 526 |
|
| 527 |
Text file encoding |
| 528 |
~~~~~~~~~~~~~~~~~~ |
| 529 |
|
| 530 |
Version 1.0 unifies the API for working with ASCII and non-ASCII |
| 531 |
encoded text files, including CSV and HTML. |
| 532 |
|
| 533 |
The following functions now accept an 'encoding' argument, which |
| 534 |
defaults to the value of ``locale.getpreferredencoding()`` (usually |
| 535 |
'utf-8'): `fromcsv`, `tocsv`, `appendcsv`, `teecsv`, `fromtsv`, |
| 536 |
`totsv`, `appendtsv`, `teetsv`, `fromtext`, `totext`, `appendtext`, |
| 537 |
`tohtml`, `teehtml`. |
| 538 |
|
| 539 |
The following functions have been removed as they are now redundant: |
| 540 |
`fromucsv`, `toucsv`, `appenducsv`, `teeucsv`, `fromutsv`, `toutsv`, |
| 541 |
`appendutsv`, `teeutsv`, `fromutext`, `toutext`, `appendutext`, |
| 542 |
`touhtml`, `teeuhtml`. |
| 543 |
|
| 544 |
To migrate code, in most cases it should be possible to simply replace |
| 545 |
'fromucsv' with 'fromcsv', etc. |
| 546 |
|
| 547 |
`pelt.fluent` and `petl.interactive` |
| 548 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 549 |
|
| 550 |
The functionality previously available through the `petl.fluent` and |
| 551 |
`petl.interactive` modules is now available through the root petl |
| 552 |
module. |
| 553 |
|
| 554 |
This means two things. |
| 555 |
|
| 556 |
First, is is now possible to use either functional or fluent (i.e., |
| 557 |
object-oriented) styles of programming with the root :mod:`petl` |
| 558 |
module, as described in introductory section on |
| 559 |
:ref:`intro_programming_styles`. |
| 560 |
|
| 561 |
Second, the default representation of table objects uses the |
| 562 |
:func:`petl.util.vis.look` function, so you can simply return a table |
| 563 |
from the prompt to inspect it, as described in the introductory |
| 564 |
section on :ref:`intro_interactive_use`. |
| 565 |
|
| 566 |
The `petl.fluent` and `petl.interactive` modules have been removed as |
| 567 |
they are now redundant. |
| 568 |
|
| 569 |
To migrate code, it should be possible to simply replace "import |
| 570 |
petl.fluent as etl" or "import petl.interactive as etl" with "import |
| 571 |
petl as etl". |
| 572 |
|
| 573 |
Note that the automatic caching behaviour of the `petl.interactive` |
| 574 |
module has **not** been retained. If you want to enable caching |
| 575 |
behaviour for a particular table, make an explicit call to the |
| 576 |
:func:`petl.util.materialise.cache` function. See also |
| 577 |
:ref:`intro_caching`. |
| 578 |
|
| 579 |
IPython notebook integration |
| 580 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 581 |
|
| 582 |
In version 1.0 :mod:`petl` table container objects implement |
| 583 |
`_repr_html_()` so can be returned from a cell in an IPython notebook |
| 584 |
and will automatically format as an HTML table. |
| 585 |
|
| 586 |
Also, the :func:`petl.util.vis.display` and |
| 587 |
:func:`petl.util.vis.displayall` functions have been migrated across |
| 588 |
from the `petlx.ipython` package. If you are working within the |
| 589 |
IPython notebook these functions give greater control over how tables |
| 590 |
are rendered. For some examples, see: |
| 591 |
|
| 592 |
http://nbviewer.ipython.org/github/petl-developers/petl/blob/v1.0/repr_html.ipynb |
| 593 |
|
| 594 |
Database extract/load functions |
| 595 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 596 |
|
| 597 |
The :func:`petl.io.db.todb` function now supports automatic table |
| 598 |
creation, inferring a schema from data in the table to be loaded. This |
| 599 |
functionality has been migrated across from the `petlx`_ package, and |
| 600 |
requires `SQLAlchemy <http://www.sqlalchemy.org/>`_ to be installed. |
| 601 |
|
| 602 |
The functions `fromsqlite3`, `tosqlite3` and `appendsqlite3` have been |
| 603 |
removed as they duplicate functionality available from the existing |
| 604 |
functions :func:`petl.io.db.fromdb`, :func:`petl.io.db.todb` and |
| 605 |
:func:`petl.io.db.appenddb`. These existing functions have been |
| 606 |
modified so that if a string is provided as the `dbo` argument it is |
| 607 |
interpreted as the name of an :mod:`sqlite3` file. It should be |
| 608 |
possible to migrate code by simply replacing 'fromsqlite3' with |
| 609 |
'fromdb', etc. |
| 610 |
|
| 611 |
Other functions removed or renamed |
| 612 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 613 |
|
| 614 |
The following functions have been removed because they are overly |
| 615 |
complicated and/or hardly ever used. If you use any of these functions |
| 616 |
and would like to see them re-instated then please email |
| 617 |
[email protected]: `rangefacet`, `rangerowreduce`, |
| 618 |
`rangeaggregate`, `rangecounts`, `multirangeaggregate`, `lenstats`. |
| 619 |
|
| 620 |
The following functions were marked as deprecated in petl 0.x and have |
| 621 |
been removed in version 1.0: `dataslice` (use `data` instead), |
| 622 |
`fieldconvert` (use `convert` instead), `fieldselect` (use `select` instead), |
| 623 |
`parsenumber` (use `numparser` instead), `recordmap` (use `rowmap` instead), |
| 624 |
`recordmapmany` (use `rowmapmany` instead), `recordreduce` (use `rowreduce` |
| 625 |
instead), `recordselect` (use `rowselect` instead), `valueset` (use |
| 626 |
``table.values(‘foo’).set()`` instead). |
| 627 |
|
| 628 |
The following functions are no longer available in the root |
| 629 |
:mod:`petl` namespace, but are still available from a subpackage if |
| 630 |
you really need them: `iterdata` (use `data` instead), `iterdicts` |
| 631 |
(use `dicts` instead), `iternamedtuples` (use `namedtuples` instead), |
| 632 |
`iterrecords` (use `records` instead), `itervalues` (use `values` |
| 633 |
instead). |
| 634 |
|
| 635 |
The following functions have been renamed: `isordered` (renamed to |
| 636 |
`issorted`), `StringSource` (renamed to `MemorySource`). |
| 637 |
|
| 638 |
The function `selectre` has been removed as it duplicates |
| 639 |
functionality, use `search` instead. |
| 640 |
|
| 641 |
Sorting and comparison |
| 642 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 643 |
|
| 644 |
A major difference between Python 2 and Python 3 involves comparison |
| 645 |
and sorting of objects of different types. Python 3 is a lot stricter |
| 646 |
about what you can compare with what, e.g., ``None < 1 < 'foo'`` works |
| 647 |
in Python 2.x but raises an exception in Python 3. The strict |
| 648 |
comparison behaviour of Python 3 is generally a problem for typical |
| 649 |
usages of :mod:`petl`, where data can be highly heterogeneous and a |
| 650 |
column in a table may have a mixture of values of many different |
| 651 |
types, including `None` for missing. |
| 652 |
|
| 653 |
To maintain the usability of :mod:`petl` in this type of scenario, and |
| 654 |
to ensure that the behaviour of :mod:`petl` is as consistent as |
| 655 |
possible across different Python versions, the |
| 656 |
:func:`petl.transform.sorts.sort` function and anything that depends |
| 657 |
on it (as well as any other functions making use of rich comparisons) |
| 658 |
emulate the relaxed comparison behaviour that is available under |
| 659 |
Python 2.x. In fact :mod:`petl` goes further than this, allowing |
| 660 |
comparison of a wider range of types than is possible under Python 2.x |
| 661 |
(e.g., ``datetime`` with ``None``). |
| 662 |
|
| 663 |
As the underlying code to achieve this has been completely reworked, |
| 664 |
there may be inconsistencies or unexpected behaviour, so it's worth |
| 665 |
testing carefully the results of any code previously run using |
| 666 |
:mod:`petl` 0.x, especially if you are also migrating from Python 2 to |
| 667 |
Python 3. |
| 668 |
|
| 669 |
The different comparison behaviour under different Python versions may |
| 670 |
also give unexpected results when selecting rows of a table. E.g., the |
| 671 |
following will work under Python 2.x but raise an exception under |
| 672 |
Python 3.4:: |
| 673 |
|
| 674 |
>>> import petl as etl |
| 675 |
>>> table = [['foo', 'bar'], |
| 676 |
... ['a', 1], |
| 677 |
... ['b', None]] |
| 678 |
>>> # raises exception under Python 3 |
| 679 |
... etl.select(table, 'bar', lambda v: v > 0) |
| 680 |
|
| 681 |
To get the more relaxed behaviour under Python 3.4, |
| 682 |
use the :mod:`petl.transform.selects.selectgt` function, or wrap |
| 683 |
values with :class:`petl.comparison.Comparable`, e.g.:: |
| 684 |
|
| 685 |
>>> # works under Python 3 |
| 686 |
... etl.selectgt(table, 'bar', 0) |
| 687 |
+-----+-----+ |
| 688 |
| foo | bar | |
| 689 |
+=====+=====+ |
| 690 |
| 'a' | 1 | |
| 691 |
+-----+-----+ |
| 692 |
|
| 693 |
>>> # or ... |
| 694 |
... etl.select(table, 'bar', lambda v: v > etl.Comparable(0)) |
| 695 |
+-----+-----+ |
| 696 |
| foo | bar | |
| 697 |
+=====+=====+ |
| 698 |
| 'a' | 1 | |
| 699 |
+-----+-----+ |
| 700 |
|
| 701 |
New extract/load modules |
| 702 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 703 |
|
| 704 |
Several new extract/load modules have been added, migrating |
| 705 |
functionality previously available from the `petlx`_ package: |
| 706 |
|
| 707 |
* :ref:`io_xls` |
| 708 |
* :ref:`io_xlsx` |
| 709 |
* :ref:`io_numpy` |
| 710 |
* :ref:`io_pandas` |
| 711 |
* :ref:`io_pytables` |
| 712 |
* :ref:`io_whoosh` |
| 713 |
|
| 714 |
These modules all have dependencies on third party packages, but these |
| 715 |
have been kept as optional dependencies so are not required for |
| 716 |
installing :mod:`petl`. |
| 717 |
|
| 718 |
New validate function |
| 719 |
~~~~~~~~~~~~~~~~~~~~~ |
| 720 |
|
| 721 |
A new :func:`petl.transform.validation.validate` function has been |
| 722 |
added to provide a convenient interface when validating a table |
| 723 |
against a set of constraints. |
| 724 |
|
| 725 |
New intervals module |
| 726 |
~~~~~~~~~~~~~~~~~~~~ |
| 727 |
|
| 728 |
A new module has been added providing transformation functions based |
| 729 |
on intervals, migrating functionality previously available from the |
| 730 |
`petlx`_ package: |
| 731 |
|
| 732 |
* :ref:`transform_intervals` |
| 733 |
|
| 734 |
This module requires the `intervaltree |
| 735 |
<https://github.com/chaimleib/intervaltree>`_ module. |
| 736 |
|
| 737 |
New configuration module |
| 738 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 739 |
|
| 740 |
All configuration variables have been brought together into a new |
| 741 |
:mod:`petl.config` module. See the source code for the variables |
| 742 |
available, they should be self-explanatory. |
| 743 |
|
| 744 |
|
| 745 |
:mod:`petl.push` moved to :mod:`petlx` |
| 746 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 747 |
|
| 748 |
The :mod:`petl.push` module remains in an experimental state and has |
| 749 |
been moved to the `petlx`_ extensions project. |
| 750 |
|
| 751 |
Argument names and other minor changes |
| 752 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 753 |
|
| 754 |
Argument names for a small number of functions have been changed to |
| 755 |
create consistency across the API. |
| 756 |
|
| 757 |
There are some other minor changes as well. If you are migrating from |
| 758 |
:mod:`petl` version 0.x the best thing is to run your code and inspect |
| 759 |
any errors. Email [email protected] if you have any |
| 760 |
questions. |
| 761 |
|
| 762 |
Source code reorganisation |
| 763 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 764 |
|
| 765 |
The source code has been substantially reorganised. This should not |
| 766 |
affect users of the :mod:`petl` package however as all functions in |
| 767 |
the public API are available through the root :mod:`petl` namespace. |
| 768 |
|
| 769 |
.. _petlx: http://petlx.readthedocs.org |