Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #3283 > unrolled thread

[ANN] get-reader 1.0.0 stable release

Started byShawn Brown <03sjbrown@gmail.com>
First post2019-12-28 20:57 -0500
Last post2019-12-28 20:57 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python.announce


Contents

  [ANN] get-reader 1.0.0 stable release Shawn Brown <03sjbrown@gmail.com> - 2019-12-28 20:57 -0500

#3283 — [ANN] get-reader 1.0.0 stable release

FromShawn Brown <03sjbrown@gmail.com>
Date2019-12-28 20:57 -0500
Subject[ANN] get-reader 1.0.0 stable release
Message-ID<157758799587.8676.python-announce-list@python.org>
Happy Holidays!

The first stable release of get-reader, version 1.0.0 is
now available.

* https://pypi.org/project/get-reader/
* https://github.com/shawnbrown/get_reader


This module provides a `get_reader()` function that returns
reader objects similar to those returned by `csv.reader()`.
This package:

* reduces common boilerplate code for handling files and
  reading records
* reads data from CSV, pandas, SQL connections, MS Excel,
  DBF, and squint
* provides a single interface across Python versions (including
  seamless Unicode-aware CSV support for Python 2)
* is easy to incorporate into your own projects:
  * has no hard dependencies
  * runs on Python 2.6, 2.7, 3.2 through 3.8, PyPy, PyPy3,
    and Jython
  * is freely available under the Apache License, version 2
  * can be easily vendored directly into your codebase if you
    don't want to include it as a dependency


Some examples:

  >>> from get_reader import get_reader
  >>>
  >>> # CSV file.
  >>> reader = get_reader('myfile.csv')
  >>>
  >>> # Database connection.
  >>> connection = ...
  >>> reader = get_reader(connection, 'SELECT col1, col2 FROM mytable;')
  >>>
  >>> # Pandas DataFrame.
  >>> df = pd.DataFrame([...])
  >>> reader = get_reader(df)
  >>>
  >>> # Excel file.
  >>> reader = get_reader('myfile.xlsx', worksheet='Sheet2')

The internal file object is automatically closed when the
iterator is exhausted, when the object is deleted, or when
it is explicitly closed.


An example using a context manager:

  >>> with get_reader('myfile.csv') as reader:
  >>>     for row in reader:
  >>>         print(', '.join(row))

The internal file object is also closed when exiting a with
block even if the for-loop doesn't finish exhausting the
reader.


Install:

  The get-reader module has no hard dependencies; is tested on
  Python 2.6, 2.7, 3.2 through 3.8, PyPy, PyPy3, and Jython;
  and is freely available under the Apache License, version 2.

  You can install get_reader using pip:

    pip install get-reader

  To install optional support for MS Excel and DBF files (dBase,
  Foxpro, etc.), use the following:

    pip install get-reader[excel,dbf]


Python 2 Support Statement:

  While official support for Python 2 ends on January 1, 2020,
  this project will continue to support older versions as long
  as the existing ecosystem provides the ability to run automated
  tests on those older versions.

[toc] | [standalone]


Back to top | Article view | comp.lang.python.announce


csiph-web