backports.csv


Namebackports.csv JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/ryanhiebert/backports.csv
SummaryBackport of Python 3 csv module
upload_time2019-03-11 03:05:33
maintainer
docs_urlNone
authorRyan Hiebert
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ================================================
backports.csv: Backport of Python 3's csv module
================================================

.. image:: https://img.shields.io/pypi/v/backports.csv.svg
   :target: https://pypi.python.org/pypi/backports.csv
   :alt: Latest Version

.. image:: https://travis-ci.org/ryanhiebert/backports.csv.svg?branch=master
   :target: https://travis-ci.org/ryanhiebert/backports.csv

.. image:: https://badges.gitter.im/ryanhiebert/backports.csv.svg
   :alt: Join the chat at https://gitter.im/ryanhiebert/backports.csv
   :target: https://gitter.im/ryanhiebert/backports.csv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

.. image:: https://requires.io/github/ryanhiebert/backports.csv/requirements.svg?branch=master
   :target: https://requires.io/github/ryanhiebert/backports.csv/requirements/?branch=master
   :alt: Requirements Status

The API of the csv module in Python 2 is drastically different from
the csv module in Python 3. This is due, for the most part, to the
difference between str in Python 2 and Python 3.

The semantics of Python 3's version are more useful because they support
unicode natively, while Python 2's csv does not.

Installation
============

.. code-block:: sh

    pip install backports.csv

Usage
=====

First make sure you're starting your file off right:

.. code-block:: python

    from backports import csv


Then be careful with your files to handle the encoding.
If you're working with a binary file-like object,
``io.TextIOWrapper`` can be very helpful.
If you're dealing with a file, you can just use ``io.open``
instead of Python 2's ``open`` builtin, and it works
just like Python 3's builtin ``open``.

.. code-block:: python

    from backports import csv
    import io

    def read_csv(filename):
        with io.open(filename, newline='', encoding='utf-8') as f:
            for row in csv.reader(f):
                yield row

    def write_csv(filename, rows):
        with io.open(filename, 'w', newline='', encoding='utf-8') as f:
            writer = csv.writer(f)
            for row in rows:
                writer.writerow(row)

Note: It should always be safe to specify ``newline=''``,
since the csv module does its own (universal) newline handling.


1.0.7 (2019-03-10)
++++++++++++++++++

* Add tests to ``MANIFEST.in``.
  - thanks to @jayvdb for the pull request

1.0.6 (2018-05-22)
++++++++++++++++++

