Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix setup.py (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway authored Sep 7, 2020
1 parent 773d9e9 commit ba10d0d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion imjoy/VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.10.8",
"version": "0.10.9",
"api_version": "0.2.0"
}
20 changes: 16 additions & 4 deletions imjoy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
import subprocess
import sys
import asyncio
import yaml
from aiohttp import web
import logging
import urllib.request
from imjoy_rpc import default_config

from imjoy.socketio_server import create_socketio_server

from imjoy.options import parse_cmd_line
from imjoy.utils import read_or_generate_token, write_token

Expand All @@ -23,6 +20,13 @@

def load_plugin(plugin_file):
"""load plugin file"""
try:
import yaml
except:
logger.error(
"It appears that your ImJoy installation is not complete, please reinstall it with 'pip install imjoy[socketio]'"
)
raise SystemExit
if os.path.isfile(plugin_file):
content = open(plugin_file).read()
elif plugin_file.startswith("http"):
Expand Down Expand Up @@ -87,14 +91,22 @@ async def start_plugin(app):
background_task = start_plugin

if opt.serve:
try:
from imjoy.socketio_server import create_socketio_server
except:
logger.error(
"It appears that your ImJoy installation is not complete, please reinstall it with 'pip install imjoy[socketio]'"
)
raise SystemExit
if opt.plugin_server and not opt.plugin_server.endswith(opt.serve):
print(
"WARNING: the specified port ({}) does not match the one in the url ({})".format(
opt.serve, opt.plugin_server
)
)
app = create_socketio_server()
app.on_startup.append(background_task)
if background_task:
app.on_startup.append(background_task)
web.run_app(app, port=opt.serve)
elif opt.plugin_file:
loop = asyncio.get_event_loop()
Expand Down
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"imjoy-jupyter-extension",
]


ROOT_DIR = os.path.dirname(__file__)
with open(os.path.join(ROOT_DIR, "README.md"), "r") as f:
README = f.read()
Expand All @@ -49,7 +48,14 @@
packages=find_packages(),
include_package_data=True,
install_requires=REQUIREMENTS,
extras_require={},
extras_require={
"socketio": [
"python-socketio[asyncio_client]",
"pyyaml",
"aiohttp",
"aiohttp_cors",
]
},
zip_safe=False,
entry_points={"console_scripts": ["imjoy = imjoy.__main__:main"]},
)

0 comments on commit ba10d0d

Please sign in to comment.