Skip to content

Commit

Permalink
Suggest quotes when pip installing with optional dependencies (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Aug 12, 2020
1 parent bc8438b commit 5fa4496
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions docs/formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For example::
dataset.export("cli", tablefmt="github")
dataset.export("cli", tablefmt="grid")

This format is optional, install Tablib with ``pip install tablib[cli]`` to
This format is optional, install Tablib with ``pip install "tablib[cli]"`` to
make the format available.

csv
Expand Down Expand Up @@ -83,7 +83,7 @@ df (DataFrame)
==============

Import/export using the pandas_ DataFrame format. This format is optional,
install Tablib with ``pip install tablib[pandas]`` to make the format available.
install Tablib with ``pip install "tablib[pandas]"`` to make the format available.

.. _pandas: https://pandas.pydata.org/

Expand All @@ -94,7 +94,7 @@ The ``html`` format is currently export-only. The exports produce an HTML page
with the data in a ``<table>``. If headers have been set, they will be used as
table headers.

This format is optional, install Tablib with ``pip install tablib[html]`` to
This format is optional, install Tablib with ``pip install "tablib[html]"`` to
make the format available.

jira
Expand Down Expand Up @@ -132,7 +132,7 @@ ods
Export data in OpenDocument Spreadsheet format. The ``ods`` format is currently
export-only.

This format is optional, install Tablib with ``pip install tablib[ods]`` to
This format is optional, install Tablib with ``pip install "tablib[ods]"`` to
make the format available.

.. admonition:: Binary Warning
Expand Down Expand Up @@ -183,7 +183,7 @@ xls

Import/export data in Legacy Excel Spreadsheet representation.

This format is optional, install Tablib with ``pip install tablib[xls]`` to
This format is optional, install Tablib with ``pip install "tablib[xls]"`` to
make the format available.

.. note::
Expand All @@ -203,7 +203,7 @@ xlsx

Import/export data in Excel 07+ Spreadsheet representation.

This format is optional, install Tablib with ``pip install tablib[xlsx]`` to
This format is optional, install Tablib with ``pip install "tablib[xlsx]"`` to
make the format available.

.. note::
Expand Down Expand Up @@ -232,7 +232,7 @@ returned instead.

Import assumes (for now) that headers exist.

This format is optional, install Tablib with ``pip install tablib[yaml]`` to
This format is optional, install Tablib with ``pip install "tablib[yaml]"`` to
make the format available.

.. _YAML: https://yaml.org
6 changes: 3 additions & 3 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ formats available:

.. code-block:: console
$ pip install tablib[xlsx]
$ pip install "tablib[xlsx]"
Or all possible formats:

.. code-block:: console
$ pip install tablib[all]
$ pip install "tablib[all]"
which is equivalent to:

.. code-block:: console
$ pip install tablib[html, pandas, ods, xls, xlsx, yaml]
$ pip install "tablib[html, pandas, ods, xls, xlsx, yaml]"
-------------------
Download the Source
Expand Down
2 changes: 1 addition & 1 deletion src/tablib/formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def get_format(self, key):
if key in uninstalled_format_messages:
raise UnsupportedFormat(
"The '{key}' format is not available. You may want to install the "
"{package_name} (or `pip install tablib[{extras_name}]`).".format(
"{package_name} (or `pip install \"tablib[{extras_name}]\"`).".format(
**uninstalled_format_messages[key], key=key
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/tablib/formats/_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def export_set(cls, dset, index=None):
if DataFrame is None:
raise NotImplementedError(
'DataFrame Format requires `pandas` to be installed.'
' Try `pip install tablib[pandas]`.')
' Try `pip install "tablib[pandas]"`.')
dataframe = DataFrame(dset.dict, columns=dset.headers)
return dataframe

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tablib.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_unknown_format(self):
# A known format but uninstalled
del registry._formats['ods']
msg = (r"The 'ods' format is not available. You may want to install the "
"odfpy package \\(or `pip install tablib\\[ods\\]`\\).")
"odfpy package \\(or `pip install \"tablib\\[ods\\]\"`\\).")
with self.assertRaisesRegex(UnsupportedFormat, msg):
data.export('ods')

Expand Down

0 comments on commit 5fa4496

Please sign in to comment.