diff --git a/CHANGELOG.md b/CHANGELOG.md index 44e25c9..2f444a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ -# rc: minor bump +# rc: micro bump + +- Add the drop-in configuration files needed to automatically activate the + server extension upon package installation (#1, @pkgw). + + +# wwt_kernel_data_relay 0.1.0 (2021-10-14) Initial release of the WWT Kernel Data Relay package. diff --git a/MANIFEST.in b/MANIFEST.in index 1c85f17..5ac104e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,6 @@ +include CHANGELOG.md include LICENSE +include README.md include .coveragerc include *.md include *.yml @@ -6,6 +8,8 @@ include *.yml graft docs prune docs/_build +recursive-include jupyter-config *.json + graft wwt_kernel_data_relay/tests global-exclude *~ diff --git a/ci/azure-build-and-test.yml b/ci/azure-build-and-test.yml index 7e784b8..2396fbd 100644 --- a/ci/azure-build-and-test.yml +++ b/ci/azure-build-and-test.yml @@ -37,7 +37,7 @@ jobs: set -euo pipefail source activate-conda.sh set -x - \conda create -y -n build setuptools pip python="$PYTHON_SERIES" + \conda create -y -n build jupyter-packaging setuptools pip python="$PYTHON_SERIES" conda activate build pip install $BASH_WORKSPACE/sdist/*.tar.gz displayName: Install from sdist @@ -64,7 +64,7 @@ jobs: set -euo pipefail source activate-conda.sh set -x - \conda create -y -n build setuptools pip python=3.9 + \conda create -y -n build jupyter-packaging setuptools pip python=3.9 conda activate build pip install $BASH_WORKSPACE/sdist/*.tar.gz displayName: Install from sdist diff --git a/ci/azure-sdist.yml b/ci/azure-sdist.yml index 6ba95a6..f4e3d3c 100644 --- a/ci/azure-sdist.yml +++ b/ci/azure-sdist.yml @@ -53,6 +53,7 @@ jobs: conda config --add channels conda-forge conda install -y \ jupyter_client \ + jupyter-packaging \ notebook \ tornado \ traitlets diff --git a/jupyter-config/nb-config/wwt_kernel_data_relay.json b/jupyter-config/nb-config/wwt_kernel_data_relay.json new file mode 100644 index 0000000..5c58ec1 --- /dev/null +++ b/jupyter-config/nb-config/wwt_kernel_data_relay.json @@ -0,0 +1,7 @@ +{ + "NotebookApp": { + "nbserver_extensions": { + "wwt_kernel_data_relay": true + } + } +} \ No newline at end of file diff --git a/jupyter-config/server-config/wwt_kernel_data_relay.json b/jupyter-config/server-config/wwt_kernel_data_relay.json new file mode 100644 index 0000000..718cec4 --- /dev/null +++ b/jupyter-config/server-config/wwt_kernel_data_relay.json @@ -0,0 +1,7 @@ +{ + "ServerApp": { + "jpserver_extensions": { + "wwt_kernel_data_relay": true + } + } +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 527a2db..73960d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.1"] +build-backend = "jupyter_packaging.build_api" + [tool.cranko] extra_python_rewrite_files = [ "docs/conf.py" diff --git a/setup.py b/setup.py index 0c0195a..b18c763 100644 --- a/setup.py +++ b/setup.py @@ -2,83 +2,111 @@ # Copyright 2019-2021 the .NET Foundation # Licensed under the MIT License -import os -from setuptools import setup, Extension +import sys +from setuptools import setup + def get_long_desc(): in_preamble = True lines = [] - with open('README.md', 'rt', encoding='utf8') as f: + with open("README.md", "rt", encoding="utf8") as f: for line in f: if in_preamble: - if line.startswith(''): + if line.startswith(""): in_preamble = False else: - if line.startswith(''): + if line.startswith(""): break else: lines.append(line) - lines.append(''' + lines.append( + """ For more information, including installation instructions, please visit [the project homepage]. [the project homepage]: https://github.com/WorldWideTelescope/wwt_kernel_data_relay/ -''') - return ''.join(lines) +""" + ) + return "".join(lines) + + +data_files_spec = [ + ( + "etc/jupyter/jupyter_server_config.d", + "jupyter-config/server-config", + "wwt_kernel_data_relay.json", + ), + # For backward compatibility with notebook server: + ( + "etc/jupyter/jupyter_notebook_config.d", + "jupyter-config/nb-config", + "wwt_kernel_data_relay.json", + ), +] setup_args = dict( - name = 'wwt_kernel_data_relay', # cranko project-name - version = '0.dev0', # cranko project-version - description = 'Jupyter server extension to allow kernels to make data web-accessible', - long_description = get_long_desc(), - long_description_content_type = 'text/markdown', - url = 'https://github.com/WorldWideTelescope/wwt_kernel_data_relay/', - license = 'MIT', - platforms = 'Linux, Mac OS X, Windows', - - author = 'AAS WorldWide Telescope Team', - author_email = 'wwt@aas.org', - - classifiers = [ - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Topic :: Scientific/Engineering :: Astronomy', - 'Topic :: Scientific/Engineering :: Visualization', + name="wwt_kernel_data_relay", # cranko project-name + version="0.dev0", # cranko project-version + description="Jupyter server extension to allow kernels to make data web-accessible", + long_description=get_long_desc(), + long_description_content_type="text/markdown", + url="https://github.com/WorldWideTelescope/wwt_kernel_data_relay/", + license="MIT", + platforms="Linux, Mac OS X, Windows", + author="AAS WorldWide Telescope Team", + author_email="wwt@aas.org", + classifiers=[ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Scientific/Engineering :: Visualization", ], - - packages = [ - 'wwt_kernel_data_relay', + packages=[ + "wwt_kernel_data_relay", #'wwt_kernel_data_relay.tests', ], - include_package_data = True, - - install_requires = [ - 'jupyter-client>=7', - 'notebook>=6', - 'tornado>=6', - 'traitlets>=5', + include_package_data=True, + install_requires=[ + "jupyter-client>=7", + "notebook>=6", + "tornado>=6", + "traitlets>=5", ], - - extras_require = { - 'test': [ - 'pytest-cov', + extras_require={ + "test": [ + "pytest-cov", ], - 'docs': [ - 'astropy-sphinx-theme', - 'numpydoc', - 'sphinx', - 'sphinx-automodapi', + "docs": [ + "astropy-sphinx-theme", + "numpydoc", + "sphinx", + "sphinx-automodapi", ], }, ) -if __name__ == '__main__': +try: + from jupyter_packaging import get_data_files + + setup_args["data_files"] = get_data_files(data_files_spec) +except ImportError as e: + import logging + + logging.basicConfig(format="%(levelname)s: %(message)s") + logging.warning( + "Build tool `jupyter-packaging` is missing. Install it with pip or conda." + ) + if not ("--name" in sys.argv or "--version" in sys.argv): + raise e + + +if __name__ == "__main__": setup(**setup_args)