From 7e5e3ccfc1d59aba63782c8cdf5fdbbefbec1cab Mon Sep 17 00:00:00 2001 From: Nicolas Kruchten Date: Sun, 7 May 2017 23:17:38 -0400 Subject: [PATCH] decouple url and outfile_path --- README.rst | 8 ++++---- pivottablejs/__init__.py | 4 ++-- setup.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 9412d8a..eac6d89 100644 --- a/README.rst +++ b/README.rst @@ -24,18 +24,18 @@ Usage Advanced Usage -------------- -Include any `valid option`_ to PivotTable.js's `pivotUI()` function as a keyword argument. +Include any `option to PivotTable.js's pivotUI() function`_ as a keyword argument. .. code:: python pivot_ui(df, rows=['row_name'], cols=['col_name']) -Independently control the output file path and the URL used to access it from Jupyter. +Independently control the output file path and the URL used to access it from Jupyter, in case the default relative-URL behaviour is incompatible with Jupyter's settings. .. code:: python - pivot_ui(df, outfile_path="x.html", url_prefix="http://localhost/path/") + pivot_ui(df, outfile_path="/x/y.html", url="http://localhost/a/b/x.html") .. _Jupyter/IPython Notebook: http://jupyter.org/ .. _PivotTable.js: https://github.com/nicolaskruchten/pivottable -.. _valid option: https://github.com/nicolaskruchten/pivottable/wiki/Parameters#options-object-for-pivotui +.. _valid option to PivotTable.js's pivotUI() function: https://github.com/nicolaskruchten/pivottable/wiki/Parameters#options-object-for-pivotui diff --git a/pivottablejs/__init__.py b/pivottablejs/__init__.py index 4d5f4b0..64c2b2f 100644 --- a/pivottablejs/__init__.py +++ b/pivottablejs/__init__.py @@ -68,10 +68,10 @@ from IPython.display import IFrame import json -def pivot_ui(df, outfile_path = "pivottablejs.html", url_prefix="", +def pivot_ui(df, outfile_path = "pivottablejs.html", url="", width="100%", height="500", **kwargs): with open(outfile_path, 'w') as outfile: outfile.write(TEMPLATE % dict(csv=df.to_csv(), kwargs=json.dumps(kwargs))) - return IFrame(src=url_prefix+outfile_path, width=width, height=height) + return IFrame(src=url or outfile_path, width=width, height=height) diff --git a/setup.py b/setup.py index 8b02c3d..1bc4acc 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='0.4.0', + version='0.5.0', description='PivotTable.js integration for Jupyter/IPython Notebook', long_description=long_description,