nbsync 0.0.1__tar.gz → 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.
- nbsync-0.1.0/.devcontainer/devcontainer.json +19 -0
- nbsync-0.1.0/.devcontainer/postCreate.sh +8 -0
- nbsync-0.1.0/.devcontainer/starship.toml +29 -0
- nbsync-0.1.0/.gitattributes +3 -0
- nbsync-0.1.0/.github/workflows/ci.yaml +51 -0
- nbsync-0.1.0/.github/workflows/docs.yaml +29 -0
- nbsync-0.1.0/.github/workflows/publish.yaml +37 -0
- nbsync-0.1.0/LICENSE +21 -0
- nbsync-0.1.0/PKG-INFO +177 -0
- nbsync-0.1.0/README.md +132 -0
- nbsync-0.1.0/docs/index.md +101 -0
- nbsync-0.1.0/docs-gen/examples/advanced.md +256 -0
- nbsync-0.1.0/docs-gen/examples/basic.md +151 -0
- nbsync-0.1.0/docs-gen/examples/tables.md +143 -0
- nbsync-0.1.0/docs-gen/features/dynamic.md +127 -0
- nbsync-0.1.0/docs-gen/features/images.md +112 -0
- nbsync-0.1.0/docs-gen/features/markdown.md +134 -0
- nbsync-0.1.0/docs-gen/features/overview.md +62 -0
- nbsync-0.1.0/docs-gen/features/python.md +118 -0
- nbsync-0.1.0/docs-gen/getting-started/configuration.md +151 -0
- nbsync-0.1.0/docs-gen/getting-started/first-steps.md +199 -0
- nbsync-0.1.0/docs-gen/getting-started/installation.md +99 -0
- nbsync-0.1.0/docs-gen/usage/execution.md +211 -0
- nbsync-0.1.0/docs-gen/usage/markdown-files.md +203 -0
- nbsync-0.1.0/docs-gen/usage/notebook.md +162 -0
- nbsync-0.1.0/docs-gen/usage/python-files.md +172 -0
- nbsync-0.1.0/docs-gen/usage/tabbed-display.md +247 -0
- nbsync-0.1.0/docs-old/examples/format.md +35 -0
- nbsync-0.1.0/docs-old/examples/html.md +15 -0
- nbsync-0.1.0/docs-old/index.md +122 -0
- nbsync-0.1.0/docs-old/usage/class.md +147 -0
- nbsync-0.1.0/docs-old/usage/execute.md +100 -0
- nbsync-0.1.0/docs-old/usage/notebook.md +159 -0
- nbsync-0.1.0/mkdocs.yaml +86 -0
- nbsync-0.1.0/notebooks/class.ipynb +70 -0
- nbsync-0.1.0/notebooks/format/html.ipynb +136 -0
- nbsync-0.1.0/notebooks/format/pdf.ipynb +71 -0
- nbsync-0.1.0/notebooks/format/png.ipynb +59 -0
- nbsync-0.1.0/notebooks/format/svg.ipynb +442 -0
- nbsync-0.1.0/notebooks/image.ipynb +83 -0
- nbsync-0.1.0/notebooks/index.ipynb +59 -0
- nbsync-0.1.0/pyproject.toml +90 -0
- nbsync-0.1.0/scripts/plot.py +15 -0
- nbsync-0.1.0/src/nbsync/cell.py +113 -0
- nbsync-0.1.0/src/nbsync/logger.py +5 -0
- nbsync-0.1.0/src/nbsync/markdown.py +112 -0
- nbsync-0.1.0/src/nbsync/notebook.py +39 -0
- nbsync-0.1.0/src/nbsync/plugin.py +96 -0
- nbsync-0.1.0/src/nbsync/sync.py +121 -0
- nbsync-0.1.0/tests/__init__.py +0 -0
- nbsync-0.1.0/tests/conftest.py +7 -0
- nbsync-0.1.0/tests/test_cell.py +103 -0
- nbsync-0.1.0/tests/test_markdown.py +269 -0
- nbsync-0.1.0/tests/test_notebook.py +49 -0
- nbsync-0.1.0/tests/test_plugin.py +108 -0
- nbsync-0.1.0/tests/test_sync.py +162 -0
- nbsync-0.0.1/LICENSE +0 -9
- nbsync-0.0.1/PKG-INFO +0 -29
- nbsync-0.0.1/README.md +0 -1
- nbsync-0.0.1/pyproject.toml +0 -108
- {nbsync-0.0.1 → nbsync-0.1.0}/.gitignore +0 -0
- {nbsync-0.0.1/src/nbsync → nbsync-0.1.0/scripts}/__init__.py +0 -0
- {nbsync-0.0.1/tests → nbsync-0.1.0/src/nbsync}/__init__.py +0 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu24.04",
|
3
|
+
"features": {
|
4
|
+
"ghcr.io/devcontainers-contrib/features/starship:1": {}
|
5
|
+
},
|
6
|
+
"customizations": {
|
7
|
+
"vscode": {
|
8
|
+
"extensions": [
|
9
|
+
"charliermarsh.ruff",
|
10
|
+
"fill-labs.dependi",
|
11
|
+
"markis.code-coverage",
|
12
|
+
"ms-python.python",
|
13
|
+
"ms-python.vscode-pylance",
|
14
|
+
"tamasfe.even-better-toml"
|
15
|
+
]
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"postCreateCommand": ".devcontainer/postCreate.sh"
|
19
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"$schema" = 'https://starship.rs/config-schema.json'
|
2
|
+
|
3
|
+
add_newline = true
|
4
|
+
|
5
|
+
[username]
|
6
|
+
disabled = true
|
7
|
+
|
8
|
+
[hostname]
|
9
|
+
disabled = true
|
10
|
+
|
11
|
+
[package]
|
12
|
+
format = '[$symbol$version]($style) '
|
13
|
+
symbol = " "
|
14
|
+
style = 'bold blue'
|
15
|
+
|
16
|
+
[git_branch]
|
17
|
+
format = '[$symbol$branch(:$remote_branch)]($style)'
|
18
|
+
symbol = ' '
|
19
|
+
style = 'bold green'
|
20
|
+
|
21
|
+
[git_status]
|
22
|
+
style = 'red'
|
23
|
+
modified = '*'
|
24
|
+
format = '([$modified]($style)) '
|
25
|
+
|
26
|
+
[python]
|
27
|
+
format = '[${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
|
28
|
+
symbol = ' '
|
29
|
+
style = 'yellow'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [main]
|
6
|
+
pull_request:
|
7
|
+
|
8
|
+
concurrency:
|
9
|
+
group: test-${{ github.head_ref }}
|
10
|
+
cancel-in-progress: true
|
11
|
+
|
12
|
+
env:
|
13
|
+
PYTHONUNBUFFERED: "1"
|
14
|
+
FORCE_COLOR: "1"
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
run:
|
18
|
+
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
|
19
|
+
runs-on: ${{ matrix.os }}
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
24
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
25
|
+
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v4
|
28
|
+
- name: Set up Python ${{ matrix.python-version }}
|
29
|
+
uses: actions/setup-python@v5
|
30
|
+
with:
|
31
|
+
python-version: ${{ matrix.python-version }}
|
32
|
+
allow-prereleases: true
|
33
|
+
- name: Install uv and ruff
|
34
|
+
run: pip install uv ruff
|
35
|
+
- name: Install the project
|
36
|
+
run: uv sync
|
37
|
+
- name: Ruff check
|
38
|
+
run: ruff check
|
39
|
+
- name: Run test
|
40
|
+
run: uv run pytest -v --junitxml=junit.xml
|
41
|
+
- name: Upload Codecov Results
|
42
|
+
if: success()
|
43
|
+
uses: codecov/codecov-action@v4
|
44
|
+
with:
|
45
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
46
|
+
file: lcov.info
|
47
|
+
- name: Upload test results to Codecov
|
48
|
+
if: ${{ !cancelled() }}
|
49
|
+
uses: codecov/test-results-action@v1
|
50
|
+
with:
|
51
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Documentation
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [main]
|
6
|
+
tags:
|
7
|
+
- "[0-9]+.[0-9]+.[0-9]+"
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
docs:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
permissions:
|
13
|
+
contents: write
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v4
|
16
|
+
- name: Configure Git Credentials
|
17
|
+
run: |
|
18
|
+
git config user.name github-actions[bot]
|
19
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
20
|
+
- name: Set up Python 3.13
|
21
|
+
uses: actions/setup-python@v5
|
22
|
+
with:
|
23
|
+
python-version: 3.13
|
24
|
+
- name: Install uv
|
25
|
+
run: pip install uv
|
26
|
+
- name: Install the project
|
27
|
+
run: uv sync
|
28
|
+
- name: Deploy documentation
|
29
|
+
run: uv run mkdocs gh-deploy --force
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- "[0-9]+.[0-9]+.[0-9]+"
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
publish:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
id-token: write
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v4
|
15
|
+
|
16
|
+
- name: Verify version match
|
17
|
+
run: |
|
18
|
+
TAG=${GITHUB_REF#refs/tags/}
|
19
|
+
PYPROJECT_VERSION=$(grep -m 1 "version = " pyproject.toml | cut -d'"' -f2)
|
20
|
+
if [ "$TAG" != "$PYPROJECT_VERSION" ]; then
|
21
|
+
echo "Error: Git tag ($TAG) does not match pyproject.toml version ($PYPROJECT_VERSION)"
|
22
|
+
exit 1
|
23
|
+
fi
|
24
|
+
echo "Version verified: $TAG"
|
25
|
+
|
26
|
+
- name: Set up Python
|
27
|
+
uses: actions/setup-python@v5
|
28
|
+
with:
|
29
|
+
python-version: 3.13
|
30
|
+
- name: Install uv
|
31
|
+
run: pip install uv
|
32
|
+
- name: Install the project
|
33
|
+
run: uv sync
|
34
|
+
- name: Build the project
|
35
|
+
run: uv build --no-sources
|
36
|
+
- name: Upload the project to PyPI
|
37
|
+
run: uv publish
|
nbsync-0.1.0/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Daizu
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
nbsync-0.1.0/PKG-INFO
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: nbsync
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: MkDocs plugin treating Jupyter notebooks, Python scripts and Markdown files as first-class citizens for documentation with dynamic execution and real-time synchronization
|
5
|
+
Project-URL: Documentation, https://daizutabi.github.io/nbsync/
|
6
|
+
Project-URL: Source, https://github.com/daizutabi/nbsync
|
7
|
+
Project-URL: Issues, https://github.com/daizutabi/nbsync/issues
|
8
|
+
Author-email: daizutabi <daizutabi@gmail.com>
|
9
|
+
License: MIT License
|
10
|
+
|
11
|
+
Copyright (c) 2025 Daizu
|
12
|
+
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
in the Software without restriction, including without limitation the rights
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
18
|
+
furnished to do so, subject to the following conditions:
|
19
|
+
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
21
|
+
copies or substantial portions of the Software.
|
22
|
+
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
29
|
+
SOFTWARE.
|
30
|
+
License-File: LICENSE
|
31
|
+
Keywords: documentation,dynamic-execution,jupyter,markdown,mkdocs,notebook,python,real-time-sync,visualization
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
33
|
+
Classifier: Programming Language :: Python
|
34
|
+
Classifier: Programming Language :: Python :: 3.10
|
35
|
+
Classifier: Programming Language :: Python :: 3.11
|
36
|
+
Classifier: Programming Language :: Python :: 3.12
|
37
|
+
Classifier: Programming Language :: Python :: 3.13
|
38
|
+
Classifier: Topic :: Documentation
|
39
|
+
Classifier: Topic :: Software Development :: Documentation
|
40
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
41
|
+
Requires-Python: >=3.10
|
42
|
+
Requires-Dist: mkdocs>=1.6
|
43
|
+
Requires-Dist: nbstore>=0.4.7
|
44
|
+
Description-Content-Type: text/markdown
|
45
|
+
|
46
|
+
# nbsync
|
47
|
+
|
48
|
+
[![PyPI Version][pypi-v-image]][pypi-v-link]
|
49
|
+
[![Python Version][python-v-image]][python-v-link]
|
50
|
+
[![Build Status][GHAction-image]][GHAction-link]
|
51
|
+
[![Coverage Status][codecov-image]][codecov-link]
|
52
|
+
|
53
|
+
<strong>Connect Jupyter notebooks to your MkDocs documentation</strong>
|
54
|
+
|
55
|
+
nbsync is a MkDocs plugin that seamlessly embeds Jupyter notebook
|
56
|
+
visualizations in your documentation, solving the disconnect between
|
57
|
+
code development and documentation.
|
58
|
+
|
59
|
+
## Why Use nbsync?
|
60
|
+
|
61
|
+
### The Documentation Challenge
|
62
|
+
|
63
|
+
Data scientists, researchers, and technical writers face a common dilemma:
|
64
|
+
|
65
|
+
- **Development happens in notebooks** - ideal for experimentation and visualization
|
66
|
+
- **Documentation lives in markdown** - perfect for narrative and explanation
|
67
|
+
- **Connecting the two is painful** - screenshots break, exports get outdated
|
68
|
+
|
69
|
+
### Our Solution
|
70
|
+
|
71
|
+
This plugin creates a live bridge between your notebooks and documentation by:
|
72
|
+
|
73
|
+
- **Keeping environments separate** - work in the tool best suited for each task
|
74
|
+
- **Maintaining connections** - reference specific figures from notebooks
|
75
|
+
- **Automating updates** - changes to notebooks reflect in documentation
|
76
|
+
|
77
|
+
## Key Benefits
|
78
|
+
|
79
|
+
- **True Separation of Concerns**:
|
80
|
+
Develop visualizations in Jupyter notebooks and write documentation
|
81
|
+
in markdown files, with each tool optimized for its purpose.
|
82
|
+
|
83
|
+
- **Intuitive Markdown Syntax**:
|
84
|
+
Use standard image syntax with a simple extension to reference
|
85
|
+
notebook figures: `{#figure-id}`
|
86
|
+
|
87
|
+
- **Automatic Updates**:
|
88
|
+
When you modify your notebooks, your documentation updates
|
89
|
+
automatically in MkDocs serve mode.
|
90
|
+
|
91
|
+
- **Clean Source Documents**:
|
92
|
+
Your markdown remains readable and focused on content, without
|
93
|
+
code distractions or complex embedding techniques.
|
94
|
+
|
95
|
+
- **Enhanced Development Experience**:
|
96
|
+
Take advantage of IDE features like code completion and syntax
|
97
|
+
highlighting in the appropriate environment.
|
98
|
+
|
99
|
+
## Quick Start
|
100
|
+
|
101
|
+
### 1. Installation
|
102
|
+
|
103
|
+
```bash
|
104
|
+
pip install nbsync
|
105
|
+
```
|
106
|
+
|
107
|
+
### 2. Configuration
|
108
|
+
|
109
|
+
Add to your `mkdocs.yml`:
|
110
|
+
|
111
|
+
```yaml
|
112
|
+
plugins:
|
113
|
+
- nbsync:
|
114
|
+
src_dir: ../notebooks
|
115
|
+
```
|
116
|
+
|
117
|
+
### 3. Mark Figures in Your Notebook
|
118
|
+
|
119
|
+
In your Jupyter notebook, identify figures with a comment:
|
120
|
+
|
121
|
+
```python
|
122
|
+
# #my-figure
|
123
|
+
import matplotlib.pyplot as plt
|
124
|
+
|
125
|
+
fig, ax = plt.subplots(figsize=(8, 4))
|
126
|
+
ax.plot([1, 2, 3, 4], [10, 20, 25, 30])
|
127
|
+
```
|
128
|
+
|
129
|
+
### 4. Reference in Markdown
|
130
|
+
|
131
|
+
Use standard Markdown image syntax with the figure identifier:
|
132
|
+
|
133
|
+
```markdown
|
134
|
+
{#my-figure}
|
135
|
+
```
|
136
|
+
|
137
|
+
## Advanced Usage
|
138
|
+
|
139
|
+
For more detailed information on how to use nbsync, see:
|
140
|
+
|
141
|
+
- [Notebook Configuration](usage/notebook.md) - Setting up notebook directories
|
142
|
+
- [Class Options](usage/class.md) - Control how notebook content is displayed
|
143
|
+
<!-- - [Workflow Tips](usage/workflow.md) - Best practices for documentation -->
|
144
|
+
|
145
|
+
## The Power of Separation
|
146
|
+
|
147
|
+
Creating documentation and developing visualizations involve different
|
148
|
+
workflows and timeframes. When building visualizations in Jupyter notebooks,
|
149
|
+
you need rapid cycles of execution, verification, and modification.
|
150
|
+
|
151
|
+
This plugin is designed specifically to address these separation of
|
152
|
+
concerns, allowing you to:
|
153
|
+
|
154
|
+
- **Focus on code** in notebooks without documentation distractions
|
155
|
+
- **Focus on narrative** in markdown without code interruptions
|
156
|
+
- **Maintain powerful connections** between both environments
|
157
|
+
|
158
|
+
Each environment is optimized for its purpose, while the plugin
|
159
|
+
handles the integration automatically.
|
160
|
+
|
161
|
+
## Contributing
|
162
|
+
|
163
|
+
Contributions are welcome! Please open an issue or submit a pull request.
|
164
|
+
|
165
|
+
## License
|
166
|
+
|
167
|
+
This project is licensed under the MIT License.
|
168
|
+
|
169
|
+
<!-- Badges -->
|
170
|
+
[pypi-v-image]: https://img.shields.io/pypi/v/nbsync.svg
|
171
|
+
[pypi-v-link]: https://pypi.org/project/nbsync/
|
172
|
+
[python-v-image]: https://img.shields.io/pypi/pyversions/nbsync.svg
|
173
|
+
[python-v-link]: https://pypi.org/project/nbsync
|
174
|
+
[GHAction-image]: https://github.com/daizutabi/nbsync/actions/workflows/ci.yaml/badge.svg?branch=main&event=push
|
175
|
+
[GHAction-link]: https://github.com/daizutabi/nbsync/actions?query=event%3Apush+branch%3Amain
|
176
|
+
[codecov-image]: https://codecov.io/github/daizutabi/nbsync/coverage.svg?branch=main
|
177
|
+
[codecov-link]: https://codecov.io/github/daizutabi/nbsync?branch=main
|
nbsync-0.1.0/README.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# nbsync
|
2
|
+
|
3
|
+
[![PyPI Version][pypi-v-image]][pypi-v-link]
|
4
|
+
[![Python Version][python-v-image]][python-v-link]
|
5
|
+
[![Build Status][GHAction-image]][GHAction-link]
|
6
|
+
[![Coverage Status][codecov-image]][codecov-link]
|
7
|
+
|
8
|
+
<strong>Connect Jupyter notebooks to your MkDocs documentation</strong>
|
9
|
+
|
10
|
+
nbsync is a MkDocs plugin that seamlessly embeds Jupyter notebook
|
11
|
+
visualizations in your documentation, solving the disconnect between
|
12
|
+
code development and documentation.
|
13
|
+
|
14
|
+
## Why Use nbsync?
|
15
|
+
|
16
|
+
### The Documentation Challenge
|
17
|
+
|
18
|
+
Data scientists, researchers, and technical writers face a common dilemma:
|
19
|
+
|
20
|
+
- **Development happens in notebooks** - ideal for experimentation and visualization
|
21
|
+
- **Documentation lives in markdown** - perfect for narrative and explanation
|
22
|
+
- **Connecting the two is painful** - screenshots break, exports get outdated
|
23
|
+
|
24
|
+
### Our Solution
|
25
|
+
|
26
|
+
This plugin creates a live bridge between your notebooks and documentation by:
|
27
|
+
|
28
|
+
- **Keeping environments separate** - work in the tool best suited for each task
|
29
|
+
- **Maintaining connections** - reference specific figures from notebooks
|
30
|
+
- **Automating updates** - changes to notebooks reflect in documentation
|
31
|
+
|
32
|
+
## Key Benefits
|
33
|
+
|
34
|
+
- **True Separation of Concerns**:
|
35
|
+
Develop visualizations in Jupyter notebooks and write documentation
|
36
|
+
in markdown files, with each tool optimized for its purpose.
|
37
|
+
|
38
|
+
- **Intuitive Markdown Syntax**:
|
39
|
+
Use standard image syntax with a simple extension to reference
|
40
|
+
notebook figures: `{#figure-id}`
|
41
|
+
|
42
|
+
- **Automatic Updates**:
|
43
|
+
When you modify your notebooks, your documentation updates
|
44
|
+
automatically in MkDocs serve mode.
|
45
|
+
|
46
|
+
- **Clean Source Documents**:
|
47
|
+
Your markdown remains readable and focused on content, without
|
48
|
+
code distractions or complex embedding techniques.
|
49
|
+
|
50
|
+
- **Enhanced Development Experience**:
|
51
|
+
Take advantage of IDE features like code completion and syntax
|
52
|
+
highlighting in the appropriate environment.
|
53
|
+
|
54
|
+
## Quick Start
|
55
|
+
|
56
|
+
### 1. Installation
|
57
|
+
|
58
|
+
```bash
|
59
|
+
pip install nbsync
|
60
|
+
```
|
61
|
+
|
62
|
+
### 2. Configuration
|
63
|
+
|
64
|
+
Add to your `mkdocs.yml`:
|
65
|
+
|
66
|
+
```yaml
|
67
|
+
plugins:
|
68
|
+
- nbsync:
|
69
|
+
src_dir: ../notebooks
|
70
|
+
```
|
71
|
+
|
72
|
+
### 3. Mark Figures in Your Notebook
|
73
|
+
|
74
|
+
In your Jupyter notebook, identify figures with a comment:
|
75
|
+
|
76
|
+
```python
|
77
|
+
# #my-figure
|
78
|
+
import matplotlib.pyplot as plt
|
79
|
+
|
80
|
+
fig, ax = plt.subplots(figsize=(8, 4))
|
81
|
+
ax.plot([1, 2, 3, 4], [10, 20, 25, 30])
|
82
|
+
```
|
83
|
+
|
84
|
+
### 4. Reference in Markdown
|
85
|
+
|
86
|
+
Use standard Markdown image syntax with the figure identifier:
|
87
|
+
|
88
|
+
```markdown
|
89
|
+
{#my-figure}
|
90
|
+
```
|
91
|
+
|
92
|
+
## Advanced Usage
|
93
|
+
|
94
|
+
For more detailed information on how to use nbsync, see:
|
95
|
+
|
96
|
+
- [Notebook Configuration](usage/notebook.md) - Setting up notebook directories
|
97
|
+
- [Class Options](usage/class.md) - Control how notebook content is displayed
|
98
|
+
<!-- - [Workflow Tips](usage/workflow.md) - Best practices for documentation -->
|
99
|
+
|
100
|
+
## The Power of Separation
|
101
|
+
|
102
|
+
Creating documentation and developing visualizations involve different
|
103
|
+
workflows and timeframes. When building visualizations in Jupyter notebooks,
|
104
|
+
you need rapid cycles of execution, verification, and modification.
|
105
|
+
|
106
|
+
This plugin is designed specifically to address these separation of
|
107
|
+
concerns, allowing you to:
|
108
|
+
|
109
|
+
- **Focus on code** in notebooks without documentation distractions
|
110
|
+
- **Focus on narrative** in markdown without code interruptions
|
111
|
+
- **Maintain powerful connections** between both environments
|
112
|
+
|
113
|
+
Each environment is optimized for its purpose, while the plugin
|
114
|
+
handles the integration automatically.
|
115
|
+
|
116
|
+
## Contributing
|
117
|
+
|
118
|
+
Contributions are welcome! Please open an issue or submit a pull request.
|
119
|
+
|
120
|
+
## License
|
121
|
+
|
122
|
+
This project is licensed under the MIT License.
|
123
|
+
|
124
|
+
<!-- Badges -->
|
125
|
+
[pypi-v-image]: https://img.shields.io/pypi/v/nbsync.svg
|
126
|
+
[pypi-v-link]: https://pypi.org/project/nbsync/
|
127
|
+
[python-v-image]: https://img.shields.io/pypi/pyversions/nbsync.svg
|
128
|
+
[python-v-link]: https://pypi.org/project/nbsync
|
129
|
+
[GHAction-image]: https://github.com/daizutabi/nbsync/actions/workflows/ci.yaml/badge.svg?branch=main&event=push
|
130
|
+
[GHAction-link]: https://github.com/daizutabi/nbsync/actions?query=event%3Apush+branch%3Amain
|
131
|
+
[codecov-image]: https://codecov.io/github/daizutabi/nbsync/coverage.svg?branch=main
|
132
|
+
[codecov-link]: https://codecov.io/github/daizutabi/nbsync?branch=main
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# nbsync
|
2
|
+
|
3
|
+
<div class="grid cards" markdown>
|
4
|
+
|
5
|
+
- :material-notebook-edit: **Notebooks from Markdown**
|
6
|
+
Extend standard markdown syntax to automatically generate notebooks from
|
7
|
+
documentation
|
8
|
+
[:octicons-arrow-right-24: Markdown Features](#notebooks-from-markdown)
|
9
|
+
|
10
|
+
- :material-language-python: **Python File Integration**
|
11
|
+
Directly reference external Python files and reuse functions or classes
|
12
|
+
[:octicons-arrow-right-24: Python Integration](#python-file-integration)
|
13
|
+
|
14
|
+
- :material-image-edit: **Code Execution in Images**
|
15
|
+
Execute code within image notation for dynamic visualizations
|
16
|
+
[:octicons-arrow-right-24: Dynamic Visualization](#code-execution-in-images)
|
17
|
+
|
18
|
+
- :material-refresh-auto: **Dynamic Updates**
|
19
|
+
Real-time synchronization between notebooks and documentation
|
20
|
+
[:octicons-arrow-right-24: Dynamic Updates](#dynamic-updates-and-execution)
|
21
|
+
|
22
|
+
</div>
|
23
|
+
|
24
|
+
## What is nbsync?
|
25
|
+
|
26
|
+
nbsync is an innovative plugin that seamlessly connects Jupyter notebooks with
|
27
|
+
MkDocs documentation. Going beyond traditional notebook integration, it provides
|
28
|
+
functionality to generate and execute notebooks directly from markdown (.md)
|
29
|
+
files and Python (.py) files.
|
30
|
+
|
31
|
+
It solves common challenges faced by data scientists, researchers, and technical
|
32
|
+
writers:
|
33
|
+
|
34
|
+
- **Development happens in notebooks** - ideal for experimentation and visualization
|
35
|
+
- **Documentation lives in markdown** - perfect for narrative and explanation
|
36
|
+
- **Traditional integration is challenging** - screenshots break, exports get outdated
|
37
|
+
|
38
|
+
## Key Features
|
39
|
+
|
40
|
+
### Notebooks from Markdown
|
41
|
+
|
42
|
+
Extend standard markdown syntax to define notebook cells within your
|
43
|
+
documentation. Present code and its output results concisely with tabbed
|
44
|
+
display.
|
45
|
+
|
46
|
+
````markdown source="tabbed-nbsync"
|
47
|
+
```python .md#plot source="on"
|
48
|
+
import matplotlib.pyplot as plt
|
49
|
+
|
50
|
+
fig, ax = plt.subplots(figsize=(2, 1))
|
51
|
+
ax.plot([1, 3, 3, 4])
|
52
|
+
```
|
53
|
+
|
54
|
+
![Plot result](){#plot source="on"}
|
55
|
+
````
|
56
|
+
|
57
|
+
### Python File Integration
|
58
|
+
|
59
|
+
Directly reference external Python files and reuse defined functions or classes.
|
60
|
+
Avoid code duplication and improve maintainability.
|
61
|
+
|
62
|
+
```python title="plot.py"
|
63
|
+
--8<-- "scripts/plot.py"
|
64
|
+
```
|
65
|
+
|
66
|
+
```markdown source="tabbed-nbsync"
|
67
|
+
{#sqrt source="on"}
|
68
|
+
```
|
69
|
+
|
70
|
+
### Code Execution in Images
|
71
|
+
|
72
|
+
Execute Python code directly within image notation and display the results.
|
73
|
+
This enables easy placement of dynamic visualizations in tables or complex
|
74
|
+
layouts.
|
75
|
+
|
76
|
+
```markdown source="tabbed-nbsync"
|
77
|
+
| Sine | Cosine |
|
78
|
+
| :-------------------: | :-------------------: |
|
79
|
+
| ![](){`plot(np.sin)`} | ![](){`plot(np.cos)`} |
|
80
|
+
```
|
81
|
+
|
82
|
+
### Dynamic Updates and Execution
|
83
|
+
|
84
|
+
Automatic synchronization between notebooks and documentation ensures code
|
85
|
+
changes are reflected in real-time. View changes instantly in MkDocs serve mode.
|
86
|
+
|
87
|
+
## Getting Started
|
88
|
+
|
89
|
+
Follow these steps to get started with nbsync:
|
90
|
+
|
91
|
+
1. [Installation](getting-started/installation.md)
|
92
|
+
2. [Configuration](getting-started/configuration.md)
|
93
|
+
3. [First Steps](getting-started/first-steps.md)
|
94
|
+
|
95
|
+
## Examples
|
96
|
+
|
97
|
+
Explore the possibilities of nbsync through practical examples:
|
98
|
+
|
99
|
+
- [Basic Usage](examples/basic.md)
|
100
|
+
- [Visualizations in Tables](examples/tables.md)
|
101
|
+
- [Advanced Examples](examples/advanced.md)
|