Skip to content

Commit

Permalink
Renamed project to stsci-announce
Browse files Browse the repository at this point in the history
  • Loading branch information
jaytmiller committed Mar 27, 2024
1 parent 07fcb3f commit 2bcf070
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 54 deletions.
7 changes: 3 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ file_extension: ''
has_binder: false
has_settings: true
kind: frontend
labextension_name: nersc-refresh-announcements
labextension_name: stsci-announce
mimetype: ''
mimetype_name: ''
project_short_description: A JupyterLab extension.
python_name: nersc_refresh_announcements
repository: https://github.com/NERSC/nersc_refresh_announcements.git
python_name: stsci_announce
repository: https://github.com/spacetelescope/stsci-announce.git
test: false
viewer_name: ''

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules
**/lib
**/package.json
!/package.json
nersc_refresh_announcements
stsci_announce
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
BSD 3-Clause License

Copyright (c) 2020, Josh Geden All rights reserved.
Copyrigth (c) 2024, Space Telescope Science Institute, All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
43 changes: 23 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# nersc_refresh_announcements
# stsci-announce

A JupyterLab extension.
A JupyterLab extension that periodically fetches announcements from an external API to and creates
a button in the JupyterLab status bar that can display the announcement in a modal window.

This extension fetches announcements from an external API to and creates
a button in the JupyterLab status bar that can display the announcement
in a modal window.
Originally forked from and heavily based on the similar nersc-refresh-announcements project,
we are grateful to NERSC for sharing their work as the basis of our own. Nevertheless
stsci-announce has diverged substantially in terms of the message protocol used and other
supporting programs we developed independently, and so to avoid confusion between what are
now two different things, we have rebranded as stsci-announce.


## Requirements
Expand All @@ -24,36 +27,36 @@ pip install .
To remove the extension, execute:

```bash
pip uninstall nersc_refresh_announcements
pip uninstall stsci-announce
```

If that does not work, you can directly delete the extension folder from
Jupyter. See
<a href="https://jupyterlab.readthedocs.io/en/latest/user/directories.html#extensions">this link</a>
Jupyter. See
<a href="https://jupyterlab.readthedocs.io/en/latest/user/directories.html#extensions">this link</a>
to find where your extensions are installed.

## Configuration and Announcement API Assumptions

The default url that the extension will attempt to fetch announcements from is
`<base url>/services/announcement/latest`. If you wish to change that url you
`<base url>/services/announcement/latest-v2`. If you wish to change that url you
can do so per user in JupyterLab under the advanced settings window. You
can also change that url for every user on the system by modifying Jupyter's
`overrides.json` file. Click
`overrides.json` file. Click
<a href="https://jupyterlab.readthedocs.io/en/latest/user/directories.html#overrides-json"> this link</a>
to see where your overrides.json file is installed. Similarly, the refresh
interval that controls how often the announcement API is checked can also
be configured either per user or system-wide.

View the `examples_overrides.json` file above to see how to format this file.

There are two assumptions made about the announcements API. The first is that
it has Cross-Origin Resource Sharing enabled and is accessible from the url
that the JupyterLab server is running on (for most users this is
localhost:8888, but if you use a JupyterHub service or other portal it might
be different) or that the announcements API is hosted on the same origin.
You might have to work with your announcements API provider to ensure your
JupyterLab is allowed to fetch from that url. The second
assumption is that the API will return a json object that has an
There are two assumptions made about the announcements API. The first is that
it has Cross-Origin Resource Sharing enabled and is accessible from the url
that the JupyterLab server is running on (for most users this is
localhost:8888, but if you use a JupyterHub service or other portal it might
be different) or that the announcements API is hosted on the same origin.
You might have to work with your announcements API provider to ensure your
JupyterLab is allowed to fetch from that url. The second
assumption is that the API will return a json object that has an
"announcement" field (i.e. {"announcement": "Hello, World!"}).

## Contributing
Expand All @@ -68,7 +71,7 @@ The `jlpm` command is JupyterLab's pinned version of

```bash
# Clone the repo to your local environment
# Change directory to the nersc_refresh_announcements directory
# Change directory to the stsci-announce directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
Expand Down Expand Up @@ -97,7 +100,7 @@ jupyter lab build --minimize=False
### Development uninstall

```bash
pip uninstall nersc_refresh_announcements
pip uninstall stsci-announce
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Making a new release of nersc_refresh_announcements
# Making a new release of stsci_announce

The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).

