jupyterlab-doc-reader-extension 0.5.37__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.
- jupyterlab_doc_reader_extension-0.5.37/.claude/CLAUDE.md +144 -0
- jupyterlab_doc_reader_extension-0.5.37/.claude/JOURNAL.md +4 -0
- jupyterlab_doc_reader_extension-0.5.37/.claude/settings.local.json +19 -0
- jupyterlab_doc_reader_extension-0.5.37/.copier-answers.yml +14 -0
- jupyterlab_doc_reader_extension-0.5.37/.gitignore +125 -0
- jupyterlab_doc_reader_extension-0.5.37/.prettierignore +6 -0
- jupyterlab_doc_reader_extension-0.5.37/.yarnrc.yml +1 -0
- jupyterlab_doc_reader_extension-0.5.37/CHANGELOG.md +5 -0
- jupyterlab_doc_reader_extension-0.5.37/LICENSE +29 -0
- jupyterlab_doc_reader_extension-0.5.37/Makefile +92 -0
- jupyterlab_doc_reader_extension-0.5.37/PKG-INFO +225 -0
- jupyterlab_doc_reader_extension-0.5.37/README.md +162 -0
- jupyterlab_doc_reader_extension-0.5.37/RELEASE.md +80 -0
- jupyterlab_doc_reader_extension-0.5.37/babel.config.js +1 -0
- jupyterlab_doc_reader_extension-0.5.37/conftest.py +8 -0
- jupyterlab_doc_reader_extension-0.5.37/install.json +5 -0
- jupyterlab_doc_reader_extension-0.5.37/jest.config.js +28 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyter-config/server-config/jupyterlab_doc_reader_extension.json +7 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/__init__.py +36 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/_version.py +4 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/handlers.py +262 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/labextension/package.json +217 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/labextension/static/728.09ab50c860da660c9699.js +1 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/labextension/static/777.541214e75b1baf5d6c95.js +1 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/labextension/static/remoteEntry.f5e6d76fc316f658dd78.js +1 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/labextension/static/style.js +4 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/labextension/static/third-party-licenses.json +16 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/tests/__init__.py +1 -0
- jupyterlab_doc_reader_extension-0.5.37/jupyterlab_doc_reader_extension/tests/test_handlers.py +13 -0
- jupyterlab_doc_reader_extension-0.5.37/package-lock.json +13902 -0
- jupyterlab_doc_reader_extension-0.5.37/package.json +212 -0
- jupyterlab_doc_reader_extension-0.5.37/pyproject.toml +89 -0
- jupyterlab_doc_reader_extension-0.5.37/setup.py +1 -0
- jupyterlab_doc_reader_extension-0.5.37/src/__tests__/jupyterlab_doc_reader_extension.spec.ts +9 -0
- jupyterlab_doc_reader_extension-0.5.37/src/handler.ts +46 -0
- jupyterlab_doc_reader_extension-0.5.37/src/index.ts +89 -0
- jupyterlab_doc_reader_extension-0.5.37/src/model.ts +102 -0
- jupyterlab_doc_reader_extension-0.5.37/src/widget.ts +295 -0
- jupyterlab_doc_reader_extension-0.5.37/style/base.css +59 -0
- jupyterlab_doc_reader_extension-0.5.37/style/index.css +1 -0
- jupyterlab_doc_reader_extension-0.5.37/style/index.js +1 -0
- jupyterlab_doc_reader_extension-0.5.37/tsconfig.json +25 -0
- jupyterlab_doc_reader_extension-0.5.37/tsconfig.test.json +3 -0
- jupyterlab_doc_reader_extension-0.5.37/ui-tests/README.md +167 -0
- jupyterlab_doc_reader_extension-0.5.37/ui-tests/jupyter_server_test_config.py +12 -0
- jupyterlab_doc_reader_extension-0.5.37/ui-tests/package.json +15 -0
- jupyterlab_doc_reader_extension-0.5.37/ui-tests/playwright.config.js +14 -0
- jupyterlab_doc_reader_extension-0.5.37/ui-tests/tests/jupyterlab_doc_reader_extension.spec.ts +21 -0
- jupyterlab_doc_reader_extension-0.5.37/ui-tests/yarn.lock +0 -0
- jupyterlab_doc_reader_extension-0.5.37/yarn.lock +9771 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<!-- #region -->
|
|
2
|
+
|
|
3
|
+
# Code and Content Generation Rules
|
|
4
|
+
- always consider JOURNAL instructions
|
|
5
|
+
- always consider markdown instructions and guidelines when creating documentation
|
|
6
|
+
- always obey mermaid diagramming rules when creating diagrams
|
|
7
|
+
- never add claude as coauthor into commit messages
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Context Persistance
|
|
11
|
+
|
|
12
|
+
**MANDATORY FIRST STEP**: At the start of EVERY session, you MUST:
|
|
13
|
+
1. Read `.claude/JOURNAL.md` (if it exists) before responding to any user query
|
|
14
|
+
2. Acknowledge what previous work was done based on the journal
|
|
15
|
+
3. Ask the user how to proceed based on that context
|
|
16
|
+
|
|
17
|
+
**MANDATORY AFTER EVERY TASK**: After completing substantive work, you MUST:
|
|
18
|
+
1. Update `.claude/JOURNAL.md` with the entry
|
|
19
|
+
2. Confirm to the user that the journal was updated
|
|
20
|
+
|
|
21
|
+
**Journal Entry Rules**:
|
|
22
|
+
- ONLY log substantive work on documents, diagrams, or documentation content
|
|
23
|
+
- DO NOT log: git commits, git pushes, file cleanup, maintenance tasks, or conversational queries
|
|
24
|
+
- Index entries incrementally: '1', '2', etc.
|
|
25
|
+
- Use single bullet points, not sections
|
|
26
|
+
- Merge related consecutive entries when natural
|
|
27
|
+
|
|
28
|
+
**Format**:
|
|
29
|
+
```
|
|
30
|
+
<number>. **Task - <short 3-5 word depiction>**: task description / query description / summary<br>
|
|
31
|
+
**Result**: summary of the work done
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**When NOT creating journal entry**: State explicitly "Not logging to journal: <reason>"
|
|
35
|
+
|
|
36
|
+
## Folders
|
|
37
|
+
|
|
38
|
+
### DO NOT LOOK INTO:
|
|
39
|
+
- `**/@archive`: folder that has outdated and unused content
|
|
40
|
+
- `**/.ipynb_checkpoints`: folder that has jupyterlab checkpoint files
|
|
41
|
+
|
|
42
|
+
## Content Guidelines
|
|
43
|
+
|
|
44
|
+
### Markdown Standards
|
|
45
|
+
- No emojis - maintain professional, technical documentation style
|
|
46
|
+
- Balance concise narrative with structured bullet points
|
|
47
|
+
- Bullet points capture key takeaways and essential information
|
|
48
|
+
- Narrative focuses on value proposition, concrete benefits, and implementation details
|
|
49
|
+
- Include brief introductions but avoid fluff
|
|
50
|
+
- Explicitly state caveats and limitations where relevant
|
|
51
|
+
- Do not use —, use - for bullet points and hyphens in text
|
|
52
|
+
- Do not use full stop after a bullet point
|
|
53
|
+
- For mermaid diagrams use standard colours and not overloaded complex content
|
|
54
|
+
- use standard colours, no custom styles
|
|
55
|
+
- Use diagrams to illustrate complex processes, workflows, or architectures
|
|
56
|
+
- do not overload diagrams with details, provide text narrative above or below
|
|
57
|
+
- do not use images and emojis
|
|
58
|
+
- only type of styling allowed: stroke and stroke-width for graph elements
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Documentation Standards
|
|
62
|
+
- Focus on concrete business value and technical implementation
|
|
63
|
+
- Include specific technology stacks and methodologies
|
|
64
|
+
- Maintain consistency across service descriptions
|
|
65
|
+
- Provide clear implementation timelines and phases
|
|
66
|
+
- Document success criteria and measurable outcomes
|
|
67
|
+
|
|
68
|
+
## Git Commit Standards
|
|
69
|
+
- Use conventional commit format: `feat(CP-0000): <description>`
|
|
70
|
+
- Keep descriptions concise and descriptive
|
|
71
|
+
- Use lowercase for commit messages
|
|
72
|
+
- IMPORTANT: Never attribute content creation to Claude - all content is authored by Konrad Jelen, Claude only assists with organization
|
|
73
|
+
- Do not include "Generated with Claude Code" or "Co-Authored-By: Claude" in commit messages
|
|
74
|
+
- Examples:
|
|
75
|
+
- `feat(CP-0000): add context management section`
|
|
76
|
+
- `feat(CP-0000): generate high-res diagrams with mermaid-cli`
|
|
77
|
+
|
|
78
|
+
## Tooling Installation
|
|
79
|
+
|
|
80
|
+
### Mermaid Diagram Generation
|
|
81
|
+
|
|
82
|
+
For generating PNG diagrams from Mermaid source files:
|
|
83
|
+
|
|
84
|
+
1. Install Mermaid CLI globally:
|
|
85
|
+
```bash
|
|
86
|
+
npm install -g @mermaid-js/mermaid-cli
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
2. Install minimal required system libraries (Ubuntu/Debian):
|
|
90
|
+
```bash
|
|
91
|
+
sudo apt-get update
|
|
92
|
+
sudo apt-get install -y libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libgbm1 libxshmfence1
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
3. Generate diagrams with transparent backgrounds and neutral theme:
|
|
96
|
+
|
|
97
|
+
Single diagram:
|
|
98
|
+
```bash
|
|
99
|
+
echo '{"args": ["--no-sandbox", "--disable-setuid-sandbox"]}' > puppeteer-config.json
|
|
100
|
+
mmdc -i diagram.mmd -o diagram.png -b transparent -p puppeteer-config.json -w 2400
|
|
101
|
+
rm puppeteer-config.json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Batch conversion (all diagrams in one command):
|
|
105
|
+
```bash
|
|
106
|
+
echo '{"args": ["--no-sandbox", "--disable-setuid-sandbox"]}' > puppeteer-config.json && \
|
|
107
|
+
for diagram in component-integration agent-workflow framework-orchestration context-management; do \
|
|
108
|
+
mmdc -i agentic-solution-components-${diagram}.mmd -o agentic-solution-components-${diagram}.png -b transparent -p puppeteer-config.json -w 2400; \
|
|
109
|
+
done && \
|
|
110
|
+
rm puppeteer-config.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**IMPORTANT**:
|
|
114
|
+
- Always use `-p puppeteer-config.json` flag, NOT `--no-sandbox` directly (mmdc doesn't recognize it)
|
|
115
|
+
- Create puppeteer-config.json before running mmdc, then clean it up afterward
|
|
116
|
+
- All diagrams should use `%%{init: {'theme':'neutral'}}%%` in the Mermaid source
|
|
117
|
+
- Use `-b transparent` for transparent backgrounds
|
|
118
|
+
- Use `-w 2400` for high-resolution output
|
|
119
|
+
|
|
120
|
+
### Diagram Numbering Convention
|
|
121
|
+
|
|
122
|
+
All diagrams within a document should be numbered with two-digit prefixes (01, 02, 03, etc.) in the order they appear in the document. This ensures diagrams are easily referenced and maintained in proper sequence.
|
|
123
|
+
|
|
124
|
+
**Naming pattern:**
|
|
125
|
+
```
|
|
126
|
+
<document-name>-<NN>-<diagram-name>.mmd
|
|
127
|
+
<document-name>-<NN>-<diagram-name>.png
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Example:**
|
|
131
|
+
```
|
|
132
|
+
agentic-solution-components-01-success-factors.mmd
|
|
133
|
+
agentic-solution-components-01-success-factors.png
|
|
134
|
+
agentic-solution-components-02-knowledge-graph.mmd
|
|
135
|
+
agentic-solution-components-02-knowledge-graph.png
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**When adding new diagrams:**
|
|
139
|
+
- Determine the diagram's position in the document flow
|
|
140
|
+
- Assign the next sequential two-digit number
|
|
141
|
+
- If inserting a diagram between existing ones, renumber subsequent diagrams
|
|
142
|
+
|
|
143
|
+
<!-- #endregion -->
|
|
144
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# Journal
|
|
2
|
+
|
|
3
|
+
1. **Task - JupyterLab DOCX Reader Extension**: Implement JupyterLab extension to open and view DOCX files in the browser<br>
|
|
4
|
+
**Result**: Created full-featured extension that converts DOCX files to PDF on-the-fly. Used python-docx and reportlab for pure Python conversion (no system dependencies). Implemented server-side API handler for document conversion with base64 encoding for transmission. Frontend displays PDF using embed tag for better browser compatibility. Supports paragraphs, headings, and tables with proper formatting. Includes comprehensive error handling with detailed tracebacks. Added debug and info level logging on server side for monitoring.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(make:*)",
|
|
5
|
+
"Bash(jupyter server extension:*)",
|
|
6
|
+
"Bash(jupyter labextension:*)",
|
|
7
|
+
"Read(//var/log/**)",
|
|
8
|
+
"Bash(pip install:*)",
|
|
9
|
+
"Bash(pip show:*)",
|
|
10
|
+
"Bash(python:*)",
|
|
11
|
+
"Bash(git add:*)",
|
|
12
|
+
"Bash(git reset:*)",
|
|
13
|
+
"Bash(git commit:*)",
|
|
14
|
+
"Bash(git push:*)"
|
|
15
|
+
],
|
|
16
|
+
"deny": [],
|
|
17
|
+
"ask": []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
|
2
|
+
_commit: v4.4.0
|
|
3
|
+
_src_path: https://github.com/jupyterlab/extension-template
|
|
4
|
+
author_email: konrad.jelen@gmail.com
|
|
5
|
+
author_name: Stellars Henson
|
|
6
|
+
has_binder: false
|
|
7
|
+
has_settings: false
|
|
8
|
+
kind: frontend-and-server
|
|
9
|
+
labextension_name: jupyterlab_doc_reader_extension
|
|
10
|
+
project_short_description: Jupyterlab extension that allows reading of the docx documents
|
|
11
|
+
python_name: jupyterlab_doc_reader_extension
|
|
12
|
+
repository: ''
|
|
13
|
+
test: true
|
|
14
|
+
|
|
@@ -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
|
+
jupyterlab_doc_reader_extension/labextension
|
|
11
|
+
# Version file is handled by hatchling
|
|
12
|
+
jupyterlab_doc_reader_extension/_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 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Stellars Henson
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
.PHONY: build install clean uninstall publish dependencies mrproper increment_version install_dependencies help
|
|
2
|
+
.DEFAULT_GOAL := help
|
|
3
|
+
|
|
4
|
+
# Read current version from package.json (only if node is available)
|
|
5
|
+
VERSION := $(shell command -v node >/dev/null 2>&1 && node -p "require('./package.json').version" || echo "0.0.0")
|
|
6
|
+
|
|
7
|
+
## increment project version
|
|
8
|
+
increment_version:
|
|
9
|
+
@echo "Current version: $(VERSION)"
|
|
10
|
+
@bash -c 'CURRENT_VERSION=$(VERSION); \
|
|
11
|
+
IFS="." read -r major minor patch <<< "$$CURRENT_VERSION"; \
|
|
12
|
+
NEW_PATCH=$$((patch + 1)); \
|
|
13
|
+
NEW_VERSION="$$major.$$minor.$$NEW_PATCH"; \
|
|
14
|
+
echo "New version: $$NEW_VERSION"; \
|
|
15
|
+
sed -i "s/\"version\": \"$$CURRENT_VERSION\"/\"version\": \"$$NEW_VERSION\"/" package.json; '
|
|
16
|
+
|
|
17
|
+
## build packages
|
|
18
|
+
build: clean increment_version
|
|
19
|
+
npm install
|
|
20
|
+
yarn install
|
|
21
|
+
python -m build
|
|
22
|
+
|
|
23
|
+
## install package
|
|
24
|
+
install: build
|
|
25
|
+
pip install dist/*.whl --force-reinstall
|
|
26
|
+
|
|
27
|
+
## clean builds and installables
|
|
28
|
+
clean: uninstall
|
|
29
|
+
@command -v npm >/dev/null 2>&1 && npm run clean || true
|
|
30
|
+
@command -v npm >/dev/null 2>&1 && npm run clean:labextension || true
|
|
31
|
+
rm -rf dist lib || true
|
|
32
|
+
|
|
33
|
+
## uninstall package
|
|
34
|
+
uninstall:
|
|
35
|
+
pip uninstall -y dist/*.whl 2>/dev/null || true
|
|
36
|
+
|
|
37
|
+
## publish package to public repository
|
|
38
|
+
publish: install
|
|
39
|
+
twine upload dist/*
|
|
40
|
+
|
|
41
|
+
## install all required build dependencies
|
|
42
|
+
install_dependencies:
|
|
43
|
+
conda install -y nodejs yarn --update-all
|
|
44
|
+
pip install twine
|
|
45
|
+
|
|
46
|
+
## cleanup all build and metabuild artefacts
|
|
47
|
+
mrproper: clean uninstall
|
|
48
|
+
rm -rf node_modules .yarn || true
|
|
49
|
+
|
|
50
|
+
## prints the list of available commands
|
|
51
|
+
help:
|
|
52
|
+
@echo ""
|
|
53
|
+
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
|
|
54
|
+
@sed -n -e "/^## / { \
|
|
55
|
+
h; \
|
|
56
|
+
s/.*//; \
|
|
57
|
+
:doc" \
|
|
58
|
+
-e "H; \
|
|
59
|
+
n; \
|
|
60
|
+
s/^## //; \
|
|
61
|
+
t doc" \
|
|
62
|
+
-e "s/:.*//; \
|
|
63
|
+
G; \
|
|
64
|
+
s/\\n## /---/; \
|
|
65
|
+
s/\\n/ /g; \
|
|
66
|
+
p; \
|
|
67
|
+
}" ${MAKEFILE_LIST} \
|
|
68
|
+
| LC_ALL='C' sort --ignore-case \
|
|
69
|
+
| awk -F '---' \
|
|
70
|
+
-v ncol=$$(tput cols) \
|
|
71
|
+
-v indent=19 \
|
|
72
|
+
-v col_on="$$(tput setaf 6)" \
|
|
73
|
+
-v col_off="$$(tput sgr0)" \
|
|
74
|
+
'{ \
|
|
75
|
+
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
|
|
76
|
+
n = split($$2, words, " "); \
|
|
77
|
+
line_length = ncol - indent; \
|
|
78
|
+
for (i = 1; i <= n; i++) { \
|
|
79
|
+
line_length -= length(words[i]) + 1; \
|
|
80
|
+
if (line_length <= 0) { \
|
|
81
|
+
line_length = ncol - indent - length(words[i]) - 1; \
|
|
82
|
+
printf "\n%*s ", -indent, " "; \
|
|
83
|
+
} \
|
|
84
|
+
printf "%s ", words[i]; \
|
|
85
|
+
} \
|
|
86
|
+
printf "\n"; \
|
|
87
|
+
}'
|
|
88
|
+
@echo ""
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# EOF
|
|
92
|
+
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jupyterlab_doc_reader_extension
|
|
3
|
+
Version: 0.5.37
|
|
4
|
+
Summary: Jupyterlab extension that allows reading of the docx documents
|
|
5
|
+
Project-URL: Homepage, https://github.com/stellarshenson/jupyterlab_doc_reader_extension.git
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/stellarshenson/jupyterlab_doc_reader_extension/issues
|
|
7
|
+
Project-URL: Repository, https://github.com/stellarshenson/jupyterlab_doc_reader_extension.git
|
|
8
|
+
Author-email: Stellars Henson <konrad.jelen@gmail.com>
|
|
9
|
+
License: BSD 3-Clause License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2025, Stellars Henson
|
|
12
|
+
All rights reserved.
|
|
13
|
+
|
|
14
|
+
Redistribution and use in source and binary forms, with or without
|
|
15
|
+
modification, are permitted provided that the following conditions are met:
|
|
16
|
+
|
|
17
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
18
|
+
list of conditions and the following disclaimer.
|
|
19
|
+
|
|
20
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
21
|
+
this list of conditions and the following disclaimer in the documentation
|
|
22
|
+
and/or other materials provided with the distribution.
|
|
23
|
+
|
|
24
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
25
|
+
contributors may be used to endorse or promote products derived from
|
|
26
|
+
this software without specific prior written permission.
|
|
27
|
+
|
|
28
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
29
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
30
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
31
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
32
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
33
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
34
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
35
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
36
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
37
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
38
|
+
License-File: LICENSE
|
|
39
|
+
Keywords: jupyter,jupyterlab,jupyterlab-extension
|
|
40
|
+
Classifier: Framework :: Jupyter
|
|
41
|
+
Classifier: Framework :: Jupyter :: JupyterLab
|
|
42
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: 4
|
|
43
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
|
|
44
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
|
|
45
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
46
|
+
Classifier: Programming Language :: Python
|
|
47
|
+
Classifier: Programming Language :: Python :: 3
|
|
48
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
50
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
51
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
52
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
53
|
+
Requires-Python: >=3.9
|
|
54
|
+
Requires-Dist: python-docx>=1.0.0
|
|
55
|
+
Requires-Dist: reportlab>=4.0.0
|
|
56
|
+
Provides-Extra: test
|
|
57
|
+
Requires-Dist: coverage; extra == 'test'
|
|
58
|
+
Requires-Dist: pytest; extra == 'test'
|
|
59
|
+
Requires-Dist: pytest-asyncio; extra == 'test'
|
|
60
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
61
|
+
Requires-Dist: pytest-jupyter[server]>=0.6.0; extra == 'test'
|
|
62
|
+
Description-Content-Type: text/markdown
|
|
63
|
+
|
|
64
|
+
# JupyterLab Document Reader Extension
|
|
65
|
+
|
|
66
|
+
[](/actions/workflows/build.yml)
|
|
67
|
+
|
|
68
|
+
A JupyterLab extension that allows viewing Microsoft Word documents (DOCX, DOC) and Rich Text Format (RTF) files directly in JupyterLab. The extension automatically converts documents to PDF on-the-fly for seamless viewing without creating persistent files.
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- View DOCX, DOC, and RTF files directly in JupyterLab
|
|
73
|
+
- Automatic conversion to PDF for display (no temporary files created in your workspace)
|
|
74
|
+
- Native PDF rendering in the browser
|
|
75
|
+
- Read-only mode to prevent accidental modifications
|
|
76
|
+
- Clean, integrated interface matching JupyterLab's design
|
|
77
|
+
|
|
78
|
+
## Architecture
|
|
79
|
+
|
|
80
|
+
This extension consists of:
|
|
81
|
+
- **Python server extension**: Handles document-to-PDF conversion using pure Python libraries (mammoth + weasyprint)
|
|
82
|
+
- **TypeScript frontend extension**: Provides the document viewer widget and file type registration
|
|
83
|
+
|
|
84
|
+
## Requirements
|
|
85
|
+
|
|
86
|
+
- JupyterLab >= 4.0.0
|
|
87
|
+
- Python >= 3.9
|
|
88
|
+
- No external system dependencies required (pure Python solution)
|
|
89
|
+
|
|
90
|
+
## Install
|
|
91
|
+
|
|
92
|
+
Simply install the extension with pip:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install jupyterlab_doc_reader_extension
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
All required Python dependencies (mammoth, weasyprint) will be installed automatically.
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
Once installed, simply click on any `.docx`, `.doc`, or `.rtf` file in the JupyterLab file browser. The extension will automatically:
|
|
103
|
+
1. Convert the document to PDF on the server
|
|
104
|
+
2. Stream the PDF to your browser
|
|
105
|
+
3. Display it in a dedicated viewer tab
|
|
106
|
+
|
|
107
|
+
No temporary files are created in your workspace - the conversion happens in memory on the server side.
|
|
108
|
+
|
|
109
|
+
## Uninstall
|
|
110
|
+
|
|
111
|
+
To remove the extension, execute:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pip uninstall jupyterlab_doc_reader_extension
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Troubleshoot
|
|
118
|
+
|
|
119
|
+
If you are seeing the frontend extension, but it is not working, check
|
|
120
|
+
that the server extension is enabled:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
jupyter server extension list
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If the server extension is installed and enabled, but you are not seeing
|
|
127
|
+
the frontend extension, check the frontend extension is installed:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
jupyter labextension list
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Contributing
|
|
134
|
+
|
|
135
|
+
### Development install
|
|
136
|
+
|
|
137
|
+
Note: You will need NodeJS to build the extension package.
|
|
138
|
+
|
|
139
|
+
The `jlpm` command is JupyterLab's pinned version of
|
|
140
|
+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
|
|
141
|
+
`yarn` or `npm` in lieu of `jlpm` below.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Clone the repo to your local environment
|
|
145
|
+
# Change directory to the jupyterlab_doc_reader_extension directory
|
|
146
|
+
# Install package in development mode
|
|
147
|
+
pip install -e ".[test]"
|
|
148
|
+
# Link your development version of the extension with JupyterLab
|
|
149
|
+
jupyter labextension develop . --overwrite
|
|
150
|
+
# Server extension must be manually installed in develop mode
|
|
151
|
+
jupyter server extension enable jupyterlab_doc_reader_extension
|
|
152
|
+
# Rebuild extension Typescript source after making changes
|
|
153
|
+
jlpm build
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Watch the source directory in one terminal, automatically rebuilding when needed
|
|
160
|
+
jlpm watch
|
|
161
|
+
# Run JupyterLab in another terminal
|
|
162
|
+
jupyter lab
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
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).
|
|
166
|
+
|
|
167
|
+
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:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
jupyter lab build --minimize=False
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Development uninstall
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Server extension must be manually disabled in develop mode
|
|
177
|
+
jupyter server extension disable jupyterlab_doc_reader_extension
|
|
178
|
+
pip uninstall jupyterlab_doc_reader_extension
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
|
|
182
|
+
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
|
|
183
|
+
folder is located. Then you can remove the symlink named `jupyterlab_doc_reader_extension` within that folder.
|
|
184
|
+
|
|
185
|
+
### Testing the extension
|
|
186
|
+
|
|
187
|
+
#### Server tests
|
|
188
|
+
|
|
189
|
+
This extension is using [Pytest](https://docs.pytest.org/) for Python code testing.
|
|
190
|
+
|
|
191
|
+
Install test dependencies (needed only once):
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
pip install -e ".[test]"
|
|
195
|
+
# Each time you install the Python package, you need to restore the front-end extension link
|
|
196
|
+
jupyter labextension develop . --overwrite
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
To execute them, run:
|
|
200
|
+
|
|
201
|
+
```sh
|
|
202
|
+
pytest -vv -r ap --cov jupyterlab_doc_reader_extension
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### Frontend tests
|
|
206
|
+
|
|
207
|
+
This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
|
|
208
|
+
|
|
209
|
+
To execute them, execute:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
jlpm
|
|
213
|
+
jlpm test
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### Integration tests
|
|
217
|
+
|
|
218
|
+
This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
|
|
219
|
+
More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
|
|
220
|
+
|
|
221
|
+
More information are provided within the [ui-tests](./ui-tests/README.md) README.
|
|
222
|
+
|
|
223
|
+
### Packaging the extension
|
|
224
|
+
|
|
225
|
+
See [RELEASE](RELEASE.md)
|