Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
jerowe committed Oct 26, 2022
1 parent 6bb0b12 commit 9e8ac36
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 33 deletions.
30 changes: 10 additions & 20 deletions jupyter_dcv_proxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,39 @@ def get_dcv_executable(prog):
if shutil.which(prog):
return prog

raise FileNotFoundError(f'Could not find {prog} in PATH')
raise FileNotFoundError(f"Could not find {prog} in PATH")


def get_icon_path():
return os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'icons', 'dcv.svg'
)
return os.path.join(os.path.dirname(os.path.abspath(__file__)), "icons", "dcv.svg")


def rewrite_auth(response, request):
'''
'''
""" """
return


def get_system_user():
try:
user = pwd.getpwuid(os.getuid())[0]
except:
user = os.environ.get('NB_USER', getpass.getuser())
user = os.environ.get("NB_USER", getpass.getuser())
return user


def setup_dcv():
def _get_env(port):
return dict(
PORT=port,
NB_USER=get_system_user(),
SESSION_ID=str(uuid.uuid4())
)
return dict(PORT=port, NB_USER=get_system_user(), SESSION_ID=str(uuid.uuid4()))

def _get_cmd(port):
dcv_exec = get_dcv_executable('dcv')
configurable_http_proxy_command = get_dcv_executable('configurable-http-proxy')
dcv_exec = get_dcv_executable("dcv")
configurable_http_proxy_command = get_dcv_executable("configurable-http-proxy")
this_dir = os.path.abspath(os.path.dirname(__file__))
command = f"""bash {this_dir}/run-dcv-user-session.sh"""
return command.split(" ")

return {
'command': _get_cmd,
'environment': _get_env,
'launcher_entry': {
'title': 'DCV',
'icon_path': get_icon_path()
}
"command": _get_cmd,
"environment": _get_env,
"launcher_entry": {"title": "DCV", "icon_path": get_icon_path()},
}
20 changes: 7 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@

setuptools.setup(
name="jupyter-dcv-proxy",
version='2.0.2',
version="2.0.2",
url="https://github.com/dabble-of-devops-bioanalyze/jupyter-dcv-proxy",
author="Jillian Rowe",
description="Jupyter extension to proxy DCV",
packages=setuptools.find_packages(),
keywords=['Jupyter'],
classifiers=['Framework :: Jupyter'],
scripts=['jupyter_dcv_proxy/run-dcv-user-session.sh'],
install_requires=[
'jupyter-server-proxy>=3.2.0'
],
entry_points={
'jupyter_serverproxy_servers': [
'dcv = jupyter_dcv_proxy:setup_dcv'
]
},
keywords=["Jupyter"],
classifiers=["Framework :: Jupyter"],
scripts=["jupyter_dcv_proxy/run-dcv-user-session.sh"],
install_requires=["jupyter-server-proxy>=3.2.0"],
entry_points={"jupyter_serverproxy_servers": ["dcv = jupyter_dcv_proxy:setup_dcv"]},
package_data={
'jupyter_dcv_proxy': ['icons/dcv.svg'],
"jupyter_dcv_proxy": ["icons/dcv.svg"],
},
)

0 comments on commit 9e8ac36

Please sign in to comment.