* Pass reader error messages along. (#28)
  This should help make errors more transparent.
  - thanks to @mpeteuil for the pull request

1.0.5 (2017-05-29)
++++++++++++++++++

* Fix bug in README example. (#22)
  - thanks to @tantale for the bug report
* Allow ``None`` as quotechar when using ``QUOTE_NONE``. (#23)
  - thanks to @thanatos for the bug report

1.0.4 (2017-02-17)
++++++++++++++++++

* Return write value from writerow. (#20)
  - thanks to @therg

1.0.3 (2017-01-23)
++++++++++++++++++

* Add LICENSE file (#18).

1.0.2 (2016-09-15)
++++++++++++++++++

* Avoid quoting any numeric types when using ``QUOTE_NONNUMERIC``.
  - thanks to @torfsen for the bug report

1.0.1 (2016-02-11)
++++++++++++++++++

* Better error messages for invalid dialects.
  - thanks to @kengruven for the bug report


1.0 (2016-02-11)
++++++++++++++++

* Initial Release



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ryanhiebert/backports.csv",
    "name": "backports.csv",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ryan Hiebert",
    "author_email": "ryan@ryanhiebert.com",
    "download_url": "https://files.pythonhosted.org/packages/79/0c/d0eaa9380189a292121acab65199ac95b9209b45006ad8aa5266abd36943/backports.csv-1.0.7.tar.gz",
    "platform": "",
    "description": "================================================\nbackports.csv: Backport of Python 3's csv module\n================================================\n\n.. image:: https://img.shields.io/pypi/v/backports.csv.svg\n   :target: https://pypi.python.org/pypi/backports.csv\n   :alt: Latest Version\n\n.. image:: https://travis-ci.org/ryanhiebert/backports.csv.svg?branch=master\n   :target: https://travis-ci.org/ryanhiebert/backports.csv\n\n.. image:: https://badges.gitter.im/ryanhiebert/backports.csv.svg\n   :alt: Join the chat at https://gitter.im/ryanhiebert/backports.csv\n   :target: https://gitter.im/ryanhiebert/backports.csv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\n.. image:: https://requires.io/github/ryanhiebert/backports.csv/requirements.svg?branch=master\n   :target: https://requires.io/github/ryanhiebert/backports.csv/requirements/?branch=master\n   :alt: Requirements Status\n\nThe API of the csv module in Python 2 is drastically different from\nthe csv module in Python 3. This is due, for the most part, to the\ndifference between str in Python 2 and Python 3.\n\nThe semantics of Python 3's version are more useful because they support\nunicode natively, while Python 2's csv does not.\n\nInstallation\n============\n\n.. code-block:: sh\n\n    pip install backports.csv\n\nUsage\n=====\n\nFirst make sure you're starting your file off right:\n\n.. code-block:: python\n\n    from backports import csv\n\n\nThen be careful with your files to handle the encoding.\nIf you're working with a binary file-like object,\n``io.TextIOWrapper`` can be very helpful.\nIf you're dealing with a file, you can just use ``io.open``\ninstead of Python 2's ``open`` builtin, and it works\njust like Python 3's builtin ``open``.\n\n.. code-block:: python\n\n    from backports import csv\n    import io\n\n    def read_csv(filename):\n        with io.open(filename, newline='', encoding='utf-8') as f:\n            for row in csv.reader(f):\n                yield row\n\n    def write_csv(filename, rows):\n        with io.open(filename, 'w', newline='', encoding='utf-8') as f:\n            writer = csv.writer(f)\n            for row in rows:\n                writer.writerow(row)\n\nNote: It should always be safe to specify ``newline=''``,\nsince the csv module does its own (universal) newline handling.\n\n\n1.0.7 (2019-03-10)\n++++++++++++++++++\n\n* Add tests to ``MANIFEST.in``.\n  - thanks to @jayvdb for the pull request\n\n1.0.6 (2018-05-22)\n++++++++++++++++++\n\n* Pass reader error messages along. (#28)\n  This should help make errors more transparent.\n  - thanks to @mpeteuil for the pull request\n\n1.0.5 (2017-05-29)\n++++++++++++++++++\n\n* Fix bug in README example. (#22)\n  - thanks to @tantale for the bug report\n* Allow ``None`` as quotechar when using ``QUOTE_NONE``. (#23)\n  - thanks to @thanatos for the bug report\n\n1.0.4 (2017-02-17)\n++++++++++++++++++\n\n* Return write value from writerow. (#20)\n  - thanks to @therg\n\n1.0.3 (2017-01-23)\n++++++++++++++++++\n\n* Add LICENSE file (#18).\n\n1.0.2 (2016-09-15)\n++++++++++++++++++\n\n* Avoid quoting any numeric types when using ``QUOTE_NONNUMERIC``.\n  - thanks to @torfsen for the bug report\n\n1.0.1 (2016-02-11)\n++++++++++++++++++\n\n* Better error messages for invalid dialects.\n  - thanks to @kengruven for the bug report\n\n\n1.0 (2016-02-11)\n++++++++++++++++\n\n* Initial Release\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Backport of Python 3 csv module",
    "version": "1.0.7",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e26a6bd68f13e0f38fbb643d6e497fc3462be83a0b6c4d43425c78bb51a7291",
                "md5": "10fcdac4ee129397d1de32ac232c86b1",
                "sha256": "21f6e09bab589e6c1f877edbc40277b65e626262a86e69a70137db714eaac5ce"
            },
            "downloads": -1,
            "filename": "backports.csv-1.0.7-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "10fcdac4ee129397d1de32ac232c86b1",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 12876,
            "upload_time": "2019-03-11T03:05:31",
            "upload_time_iso_8601": "2019-03-11T03:05:31.956326Z",
            "url": "https://files.pythonhosted.org/packages/8e/26/a6bd68f13e0f38fbb643d6e497fc3462be83a0b6c4d43425c78bb51a7291/backports.csv-1.0.7-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "790cd0eaa9380189a292121acab65199ac95b9209b45006ad8aa5266abd36943",
                "md5": "24f301f860635d9bcb6e4b54736e0c99",
                "sha256": "1277dfff73130b2e106bf3dd347adb3c5f6c4340882289d88f31240da92cbd6d"
            },
            "downloads": -1,
            "filename": "backports.csv-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "24f301f860635d9bcb6e4b54736e0c99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 20836,
            "upload_time": "2019-03-11T03:05:33",
            "upload_time_iso_8601": "2019-03-11T03:05:33.248718Z",
            "url": "https://files.pythonhosted.org/packages/79/0c/d0eaa9380189a292121acab65199ac95b9209b45006ad8aa5266abd36943/backports.csv-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-03-11 03:05:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "ryanhiebert",
    "github_project": "backports.csv",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "backports.csv"
}
        
Elapsed time: 0.05617s