Expand Down
4 changes: 2 additions & 2 deletions example_overrides.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nersc-refresh-announcements:plugin": {
"url": "https://jupyter.nersc.gov/services/announcement/latest",
"stsci-announce:plugin": {
"url": "https://future.science.stsci.edu/services/announcement/latest-v2",
"refresh-interval": 300000
}
}
4 changes: 2 additions & 2 deletions install.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packageManager": "python",
"packageName": "nersc_refresh_announcements",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package nersc_refresh_announcements"
"packageName": "stsci-announce",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package stsci-announce"
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "nersc-refresh-announcements",
"name": "stsci-announce",
"version": "0.5.0",
"description": "A JupyterLab extension.",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/NERSC/nersc_refresh_announcements",
"homepage": "https://github.com/spacetelescope/stsci-announce",
"bugs": {
"url": "https://github.com/NERSC/nersc_refresh_announcements/issues"
"url": "https://github.com/spacetelescope/stsci-announce/issues"
},
"license": "BSD-3-Clause",
"author": {
Expand All @@ -27,7 +27,7 @@
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/NERSC/nersc_refresh_announcements.git"
"url": "https://github.com/spacetelescope/stsci-announce.git"
},
"scripts": {
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
Expand All @@ -37,7 +37,7 @@
"build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
"clean": "jlpm run clean:lib",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"clean:labextension": "rimraf nersc_refresh_announcements/labextension",
"clean:labextension": "rimraf stsci_announce/labextension",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
Expand Down Expand Up @@ -81,7 +81,7 @@
"styleModule": "style/index.js",
"jupyterlab": {
"extension": true,
"outputDir": "nersc_refresh_announcements/labextension",
"outputDir": "stsci_announce/labextension",
"schemaDir": "schema"
}
}
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version"]
build-backend = "hatchling.build"

[project]
name = "nersc_refresh_announcements"
name = "stsci_announce"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.8"
Expand Down Expand Up @@ -32,24 +32,24 @@ source = "nodejs"
fields = ["description", "authors", "urls"]

[tool.hatch.build.targets.sdist]
artifacts = ["nersc_refresh_announcements/labextension"]
artifacts = ["stsci_announce/labextension"]
exclude = [".github", "binder"]

[tool.hatch.build.targets.wheel.shared-data]
"nersc_refresh_announcements/labextension" = "share/jupyter/labextensions/nersc-refresh-announcements"
"install.json" = "share/jupyter/labextensions/nersc-refresh-announcements/install.json"
"stsci_announce/labextension" = "share/jupyter/labextensions/stsci-announce"
"install.json" = "share/jupyter/labextensions/stsci-announce/install.json"

[tool.hatch.build.hooks.version]
path = "nersc_refresh_announcements/_version.py"
path = "stsci_announce/_version.py"

[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.5"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"nersc_refresh_announcements/labextension/static/style.js",
"nersc_refresh_announcements/labextension/package.json",
"stsci_announce/labextension/static/style.js",
"stsci_announce/labextension/package.json",
]
skip-if-exists = ["nersc_refresh_announcements/labextension/static/style.js"]
skip-if-exists = ["stsci_announce/labextension/static/style.js"]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build:prod"
Expand All @@ -59,7 +59,7 @@ npm = ["jlpm"]
build_cmd = "install:extension"
npm = ["jlpm"]
source_dir = "src"
build_dir = "nersc_refresh_announcements/labextension"
build_dir = "stsci_announce/labextension"

[tool.jupyter-releaser.options]
version_cmd = "hatch version"
Expand Down
6 changes: 3 additions & 3 deletions setup-jh-dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

# Copy and paste this into an executable shell script on the hub.
## Check out the nersc-refresh-announcements repo for live work in
## Check out the stsci-announce repo for live work in
## a JupyterHub notebook session.

set -eux
Expand All @@ -13,9 +13,9 @@ else
BRANCH=$1
fi

git clone https://github.com/jaytmiller/nersc-refresh-announcements.git
git clone https://github.com/jaytmiller/stsci-announce.git

cd nersc-refresh-announcements
cd stsci-announce
git fetch origin
git checkout ${BRANCH}

Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,17 @@ class RefreshAnnouncements {
}
}

const PLUGIN_ID = 'nersc-refresh-announcements:plugin';
const PLUGIN_ID = 'stsci-announce:plugin';

/**
* Initialization data for the nersc-refresh-announcements extension.
* Initialization data for the stsci-announce extension.
*/
const extension: JupyterFrontEndPlugin<void> = {
id: PLUGIN_ID,
autoStart: true,
requires: [IStatusBar, ISettingRegistry],
activate: async (app: JupyterFrontEnd, statusBar: IStatusBar, settingRegistry: ISettingRegistry) => {
console.log('JupyterLab extension nersc-refresh-announcements is activated!');
console.log('JupyterLab extension stsci-announce is activated!');

const settings = await settingRegistry.load(PLUGIN_ID);
const apiUrl = settings.get('url').composite as string;
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 2bcf070

Please sign in to comment.