Skip to content
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Changelog

## v3.2.2 (2023-10-18)
## v3.2.3 (2023-10-20)

### Updates

* implemented non `server_mode` magic extension
* `pandas` type updates
* updated class parameters
* added additional tests
* bin path defaults for codespaces notebooks

## v3.0.0 (2023-10-11)

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.2.2.tar.gz
twine upload dist/pystackql-3.2.3.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.2'
release = '3.2.3'


# -- General configuration ---------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions pystackql/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# This is for Python versions earlier than 3.8
from importlib_metadata import version, PackageNotFoundError

def _is_binary_local(platform):
"""Checks if the binary exists at the specified local path."""
if platform == 'Linux' and os.path.exists('/usr/local/bin/stackql'):
return True
return False

def _get_package_version(package_name):
try:
pkg_version = version(package_name)
Expand Down
31 changes: 20 additions & 11 deletions pystackql/stackql.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
_get_platform,
_get_download_dir,
_get_binary_name,
_is_binary_local,
_setup,
_get_version,
_format_auth
Expand Down Expand Up @@ -262,19 +263,27 @@ def __init__(self,

# get or download the stackql binary
binary = _get_binary_name(this_os)
# if download_dir not set, use site.getuserbase()
if download_dir is None:
self.download_dir = _get_download_dir()
else:
self.download_dir = download_dir
self.bin_path = os.path.join(self.download_dir, binary)
# get and set version
if os.path.exists(self.bin_path):

# check if the binary exists locally for Linux
if this_os == 'Linux' and _is_binary_local(this_os) and download_dir is None:
self.bin_path = '/usr/local/bin/stackql'
self.download_dir = '/usr/local/bin'
# get and set version
self.version, self.sha = _get_version(self.bin_path)
else:
# not installed, download
_setup(self.download_dir, this_os)
self.version, self.sha = _get_version(self.bin_path)
# if download_dir not set, use site.getuserbase() or the provided path
if download_dir is None:
self.download_dir = _get_download_dir()
else:
self.download_dir = download_dir
self.bin_path = os.path.join(self.download_dir, binary)
# get and set version
if os.path.exists(self.bin_path):
self.version, self.sha = _get_version(self.bin_path)
else:
# not installed, download
_setup(self.download_dir, this_os)
self.version, self.sha = _get_version(self.bin_path)

# if custom_auth is set, use it
if custom_auth is not None:
Expand Down
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.2',
version='3.2.3',
description='A Python interface for StackQL',
long_description=readme,
author='Jeffrey Aven',
Expand Down