correxit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. correxit-0.1.0/.copier-answers.yml +15 -0
  2. correxit-0.1.0/.gitignore +125 -0
  3. correxit-0.1.0/.prettierignore +6 -0
  4. correxit-0.1.0/.yarnrc.yml +1 -0
  5. correxit-0.1.0/CHANGELOG.md +5 -0
  6. correxit-0.1.0/LICENSE +4 -0
  7. correxit-0.1.0/PKG-INFO +175 -0
  8. correxit-0.1.0/README.md +139 -0
  9. correxit-0.1.0/RELEASE.md +80 -0
  10. correxit-0.1.0/babel.config.js +1 -0
  11. correxit-0.1.0/conftest.py +8 -0
  12. correxit-0.1.0/correxit/__init__.py +36 -0
  13. correxit-0.1.0/correxit/_version.py +4 -0
  14. correxit-0.1.0/correxit/handlers.py +24 -0
  15. correxit-0.1.0/correxit/labextension/package.json +215 -0
  16. correxit-0.1.0/correxit/labextension/schemas/correxit/package.json.orig +210 -0
  17. correxit-0.1.0/correxit/labextension/schemas/correxit/plugin.json +8 -0
  18. correxit-0.1.0/correxit/labextension/static/675.852a5f31db43538e7061.js +1 -0
  19. correxit-0.1.0/correxit/labextension/static/728.01a08fcc28d4d2979e5b.js +1 -0
  20. correxit-0.1.0/correxit/labextension/static/remoteEntry.f6ec01de78b774b84c1a.js +1 -0
  21. correxit-0.1.0/correxit/labextension/static/style.js +4 -0
  22. correxit-0.1.0/correxit/labextension/static/third-party-licenses.json +16 -0
  23. correxit-0.1.0/correxit/tests/__init__.py +1 -0
  24. correxit-0.1.0/correxit/tests/test_handlers.py +13 -0
  25. correxit-0.1.0/install.json +5 -0
  26. correxit-0.1.0/jest.config.js +28 -0
  27. correxit-0.1.0/jupyter-config/server-config/correxit.json +7 -0
  28. correxit-0.1.0/package.json +210 -0
  29. correxit-0.1.0/pyproject.toml +87 -0
  30. correxit-0.1.0/schema/plugin.json +8 -0
  31. correxit-0.1.0/setup.py +1 -0
  32. correxit-0.1.0/src/__tests__/correxit.spec.ts +9 -0
  33. correxit-0.1.0/src/handler.ts +46 -0
  34. correxit-0.1.0/src/index.ts +44 -0
  35. correxit-0.1.0/style/base.css +5 -0
  36. correxit-0.1.0/style/index.css +1 -0
  37. correxit-0.1.0/style/index.js +1 -0
  38. correxit-0.1.0/tsconfig.json +25 -0
  39. correxit-0.1.0/tsconfig.test.json +3 -0
  40. correxit-0.1.0/ui-tests/README.md +167 -0
  41. correxit-0.1.0/ui-tests/jupyter_server_test_config.py +12 -0
  42. correxit-0.1.0/ui-tests/package.json +15 -0
  43. correxit-0.1.0/ui-tests/playwright.config.js +14 -0
  44. correxit-0.1.0/ui-tests/tests/correxit.spec.ts +21 -0
  45. correxit-0.1.0/ui-tests/yarn.lock +0 -0
  46. correxit-0.1.0/yarn.lock +9817 -0
