diff --git a/CHANGELOG.md b/CHANGELOG.md index 2574a64..1d709a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## v3.2.0 (2023-10-18) +## v3.2.1 (2023-10-18) * implemented non `server_mode` magic extension diff --git a/README.rst b/README.rst index 72d1fb1..7ca36e7 100644 --- a/README.rst +++ b/README.rst @@ -193,4 +193,4 @@ To publish the package to PyPI, run the following command: :: - twine upload dist/pystackql-3.1.2.tar.gz + twine upload dist/pystackql-3.2.1.tar.gz diff --git a/docs/source/conf.py b/docs/source/conf.py index 084d47c..3c27b40 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,7 +26,7 @@ # The short X.Y version version = '' # The full version, including alpha/beta/rc tags -release = '3.2.0' +release = '3.2.1' # -- General configuration --------------------------------------------------- diff --git a/docs/source/magic_ext.rst b/docs/source/magic_ext.rst index 695ba91..5eeed67 100644 --- a/docs/source/magic_ext.rst +++ b/docs/source/magic_ext.rst @@ -10,13 +10,13 @@ To enable the `StackqlMagic` extension in your Jupyter notebook, use the followi .. code-block:: python - %load_ext stackql_magic + %load_ext pystackql.magic To use the `StackqlMagic` extension in your Jupyter notebook to run queries against a StackQL server, use the following command: .. code-block:: python - %load_ext stackql_server_magic + %load_ext pystackql.magics Usage ----- diff --git a/pystackql/__init__.py b/pystackql/__init__.py index b34d155..87af198 100644 --- a/pystackql/__init__.py +++ b/pystackql/__init__.py @@ -1,3 +1,3 @@ from .stackql import StackQL -from .stackql_magic import StackqlMagic, load_non_server_magic -from .stackql_server_magic import StackqlServerMagic, load_server_magic \ No newline at end of file +from .magic import StackqlMagic +from .magics import StackqlServerMagic \ No newline at end of file diff --git a/pystackql/stackql_magic.py b/pystackql/magic.py similarity index 71% rename from pystackql/stackql_magic.py rename to pystackql/magic.py index 245a17f..db4fd72 100644 --- a/pystackql/stackql_magic.py +++ b/pystackql/magic.py @@ -1,4 +1,4 @@ -# stackql_magic.py +# `%load_ext pystackql.magic` - loads the stackql magic with server_mode=False from IPython.core.magic import magics_class from .base_stackql_magic import BaseStackqlMagic @@ -7,6 +7,6 @@ class StackqlMagic(BaseStackqlMagic): def __init__(self, shell): super().__init__(shell, server_mode=False) -def load_non_server_magic(ipython): +def load_ipython_extension(ipython): """Load the non-server magic in IPython.""" ipython.register_magics(StackqlMagic) diff --git a/pystackql/stackql_server_magic.py b/pystackql/magics.py similarity index 71% rename from pystackql/stackql_server_magic.py rename to pystackql/magics.py index c6bb7f5..bfd48e0 100644 --- a/pystackql/stackql_server_magic.py +++ b/pystackql/magics.py @@ -1,13 +1,12 @@ -# stackql_server_magic.py +# `%load_ext pystackql.magics` - loads the stackql magic with server_mode=True from IPython.core.magic import magics_class from .base_stackql_magic import BaseStackqlMagic @magics_class class StackqlServerMagic(BaseStackqlMagic): - def __init__(self, shell): super().__init__(shell, server_mode=True) -def load_server_magic(ipython): +def load_ipython_extension(ipython): """Load the extension in IPython.""" ipython.register_magics(StackqlServerMagic) \ No newline at end of file diff --git a/setup.py b/setup.py index 6254b52..884f78b 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='pystackql', - version='3.2.0', + version='3.2.1', description='A Python interface for StackQL', long_description=readme, author='Jeffrey Aven', diff --git a/tests/pystackql_tests.py b/tests/pystackql_tests.py index b1c4d6c..188fe29 100644 --- a/tests/pystackql_tests.py +++ b/tests/pystackql_tests.py @@ -1,7 +1,7 @@ import sys, os, unittest, asyncio from unittest.mock import MagicMock sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -from pystackql import StackQL, load_non_server_magic, load_server_magic, StackqlMagic, StackqlServerMagic +from pystackql import StackQL, magic, magics, StackqlMagic, StackqlServerMagic from .test_params import * def pystackql_test_setup(**kwargs): @@ -282,9 +282,9 @@ def setUp(self): assert self.MAGIC_CLASS, "MAGIC_CLASS should be set by child classes" self.shell = MockInteractiveShell.instance() if self.server_mode: - load_server_magic(self.shell) + magics.load_ipython_extension(self.shell) else: - load_non_server_magic(self.shell) + magic.load_ipython_extension(self.shell) self.stackql_magic = self.MAGIC_CLASS(shell=self.shell) self.query = "SELECT 1 as fred" self.expected_result = pd.DataFrame({"fred": [1]})