Skip to content

Commit cb30bd3

Browse files
committed
bin defaults for codespaces
1 parent bef7396 commit cb30bd3

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Changelog
22

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

55
### Updates
66

77
* implemented non `server_mode` magic extension
88
* `pandas` type updates
99
* updated class parameters
1010
* added additional tests
11+
* bin path defaults for codespaces notebooks
1112

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

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,4 @@ To publish the package to PyPI, run the following command:
193193

194194
::
195195

196-
twine upload dist/pystackql-3.2.2.tar.gz
196+
twine upload dist/pystackql-3.2.3.tar.gz

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = ''
2828
# The full version, including alpha/beta/rc tags
29-
release = '3.2.2'
29+
release = '3.2.3'
3030

3131

3232
# -- General configuration ---------------------------------------------------

pystackql/_util.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
# This is for Python versions earlier than 3.8
88
from importlib_metadata import version, PackageNotFoundError
99

10+
def _is_binary_local(platform):
11+
"""Checks if the binary exists at the specified local path."""
12+
if platform == 'Linux' and os.path.exists('/usr/local/bin/stackql'):
13+
return True
14+
return False
15+
1016
def _get_package_version(package_name):
1117
try:
1218
pkg_version = version(package_name)

pystackql/stackql.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
_get_platform,
44
_get_download_dir,
55
_get_binary_name,
6+
_is_binary_local,
67
_setup,
78
_get_version,
89
_format_auth
@@ -262,19 +263,27 @@ def __init__(self,
262263

263264
# get or download the stackql binary
264265
binary = _get_binary_name(this_os)
265-
# if download_dir not set, use site.getuserbase()
266-
if download_dir is None:
267-
self.download_dir = _get_download_dir()
268-
else:
269-
self.download_dir = download_dir
270-
self.bin_path = os.path.join(self.download_dir, binary)
271-
# get and set version
272-
if os.path.exists(self.bin_path):
266+
267+
# check if the binary exists locally for Linux
268+
if this_os == 'Linux' and _is_binary_local(this_os) and download_dir is None:
269+
self.bin_path = '/usr/local/bin/stackql'
270+
self.download_dir = '/usr/local/bin'
271+
# get and set version
273272
self.version, self.sha = _get_version(self.bin_path)
274273
else:
275-
# not installed, download
276-
_setup(self.download_dir, this_os)
277-
self.version, self.sha = _get_version(self.bin_path)
274+
# if download_dir not set, use site.getuserbase() or the provided path
275+
if download_dir is None:
276+
self.download_dir = _get_download_dir()
277+
else:
278+
self.download_dir = download_dir
279+
self.bin_path = os.path.join(self.download_dir, binary)
280+
# get and set version
281+
if os.path.exists(self.bin_path):
282+
self.version, self.sha = _get_version(self.bin_path)
283+
else:
284+
# not installed, download
285+
_setup(self.download_dir, this_os)
286+
self.version, self.sha = _get_version(self.bin_path)
278287

279288
# if custom_auth is set, use it
280289
if custom_auth is not None:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name='pystackql',
13-
version='3.2.2',
13+
version='3.2.3',
1414
description='A Python interface for StackQL',
1515
long_description=readme,
1616
author='Jeffrey Aven',

0 commit comments

Comments
 (0)