@@ -0,0 +1,15 @@
1
+ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
+ _commit: v4.3.8
3
+ _src_path: https://github.com/jupyterlab/extension-template
4
+ author_email: correxit@darian.link
5
+ author_name: A. T. Darian
6
+ has_binder: false
7
+ has_settings: true
8
+ kind: server
9
+ labextension_name: correxit
10
+ project_short_description: correxit is a JupyterLab extension and the third-person singular
11
+ perfect active indicative conjugation of the Latin verb corrigere
12
+ python_name: correxit
13
+ repository: https://github.com/notebook-link/correxit
14
+ test: true
15
+
@@ -0,0 +1,125 @@
1
+ *.bundle.*
2
+ lib/
3
+ node_modules/
4
+ *.log
5
+ .eslintcache
6
+ .stylelintcache
7
+ *.egg-info/
8
+ .ipynb_checkpoints
9
+ *.tsbuildinfo
10
+ correxit/labextension
11
+ # Version file is handled by hatchling
12
+ correxit/_version.py
13
+
14
+ # Integration tests
15
+ ui-tests/test-results/
16
+ ui-tests/playwright-report/
17
+
18
+ # Created by https://www.gitignore.io/api/python
19
+ # Edit at https://www.gitignore.io/?templates=python
20
+
21
+ ### Python ###
22
+ # Byte-compiled / optimized / DLL files
23
+ __pycache__/
24
+ *.py[cod]
25
+ *$py.class
26
+
27
+ # C extensions
28
+ *.so
29
+
30
+ # Distribution / packaging
31
+ .Python
32
+ build/
33
+ develop-eggs/
34
+ dist/
35
+ downloads/
36
+ eggs/
37
+ .eggs/
38
+ lib/
39
+ lib64/
40
+ parts/
41
+ sdist/
42
+ var/
43
+ wheels/
44
+ pip-wheel-metadata/
45
+ share/python-wheels/
46
+ .installed.cfg
47
+ *.egg
48
+ MANIFEST
49
+
50
+ # PyInstaller
51
+ # Usually these files are written by a python script from a template
52
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
53
+ *.manifest
54
+ *.spec
55
+
56
+ # Installer logs
57
+ pip-log.txt
58
+ pip-delete-this-directory.txt
59
+
60
+ # Unit test / coverage reports
61
+ htmlcov/
62
+ .tox/
63
+ .nox/
64
+ .coverage
65
+ .coverage.*
66
+ .cache
67
+ nosetests.xml
68
+ coverage/
69
+ coverage.xml
70
+ *.cover
71
+ .hypothesis/
72
+ .pytest_cache/
73
+
74
+ # Translations
75
+ *.mo
76
+ *.pot
77
+
78
+ # Scrapy stuff:
79
+ .scrapy
80
+
81
+ # Sphinx documentation
82
+ docs/_build/
83
+
84
+ # PyBuilder
85
+ target/
86
+
87
+ # pyenv
88
+ .python-version
89
+
90
+ # celery beat schedule file
91
+ celerybeat-schedule
92
+
93
+ # SageMath parsed files
94
+ *.sage.py
95
+
96
+ # Spyder project settings
97
+ .spyderproject
98
+ .spyproject
99
+
100
+ # Rope project settings
101
+ .ropeproject
102
+
103
+ # Mr Developer
104
+ .mr.developer.cfg
105
+ .project
106
+ .pydevproject
107
+
108
+ # mkdocs documentation
109
+ /site
110
+
111
+ # mypy
112
+ .mypy_cache/
113
+ .dmypy.json
114
+ dmypy.json
115
+
116
+ # Pyre type checker
117
+ .pyre/
118
+
119
+ # End of https://www.gitignore.io/api/python
120
+
121
+ # OSX files
122
+ .DS_Store
123
+
124
+ # Yarn cache
125
+ .yarn/
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ **/node_modules
3
+ **/lib
4
+ **/package.json
5
+ !/package.json
6
+ correxit
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ <!-- <START NEW CHANGELOG ENTRY> -->
4
+
5
+ <!-- <END NEW CHANGELOG ENTRY> -->
correxit-0.1.0/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ Copyright (c) 2025, A. T. Darian
2
+ All rights reserved.
3
+
4
+ This package is UNLICENSED.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: correxit
3
+ Version: 0.1.0
4
+ Summary: correxit is a JupyterLab extension and the third-person singular perfect active indicative conjugation of the Latin verb corrigere
5
+ Project-URL: Homepage, https://github.com/notebook-link/correxit
6
+ Project-URL: Bug Tracker, https://github.com/notebook-link/correxit/issues
7
+ Project-URL: Repository, https://github.com/notebook-link/correxit.git
8
+ Author-email: "A. T. Darian" <correxit@darian.link>
9
+ License: Copyright (c) 2025, A. T. Darian
10
+ All rights reserved.
11
+
12
+ This package is UNLICENSED.
13
+ License-File: LICENSE
14
+ Keywords: jupyter,jupyterlab,jupyterlab-extension
15
+ Classifier: Framework :: Jupyter
16
+ Classifier: Framework :: Jupyter :: JupyterLab
17
+ Classifier: Framework :: Jupyter :: JupyterLab :: 4
18
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
19
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Requires-Python: >=3.9
28
+ Requires-Dist: jupyter-server<3,>=2.4.0
29
+ Provides-Extra: test
30
+ Requires-Dist: coverage; extra == 'test'
31
+ Requires-Dist: pytest; extra == 'test'
32
+ Requires-Dist: pytest-asyncio; extra == 'test'
33
+ Requires-Dist: pytest-cov; extra == 'test'
34
+ Requires-Dist: pytest-jupyter[server]>=0.6.0; extra == 'test'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # correxit
38
+
39
+ [![Github Actions Status](https://github.com/notebook-link/correxit/workflows/Build/badge.svg)](https://github.com/notebook-link/correxit/actions/workflows/build.yml)
40
+
41
+ correxit is a JupyterLab extension and the third-person singular perfect active indicative conjugation of the Latin verb corrigere
42
+
43
+ This extension is composed of a Python package named `correxit`
44
+ for the server extension and a NPM package named `correxit`
45
+ for the frontend extension.
46
+
47
+ ## Requirements
48
+
49
+ - JupyterLab >= 4.0.0
50
+
51
+ ## Install
52
+
53
+ To install the extension, execute:
54
+
55
+ ```bash
56
+ pip install correxit
57
+ ```
58
+
59
+ ## Uninstall
60
+
61
+ To remove the extension, execute:
62
+
63
+ ```bash
64
+ pip uninstall correxit
65
+ ```
66
+
67
+ ## Troubleshoot
68
+
69
+ If you are seeing the frontend extension, but it is not working, check
70
+ that the server extension is enabled:
71
+
72
+ ```bash
73
+ jupyter server extension list
74
+ ```
75
+
76
+ If the server extension is installed and enabled, but you are not seeing
77
+ the frontend extension, check the frontend extension is installed:
78
+
79
+ ```bash
80
+ jupyter labextension list
81
+ ```
82
+
83
+ ## Contributing
84
+
85
+ ### Development install
86
+
87
+ Note: You will need NodeJS to build the extension package.
88
+
89
+ The `jlpm` command is JupyterLab's pinned version of
90
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
91
+ `yarn` or `npm` in lieu of `jlpm` below.
92
+
93
+ ```bash
94
+ # Clone the repo to your local environment
95
+ # Change directory to the correxit directory
96
+ # Install package in development mode
97
+ pip install -e ".[test]"
98
+ # Link your development version of the extension with JupyterLab
99
+ jupyter labextension develop . --overwrite
100
+ # Server extension must be manually installed in develop mode
101
+ jupyter server extension enable correxit
102
+ # Rebuild extension Typescript source after making changes
103
+ jlpm build
104
+ ```
105
+
106
+ 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.
107
+
108
+ ```bash
109
+ # Watch the source directory in one terminal, automatically rebuilding when needed
110
+ jlpm watch
111
+ # Run JupyterLab in another terminal
112
+ jupyter lab
113
+ ```
114
+
115
+ 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).
116
+
117
+ 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:
118
+
119
+ ```bash
120
+ jupyter lab build --minimize=False
121
+ ```
122
+
123
+ ### Development uninstall
124
+
125
+ ```bash
126
+ # Server extension must be manually disabled in develop mode
127
+ jupyter server extension disable correxit
128
+ pip uninstall correxit
129
+ ```
130
+
131
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
132
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
133
+ folder is located. Then you can remove the symlink named `correxit` within that folder.
134
+
135
+ ### Testing the extension
136
+
137
+ #### Server tests
138
+
139
+ This extension is using [Pytest](https://docs.pytest.org/) for Python code testing.
140
+
141
+ Install test dependencies (needed only once):
142
+
143
+ ```sh
144
+ pip install -e ".[test]"
145
+ # Each time you install the Python package, you need to restore the front-end extension link
146
+ jupyter labextension develop . --overwrite
147
+ ```
148
+
149
+ To execute them, run:
150
+
151
+ ```sh
152
+ pytest -vv -r ap --cov correxit
153
+ ```
154
+
155
+ #### Frontend tests
156
+
157
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
158
+
159
+ To execute them, execute:
160
+
161
+ ```sh
162
+ jlpm
163
+ jlpm test
164
+ ```
165
+
166
+ #### Integration tests
167
+
168
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
169
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
170
+
171
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
172
+
173
+ ### Packaging the extension
174
+
175
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,139 @@
1
+ # correxit
2
+
3
+ [![Github Actions Status](https://github.com/notebook-link/correxit/workflows/Build/badge.svg)](https://github.com/notebook-link/correxit/actions/workflows/build.yml)
4
+
5
+ correxit is a JupyterLab extension and the third-person singular perfect active indicative conjugation of the Latin verb corrigere
6
+
7
+ This extension is composed of a Python package named `correxit`
8
+ for the server extension and a NPM package named `correxit`
9
+ for the frontend extension.
10
+
11
+ ## Requirements
12
+
13
+ - JupyterLab >= 4.0.0
14
+
15
+ ## Install
16
+
17
+ To install the extension, execute:
18
+
19
+ ```bash
20
+ pip install correxit
21
+ ```
22
+
23
+ ## Uninstall
24
+
25
+ To remove the extension, execute:
26
+
27
+ ```bash
28
+ pip uninstall correxit
29
+ ```
30
+
31
+ ## Troubleshoot
32
+
33
+ If you are seeing the frontend extension, but it is not working, check
34
+ that the server extension is enabled:
35
+
36
+ ```bash
37
+ jupyter server extension list
38
+ ```
39
+
40
+ If the server extension is installed and enabled, but you are not seeing
41
+ the frontend extension, check the frontend extension is installed:
42
+
43
+ ```bash
44
+ jupyter labextension list
45
+ ```
46
+
47
+ ## Contributing
48
+
49
+ ### Development install
50
+
51
+ Note: You will need NodeJS to build the extension package.
52
+
53
+ The `jlpm` command is JupyterLab's pinned version of
54
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
55
+ `yarn` or `npm` in lieu of `jlpm` below.
56
+
57
+ ```bash
58
+ # Clone the repo to your local environment
59
+ # Change directory to the correxit directory
60
+ # Install package in development mode
61
+ pip install -e ".[test]"
62
+ # Link your development version of the extension with JupyterLab
63
+ jupyter labextension develop . --overwrite
64
+ # Server extension must be manually installed in develop mode
65
+ jupyter server extension enable correxit
66
+ # Rebuild extension Typescript source after making changes
67
+ jlpm build
68
+ ```
69
+
70
+ 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.
71
+
72
+ ```bash
73
+ # Watch the source directory in one terminal, automatically rebuilding when needed
74
+ jlpm watch
75
+ # Run JupyterLab in another terminal
76
+ jupyter lab
77
+ ```
78
+
79
+ 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).
80
+
81
+ 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:
82
+
83
+ ```bash
84
+ jupyter lab build --minimize=False
85
+ ```
86
+
87
+ ### Development uninstall
88
+
89
+ ```bash
90
+ # Server extension must be manually disabled in develop mode
91
+ jupyter server extension disable correxit
92
+ pip uninstall correxit
93
+ ```
94
+
95
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
96
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
97
+ folder is located. Then you can remove the symlink named `correxit` within that folder.
98
+
99
+ ### Testing the extension
100
+
101
+ #### Server tests
102
+
103
+ This extension is using [Pytest](https://docs.pytest.org/) for Python code testing.
104
+
105
+ Install test dependencies (needed only once):
106
+
107
+ ```sh
108
+ pip install -e ".[test]"
109
+ # Each time you install the Python package, you need to restore the front-end extension link
110
+ jupyter labextension develop . --overwrite
111
+ ```
112
+
113
+ To execute them, run:
114
+
115
+ ```sh
116
+ pytest -vv -r ap --cov correxit
117
+ ```
118
+
119
+ #### Frontend tests
120
+
121
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
122
+
123
+ To execute them, execute:
124
+
125
+ ```sh
126
+ jlpm
127
+ jlpm test
128
+ ```
129
+
130
+ #### Integration tests
131
+
132
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
133
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
134
+
135
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
136
+
137
+ ### Packaging the extension
138
+
139
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,80 @@
1
+ # Making a new release of correxit
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 packages. All of the Python
10
+ packaging instructions are in the `pyproject.toml` file to wrap your extension in a
11
+ Python package. Before generating a package, you first need to install some tools:
12
+
13
+ ```bash
14
+ pip install build twine hatch
15
+ ```
16
+
17
+ Bump the version using `hatch`. By default this will create a tag.
18
+ See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-version#semver) for details.
19
+
20
+ ```bash
21
+ hatch version <new-version>
22
+ ```
23
+
24
+ Make sure to clean up all the development files before building the package:
25
+
26
+ ```bash
27
+ jlpm clean:all
28
+ ```
29
+
30
+ You could also clean up the local git repository:
31
+
32
+ ```bash
33
+ git clean -dfX
34
+ ```
35
+
36
+ To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
37
+
38
+ ```bash
39
+ python -m build
40
+ ```
41
+
42
+ > `python setup.py sdist bdist_wheel` is deprecated and will not work for this package.
43
+
44
+ Then to upload the package to PyPI, do:
45
+
46
+ ```bash
47
+ twine upload dist/*
48
+ ```
49
+
50
+ ### NPM package
51
+
52
+ To publish the frontend part of the extension as a NPM package, do:
53
+
54
+ ```bash
55
+ npm login
56
+ npm publish --access public
57
+ ```
58
+
59
+ ## Automated releases with the Jupyter Releaser
60
+
61
+ The extension repository should already be compatible with the Jupyter Releaser. But
62
+ the GitHub repository and the package managers need to be properly set up. Please
63
+ follow the instructions of the Jupyter Releaser [checklist](https://jupyter-releaser.readthedocs.io/en/latest/how_to_guides/convert_repo_from_repo.html).
64
+
65
+ Here is a summary of the steps to cut a new release:
66
+
67
+ - Go to the Actions panel
68
+ - Run the "Step 1: Prep Release" workflow
69
+ - Check the draft changelog
70
+ - Run the "Step 2: Publish Release" workflow
71
+
72
+ > [!NOTE]
73
+ > Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html)
74
+ > for more information.
75
+
76
+ ## Publishing to `conda-forge`
77
+
78
+ 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
79
+
80
+ Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically.
@@ -0,0 +1 @@
1
+ module.exports = require('@jupyterlab/testutils/lib/babel.config');
@@ -0,0 +1,8 @@
1
+ import pytest
2
+
3
+ pytest_plugins = ("pytest_jupyter.jupyter_server", )
4
+
5
+
6
+ @pytest.fixture
7
+ def jp_server_config(jp_server_config):
8
+ return {"ServerApp": {"jpserver_extensions": {"correxit": True}}}
@@ -0,0 +1,36 @@
1
+ try:
2
+ from ._version import __version__
3
+ except ImportError:
4
+ # Fallback when using the package in dev mode without installing
5
+ # in editable mode with pip. It is highly recommended to install
6
+ # the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
7
+ import warnings
8
+ warnings.warn("Importing 'correxit' outside a proper installation.")
9
+ __version__ = "dev"
10
+ from .handlers import setup_handlers
11
+
12
+
13
+ def _jupyter_labextension_paths():
14
+ return [{
15
+ "src": "labextension",
16
+ "dest": "correxit"
17
+ }]
18
+
19
+
20
+ def _jupyter_server_extension_points():
21
+ return [{
22
+ "module": "correxit"
23
+ }]
24
+
25
+
26
+ def _load_jupyter_server_extension(server_app):
27
+ """Registers the API handler to receive HTTP requests from the frontend extension.
28
+
29
+ Parameters
30
+ ----------
31
+ server_app: jupyterlab.labapp.LabApp
32
+ JupyterLab application instance
33
+ """
34
+ setup_handlers(server_app.web_app)
35
+ name = "correxit"
36
+ server_app.log.info(f"Registered {name} server extension")
@@ -0,0 +1,4 @@
1
+ # This file is auto-generated by Hatchling. As such, do not:
2
+ # - modify
3
+ # - track in version control e.g. be sure to add to .gitignore
4
+ __version__ = VERSION = '0.1.0'
@@ -0,0 +1,24 @@
1
+ import json
2
+
3
+ from jupyter_server.base.handlers import APIHandler
4
+ from jupyter_server.utils import url_path_join
5
+ import tornado
6
+
7
+ class RouteHandler(APIHandler):
8
+ # The following decorator should be present on all verb methods (head, get, post,
9
+ # patch, put, delete, options) to ensure only authorized user can request the
10
+ # Jupyter server
11
+ @tornado.web.authenticated
12
+ def get(self):
13
+ self.finish(json.dumps({
14
+ "data": "This is /correxit/get-example endpoint!"
15
+ }))
16
+
17
+
18
+ def setup_handlers(web_app):
19
+ host_pattern = ".*$"
20
+
21
+ base_url = web_app.settings["base_url"]
22
+ route_pattern = url_path_join(base_url, "correxit", "get-example")
23
+ handlers = [(route_pattern, RouteHandler)]
24
+ web_app.add_handlers(host_pattern, handlers)