Skip to content

Commit fde6ffa

Browse files
committed
added version file; a few tweaks prior to 1.0.0 release
1 parent d0ad316 commit fde6ffa

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ To install the pyscript Jupyter kernel:
1717
pip install hass_pyscript_kernel
1818
jupyter pyscript install
1919
```
20+
Running `jupyter pyscript install` is only required on new installs, or if your old
21+
version of `hass_pyscript_kernel` is prior to 1.0.0.
2022

2123
On a new install, you'll need to edit the `pyscript.conf` file. The install command above
2224
will print its path. Replace these settings:

hass_pyscript_kernel/install.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from jupyter_core.paths import SYSTEM_JUPYTER_PATH
1010

1111
from .shim import CONFIG_SETTINGS, PKG_NAME, load_config
12+
from .version import __version__
1213

1314
SCRIPT_NAME = "jupyter-pyscript"
1415

@@ -86,6 +87,7 @@ def install_main():
8687

8788
elif args.action == "info":
8889
kernels = KernelSpecManager().find_kernel_specs()
90+
print(f"{PKG_NAME} version {__version__} installed")
8991
if args.kernel_name not in kernels:
9092
print(f"No installed kernel named {args.kernel_name} found")
9193
else:

hass_pyscript_kernel/shim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ async def do_request(
348348

349349
def remove_quotes(string):
350350
"""Strip leading/trailing quotes from string, which VSCode strangely adds to arguments."""
351-
if string[0] == string[-1] and string[0] in ('"', "'"):
351+
if len(string) > 0 and string[0] == string[-1] and string[0] in ('"', "'"):
352352
return string[1:-1]
353353
if len(string) > 1 and string[0] == "b" and string[1] == string[-1] and string[1] in ('"', "'"):
354354
return string[2:-1]

hass_pyscript_kernel/version.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Version for this package."""
2+
3+
__version__ = "1.0.0"

setup.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,32 @@
55
with open("README.md", "r") as fh:
66
long_description = fh.read()
77

8+
def get_version(path):
9+
with open(path, "r") as fh:
10+
for line in fh.readlines():
11+
if line.startswith("__version__"):
12+
return line.split('"' if '"' in line else "'")[1]
13+
else:
14+
raise RuntimeError(f"Unable to find version string in {path}")
15+
16+
version = get_version("hass_pyscript_kernel/version.py")
17+
818
setup(
9-
name='hass_pyscript_kernel',
10-
version='0.30',
11-
author='Craig Barratt',
12-
author_email='@alumni.stanford.edu',
13-
description='Home Assistant Pyscript Jupyter kernel shim',
14-
url='https://github.com/craigbarratt/hass-pyscript-jupyter',
15-
download_url='https://github.com/craigbarratt/hass-pyscript-jupyter/archive/0.30.tar.gz',
16-
packages=['hass_pyscript_kernel'],
19+
name="hass_pyscript_kernel",
20+
version=version,
21+
author="Craig Barratt",
22+
author_email="[email protected]",
23+
description="Home Assistant Pyscript Jupyter kernel shim",
24+
url="https://github.com/craigbarratt/hass-pyscript-jupyter",
25+
download_url=f"https://github.com/craigbarratt/hass-pyscript-jupyter/archive/{version}.tar.gz",
26+
packages=["hass_pyscript_kernel"],
1727
long_description=long_description,
1828
long_description_content_type="text/markdown",
1929
install_requires=[
20-
'aiohttp',
21-
'aiohttp_socks',
22-
'jupyter-client',
23-
'jupyter-core',
30+
"aiohttp",
31+
"aiohttp_socks",
32+
"jupyter-client",
33+
"jupyter-core",
2434
],
2535
python_requires=">=3.7",
2636
zip_safe=False,
@@ -33,8 +43,8 @@
3343
],
3444
},
3545
entry_points={
36-
'console_scripts': [
37-
'jupyter-pyscript=hass_pyscript_kernel:install_main',
46+
"console_scripts": [
47+
"jupyter-pyscript=hass_pyscript_kernel:install_main",
3848
],
3949
},
4050
)

0 commit comments

Comments
 (0)