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

Commit fc228a3

Browse files
committed
initial commit
1 parent 77d0e48 commit fc228a3

18 files changed

+822
-0
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts
5+
tests

.eslintrc.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:@typescript-eslint/eslint-recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:prettier/recommended'
7+
],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
project: 'tsconfig.json',
11+
sourceType: 'module'
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'@typescript-eslint/naming-convention': [
16+
'error',
17+
{
18+
selector: 'interface',
19+
format: ['PascalCase'],
20+
custom: {
21+
regex: '^I[A-Z]',
22+
match: true
23+
}
24+
}
25+
],
26+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
27+
'@typescript-eslint/no-explicit-any': 'off',
28+
'@typescript-eslint/no-namespace': 'off',
29+
'@typescript-eslint/no-use-before-define': 'off',
30+
'@typescript-eslint/quotes': [
31+
'error',
32+
'single',
33+
{ avoidEscape: true, allowTemplateLiterals: false }
34+
],
35+
curly: ['error', 'all'],
36+
eqeqeq: 'error',
37+
'prefer-arrow-callback': 'error'
38+
}
39+
};

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json
5+
cate_theme

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "none",
4+
"arrowParens": "avoid",
5+
"endOfLine": "auto"
6+
}

.stylelintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": [
3+
"stylelint-config-recommended",
4+
"stylelint-config-standard",
5+
"stylelint-prettier/recommended"
6+
],
7+
"rules": {
8+
"property-no-vendor-prefix": null,
9+
"selector-no-vendor-prefix": null,
10+
"value-no-vendor-prefix": null,
11+
"alpha-value-notation": null,
12+
"color-function-notation": null
13+
}
14+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
<!-- <END NEW CHANGELOG ENTRY> -->

MANIFEST.in

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include LICENSE
2+
include *.md
3+
include pyproject.toml
4+
5+
include package.json
6+
include install.json
7+
include ts*.json
8+
include yarn.lock
9+
10+
graft cate_theme/labextension
11+
12+
# Javascript files
13+
graft src
14+
graft style
15+
prune **/node_modules
16+
prune lib
17+
prune binder
18+
19+
# Patterns to exclude from any directory
20+
global-exclude *~
21+
global-exclude *.pyc
22+
global-exclude *.pyo
23+
global-exclude .git
24+
global-exclude .ipynb_checkpoints

RELEASE.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Making a new release of cate_theme
2+
3+
The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).
4+
5+
## Manual release
6+
7+
### Python package
8+
9+
This extension can be distributed as Python
10+
packages. All of the Python
11+
packaging instructions in the `pyproject.toml` file to wrap your extension in a
12+
Python package. Before generating a package, we first need to install `build`.
13+
14+
```bash
15+
pip install build twine
16+
```
17+
18+
To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
19+
20+
```bash
21+
python -m build
22+
```
23+
24+
> `python setup.py sdist bdist_wheel` is deprecated and will not work for this package.
25+
26+
Then to upload the package to PyPI, do:
27+
28+
```bash
29+
twine upload dist/*
30+
```
31+
32+
### NPM package
33+
34+
To publish the frontend part of the extension as a NPM package, do:
35+
36+
```bash
37+
npm login
38+
npm publish --access public
39+
```
40+
41+
## Automated releases with the Jupyter Releaser
42+
43+
The extension repository should already be compatible with the Jupyter Releaser.
44+
45+
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information.
46+
47+
Here is a summary of the steps to cut a new release:
48+
49+
- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser)
50+
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork
51+
- Go to the Actions panel
52+
- Run the "Draft Changelog" workflow
53+
- Merge the Changelog PR
54+
- Run the "Draft Release" workflow
55+
- Run the "Publish Release" workflow
56+
57+
## Publishing to `conda-forge`
58+
59+
If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html
60+
61+
Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically.

cate_theme/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# cate_theme
2+
3+
[![Github Actions Status](https://github.com/CCI-Tools/cate-jupyter-theme/workflows/Build/badge.svg)](https://github.com/CCI-Tools/cate-jupyter-theme/actions/workflows/build.yml)
4+
A JupyterLab extension.
5+
6+
## Requirements
7+
8+
- JupyterLab >= 3.0
9+
10+
## Install
11+
12+
To install the extension, execute:
13+
14+
```bash
15+
pip install cate_theme
16+
```
17+
18+
## Uninstall
19+
20+
To remove the extension, execute:
21+
22+
```bash
23+
pip uninstall cate_theme
24+
```
25+
26+
## Contributing
27+
28+
### Development install
29+
30+
Note: You will need NodeJS to build the extension package.
31+
32+
The `jlpm` command is JupyterLab's pinned version of
33+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
34+
`yarn` or `npm` in lieu of `jlpm` below.
35+
36+
```bash
37+
# Clone the repo to your local environment
38+
# Change directory to the cate_theme directory
39+
# Install package in development mode
40+
pip install -e .
41+
# Link your development version of the extension with JupyterLab
42+
jupyter labextension develop . --overwrite
43+
# Rebuild extension Typescript source after making changes
44+
jlpm build
45+
```
46+
47+
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
48+
49+
```bash
50+
# Watch the source directory in one terminal, automatically rebuilding when needed
51+
jlpm watch
52+
# Run JupyterLab in another terminal
53+
jupyter lab
54+
```
55+
56+
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
57+
58+
By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
59+
60+
```bash
61+
jupyter lab build --minimize=False
62+
```
63+
64+
### Development uninstall
65+
66+
```bash
67+
pip uninstall cate_theme
68+
```
69+
70+
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
71+
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
72+
folder is located. Then you can remove the symlink named `cate-theme` within that folder.
73+
74+
### Packaging the extension
75+
76+
See [RELEASE](../RELEASE.md)

cate_theme/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
from pathlib import Path
3+
4+
from ._version import __version__
5+
6+
7+
HERE = Path(__file__).parent.resolve()
8+
9+
10+
with (HERE / "labextension" / "package.json").open() as fid:
11+
data = json.load(fid)
12+
13+
14+
def _jupyter_labextension_paths():
15+
return [{
16+
"src": "labextension",
17+
"dest": data["name"]
18+
}]
19+

0 commit comments

Comments
 (0)