Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.2.1 #25

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v3.2.0 (2023-10-18)
## v3.2.1 (2023-10-18)

* implemented non `server_mode` magic extension

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/magic_ext.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
4 changes: 2 additions & 2 deletions pystackql/__init__.py
Original file line number Diff line number Diff line change
@@ -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
from .magic import StackqlMagic
from .magics import StackqlServerMagic
4 changes: 2 additions & 2 deletions pystackql/stackql_magic.py → pystackql/magic.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
5 changes: 2 additions & 3 deletions pystackql/stackql_server_magic.py → pystackql/magics.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions tests/pystackql_tests.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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]})
Expand Down