Metadata-Version: 2.3
Name: noteshift
Version: 0.1.3
Summary: Export Notion pages and databases to Obsidian-friendly Markdown.
Keywords: notion,obsidian,migration,markdown,export
Author: Fragment256
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Utilities
Requires-Dist: httpx>=0.28.1,<0.29
Requires-Dist: python-slugify>=8.0.4,<9
Requires-Dist: typer>=0.24.1,<1
Requires-Dist: mypy>=1.18.1,<2 ; extra == 'dev'
Requires-Dist: pytest>=9.0.2,<10 ; extra == 'dev'
Requires-Dist: pytest-cov>=6.0.0,<7 ; extra == 'dev'
Requires-Dist: pytest-vcr>=1.0.2,<2 ; extra == 'dev'
Requires-Dist: ruff>=0.15.4,<0.16 ; extra == 'dev'
Requires-Dist: pytest>=9.0.2,<10 ; extra == 'test'
Requires-Dist: pytest-cov>=6.0.0,<7 ; extra == 'test'
Requires-Dist: pytest-vcr>=1.0.2,<2 ; extra == 'test'
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/Fragment256/noteshift
Project-URL: Repository, https://github.com/Fragment256/noteshift
Project-URL: Issues, https://github.com/Fragment256/noteshift/issues
Provides-Extra: dev
Provides-Extra: test
Description-Content-Type: text/markdown

# NoteShift (`noteshift`)

**NoteShift** exports Notion content to Obsidian-friendly Markdown with predictable filenames, link rewriting, and checkpoint/resume support.

[![CI](https://github.com/Fragment256/noteshift/actions/workflows/ci.yml/badge.svg)](https://github.com/Fragment256/noteshift/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/noteshift.svg)](https://pypi.org/project/noteshift/)
[![Python Versions](https://img.shields.io/pypi/pyversions/noteshift.svg)](https://pypi.org/project/noteshift/)
[![codecov](https://codecov.io/gh/Fragment256/noteshift/branch/main/graph/badge.svg)](https://codecov.io/gh/Fragment256/noteshift)

## Why it exists

Teams migrating from Notion to Obsidian consistently report four pains:

1. broken internal links after export
2. inconsistent filenames and folder layout
3. long exports failing midway without resume
4. low confidence in migration correctness

NoteShift is focused on solving those pains first.

## Current capabilities

- Export a Notion page tree to Markdown
- Export Notion data sources/databases through API layer
- Rewrite internal links for Obsidian compatibility
- Preserve and download attachments
- Resume interrupted runs via checkpoint file
- Emit migration report (`migration_report.json` + `.md`)

## Documentation

- Docs index: [`docs/`](docs/index.md)
- Start here: [Getting started](docs/getting-started.md)
- Library integration: [API contract](docs/api-contract.md)

## Installation

### Install from PyPI

```bash
uv tool install noteshift
# or
pipx install noteshift
```

### Install from source (development)

```bash
uv tool install .
uv sync --extra dev --extra test
```

## Authentication

Set a Notion integration token in `NOTION_TOKEN`.

```bash
export NOTION_TOKEN="secret_xxx"
```

## Basic usage

```bash
noteshift export \
  --page-id "<notion-page-id>" \
  --out ./export \
  --max-depth 2 \
  --overwrite
```

## Output

A successful run writes:

- Markdown files for exported pages
- downloaded assets in the export tree
- `.checkpoint.json` for resume
- `migration_report.json`
- `migration_report.md`

## Development

```bash
uv sync --extra dev --extra test
uv run ruff format .
uv run ruff check .
uv run mypy src
uv run pytest --cov=noteshift --cov-report=term
```

## Contract tests (`pytest-vcr`)

Contract tests are deterministic and replay HTTP traffic from sanitized cassettes:

```bash
uv run pytest -m contract
```

To re-record cassettes intentionally, set a real token in your environment and run:

```bash
VCR_RECORD_MODE=once uv run pytest -m contract
```

## License

MIT
