Skip to content

Commit

Permalink
added version file; a few tweaks prior to 1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
craigbarratt committed Nov 5, 2020
1 parent d0ad316 commit fde6ffa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ To install the pyscript Jupyter kernel:
pip install hass_pyscript_kernel
jupyter pyscript install
```
Running `jupyter pyscript install` is only required on new installs, or if your old
version of `hass_pyscript_kernel` is prior to 1.0.0.

On a new install, you'll need to edit the `pyscript.conf` file. The install command above
will print its path. Replace these settings:
Expand Down
2 changes: 2 additions & 0 deletions hass_pyscript_kernel/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from jupyter_core.paths import SYSTEM_JUPYTER_PATH

from .shim import CONFIG_SETTINGS, PKG_NAME, load_config
from .version import __version__

SCRIPT_NAME = "jupyter-pyscript"

Expand Down Expand Up @@ -86,6 +87,7 @@ def install_main():

elif args.action == "info":
kernels = KernelSpecManager().find_kernel_specs()
print(f"{PKG_NAME} version {__version__} installed")
if args.kernel_name not in kernels:
print(f"No installed kernel named {args.kernel_name} found")
else:
Expand Down
2 changes: 1 addition & 1 deletion hass_pyscript_kernel/shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ async def do_request(

def remove_quotes(string):
"""Strip leading/trailing quotes from string, which VSCode strangely adds to arguments."""
if string[0] == string[-1] and string[0] in ('"', "'"):
if len(string) > 0 and string[0] == string[-1] and string[0] in ('"', "'"):
return string[1:-1]
if len(string) > 1 and string[0] == "b" and string[1] == string[-1] and string[1] in ('"', "'"):
return string[2:-1]
Expand Down
3 changes: 3 additions & 0 deletions hass_pyscript_kernel/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Version for this package."""

__version__ = "1.0.0"
38 changes: 24 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,32 @@
with open("README.md", "r") as fh:
long_description = fh.read()

def get_version(path):
with open(path, "r") as fh:
for line in fh.readlines():
if line.startswith("__version__"):
return line.split('"' if '"' in line else "'")[1]
else:
raise RuntimeError(f"Unable to find version string in {path}")

version = get_version("hass_pyscript_kernel/version.py")

setup(
name='hass_pyscript_kernel',
version='0.30',
author='Craig Barratt',
author_email='@alumni.stanford.edu',
description='Home Assistant Pyscript Jupyter kernel shim',
url='https://github.com/craigbarratt/hass-pyscript-jupyter',
download_url='https://github.com/craigbarratt/hass-pyscript-jupyter/archive/0.30.tar.gz',
packages=['hass_pyscript_kernel'],
name="hass_pyscript_kernel",
version=version,
author="Craig Barratt",
author_email="[email protected]",
description="Home Assistant Pyscript Jupyter kernel shim",
url="https://github.com/craigbarratt/hass-pyscript-jupyter",
download_url=f"https://github.com/craigbarratt/hass-pyscript-jupyter/archive/{version}.tar.gz",
packages=["hass_pyscript_kernel"],
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=[
'aiohttp',
'aiohttp_socks',
'jupyter-client',
'jupyter-core',
"aiohttp",
"aiohttp_socks",
"jupyter-client",
"jupyter-core",
],
python_requires=">=3.7",
zip_safe=False,
Expand All @@ -33,8 +43,8 @@
],
},
entry_points={
'console_scripts': [
'jupyter-pyscript=hass_pyscript_kernel:install_main',
"console_scripts": [
"jupyter-pyscript=hass_pyscript_kernel:install_main",
],
},
)

0 comments on commit fde6ffa

Please sign in to comment.