Metadata-Version: 2.4
Name: nbsync
Version: 0.3.1
Summary: A core library to synchronize Jupyter notebooks and Markdown documents, enabling seamless integration and dynamic content execution
Project-URL: Documentation, https://daizutabi.github.io/nbsync/
Project-URL: Source, https://github.com/daizutabi/nbsync
Project-URL: Issues, https://github.com/daizutabi/nbsync/issues
Author-email: daizutabi <daizutabi@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Daizu
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: documentation,dynamic-execution,jupyter,markdown,notebook,python,real-time-sync,visualization
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Documentation
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Text Processing :: Markup :: Markdown
Requires-Python: >=3.10
Requires-Dist: nbstore>=0.4.11
Description-Content-Type: text/markdown

# nbsync

[![PyPI Version][pypi-v-image]][pypi-v-link]
[![Python Version][python-v-image]][python-v-link]
[![Build Status][GHAction-image]][GHAction-link]
[![Coverage Status][codecov-image]][codecov-link]

<strong>Connect Jupyter notebooks and Markdown documents</strong>

nbsync is a core library that seamlessly bridges Jupyter notebooks and Markdown documents, enabling dynamic content synchronization and execution.

## Why Use nbsync?

### The Documentation Challenge

Data scientists, researchers, and technical writers face a common dilemma:

- **Development happens in notebooks** - ideal for experimentation and visualization
- **Documentation lives in markdown** - perfect for narrative and explanation
- **Connecting the two is painful** - screenshots break, exports get outdated

### Our Solution

nbsync creates a live bridge between your notebooks and markdown documents by:

- **Keeping environments separate** - work in the tool best suited for each task
- **Maintaining connections** - reference specific figures from notebooks
- **Automating updates** - changes to notebooks reflect in documentation

## Key Benefits

- **True Separation of Concerns**:
  Develop visualizations in Jupyter notebooks and write documentation
  in markdown files, with each tool optimized for its purpose.

- **Intuitive Markdown Syntax**:
  Use standard image syntax with a simple extension to reference
  notebook figures: `![alt text](notebook.ipynb){#figure-id}`

- **Automatic Updates**:
  When you modify your notebooks, your documentation updates
  automatically.

- **Clean Source Documents**:
  Your markdown remains readable and focused on content, without
  code distractions or complex embedding techniques.

- **Enhanced Development Experience**:
  Take advantage of IDE features like code completion and syntax
  highlighting in the appropriate environment.

## Quick Start

### 1. Installation

```bash
pip install nbsync
```

### 2. Basic Usage

```python
from nbsync.sync import Synchronizer
from nbstore import Store

# Initialize with a notebook store
store = Store("path/to/notebooks")
sync = Synchronizer(store)

# Process markdown with notebook references
markdown_text = """
# My Document

![Chart description](my-notebook.ipynb){#my-figure}
"""

# Convert markdown with notebook references to final output
for element in sync.convert(markdown_text):
    # Process each element (string or Cell objects)
    print(element)
```

### 3. Mark Figures in Your Notebook

In your Jupyter notebook, identify figures with a comment:

```python
# #my-figure
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(8, 4))
ax.plot([1, 2, 3, 4], [10, 20, 25, 30])
```

### 4. Reference in Markdown

Use standard Markdown image syntax with the figure identifier:

```markdown
![Chart description](my-notebook.ipynb){#my-figure}
```

## The Power of Separation

Creating documentation and developing visualizations involve different
workflows and timeframes. When building visualizations in Jupyter notebooks,
you need rapid cycles of execution, verification, and modification.

nbsync is designed specifically to address these separation of
concerns, allowing you to:

- **Focus on code** in notebooks without documentation distractions
- **Focus on narrative** in markdown without code interruptions
- **Maintain powerful connections** between both environments

Each environment is optimized for its purpose, while nbsync
handles the integration automatically.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## License

This project is licensed under the MIT License.

<!-- Badges -->
[pypi-v-image]: https://img.shields.io/pypi/v/nbsync.svg
[pypi-v-link]: https://pypi.org/project/nbsync/
[python-v-image]: https://img.shields.io/pypi/pyversions/nbsync.svg
[python-v-link]: https://pypi.org/project/nbsync
[GHAction-image]: https://github.com/daizutabi/nbsync/actions/workflows/ci.yaml/badge.svg?branch=main&event=push
[GHAction-link]: https://github.com/daizutabi/nbsync/actions?query=event%3Apush+branch%3Amain
[codecov-image]: https://codecov.io/github/daizutabi/nbsync/coverage.svg?branch=main
[codecov-link]: https://codecov.io/github/daizutabi/nbsync?branch=main
