Skip to content

Commit 7a0179b

Browse files
committed
fixes #1560
1 parent 322c41b commit 7a0179b

3 files changed

Lines changed: 36 additions & 24 deletions

File tree

README.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55

66
![CI](https://github.com/fastai/nbdev/actions/workflows/test.yaml/badge.svg)
77

8+
## 🛑**Jan 2026 Major Version Update – Breaking Change**🛑
9+
10+
**nbdev3 is here!** As many of you have been requesting, configuration
11+
has moved from `settings.ini` to `pyproject.toml`, following modern
12+
Python packaging standards ([PEP
13+
621](https://peps.python.org/pep-0621/)). Your project metadata now
14+
lives in the standard `[project]` section, while nbdev-specific settings
15+
go in `[tool.nbdev]`.
16+
17+
**Migrating from nbdev2:** Run
18+
[`nbdev_migrate_config`](https://nbdev.fast.ai/api/migrate.html#nbdev_migrate_config)
19+
in your project root to automatically convert your `settings.ini` to
20+
`pyproject.toml` and update your GitHub Actions workflows to use
21+
nbdev3-compatible versions. Your existing notebooks and code don’t need
22+
any changes.
23+
824
`nbdev` is a notebook-driven development platform. Simply write
925
notebooks with lightweight markup and get high-quality documentation,
1026
tests, continuous integration, and packaging for free!
@@ -24,7 +40,10 @@ practices because tests and documentation are first class.
2440
package releases. Python best practices are automatically followed,
2541
for example, only exported objects are included in `__all__`
2642
- **Two-way sync between notebooks and plaintext source code** allowing
27-
you to use your IDE for code navigation or quick edits
43+
you to use your IDE for code navigation or quick edits. Sync is
44+
robust: each exported cell is tagged with its unique notebook cell ID,
45+
so [`nbdev_update`](https://nbdev.fast.ai/api/sync.html#nbdev_update)
46+
always updates the correct cell
2847
- **Tests** written as ordinary notebook cells are run in parallel with
2948
a single command
3049
- **Continuous integration** out-of-the-box with [GitHub
@@ -47,12 +66,6 @@ You can install nbdev with pip:
4766
pip install nbdev
4867
```
4968

50-
… or with conda (or mamba):
51-
52-
``` sh
53-
conda install -c fastai nbdev
54-
```
55-
5669
Note that `nbdev` must be installed into the same Python environment
5770
that you use for both Jupyter and your project.
5871

@@ -79,11 +92,13 @@ available commands:
7992
!nbdev_help
8093
```
8194

82-
nbdev_bump_version Increment version in settings.ini by one
95+
nb_export Export a single nbdev notebook to a python script.
96+
nbdev_bump_version Increment version in __init__.py by one
8397
nbdev_changelog Create a CHANGELOG.md file from closed and labeled GitHub issues
8498
nbdev_clean Clean all notebooks in `fname` to avoid merge conflicts
8599
nbdev_conda Create a `meta.yaml` file ready to be built into a package, and optionally build and upload it
86-
nbdev_create_config Create a config file.
100+
nbdev_contributing Create CONTRIBUTING.md from contributing_nb (defaults to 'contributing.ipynb' if present). Skips if the file doesn't exist.
101+
nbdev_create_config Create a pyproject.toml config file.
87102
nbdev_docs Create Quarto docs and README.md
88103
nbdev_export Export notebooks in `path` to Python modules
89104
nbdev_filter A notebook filter for Quarto
@@ -94,6 +109,7 @@ available commands:
94109
nbdev_install_quarto Install latest Quarto on macOS or Linux, prints instructions for Windows
95110
nbdev_merge Git merge driver for notebooks
96111
nbdev_migrate Convert all markdown and notebook files in `path` from v1 to v2
112+
nbdev_migrate_config Migrate settings.ini to pyproject.toml
97113
nbdev_new Create an nbdev project.
98114
nbdev_prepare Export, test, and clean notebooks, and render README if needed
99115
nbdev_preview Preview docs locally
@@ -103,12 +119,13 @@ available commands:
103119
nbdev_release_both Release both conda and PyPI packages
104120
nbdev_release_gh Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
105121
nbdev_release_git Tag and create a release in GitHub for the current version
106-
nbdev_requirements Writes a `requirements.txt` file to `directory` based on settings.ini.
122+
nbdev_requirements Writes a `requirements.txt` file to `directory` based on pyproject.toml.
107123
nbdev_sidebar Create sidebar.yml
108124
nbdev_test Test in parallel notebooks matching `path`, passing along `flags`
109-
nbdev_trust Trust notebooks matching `fname`
125+
nbdev_trust Trust notebooks matching `fname`.
110126
nbdev_update Propagate change in modules matching `fname` to notebooks that created them
111127
nbdev_update_license Allows you to update the license of your project.
128+
watch_export Use `nb_export` on ipynb files in `nbs` directory on changes using nbdev config if available
112129

113130
## FAQ
114131

nbdev/config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ def _find_nbdev_pyproject(path=None):
161161
for d in [p] + list(p.parents):
162162
f = d/pyproject_nm
163163
if f.exists() and _has_nbdev(f): return f
164+
for d in [p] + list(p.parents):
165+
if (d/'settings.ini').exists():
166+
raise ValueError(f"Found old settings.ini. Migrate to pyproject.toml using `nbdev_migrate`. See https://nbdev.fast.ai/getting_started.html")
164167

165168
# %% ../nbs/api/01_config.ipynb #3dac70e0
166169
nbdev_defaults = dict(nbs_path='nbs', doc_path='_docs', tst_flags='notest', recursive=True, readme_nb='index.ipynb',
@@ -227,10 +230,6 @@ def get_config(path=None, also_settings=False):
227230
"Return nbdev config."
228231
cfg_file = _find_nbdev_pyproject(path)
229232
if cfg_file is not None:
230-
# Check for old settings.ini and complain loudly
231-
old_cfg = cfg_file.parent / 'settings.ini'
232-
if old_cfg.exists() and not also_settings:
233-
raise ValueError(f"Found old settings.ini at {old_cfg}. Please migrate to pyproject.toml using `nbdev_migrate`. See https://nbdev.fast.ai/getting_started.html for details.")
234233
d = _load_toml(cfg_file)
235234
user = _user_config()
236235
nbdev = {**user, **d.get('tool', {}).get('nbdev', {})}

nbs/api/01_config.ipynb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@
340340
" p = Path(path or Path.cwd()).resolve()\n",
341341
" for d in [p] + list(p.parents):\n",
342342
" f = d/pyproject_nm\n",
343-
" if f.exists() and _has_nbdev(f): return f"
343+
" if f.exists() and _has_nbdev(f): return f\n",
344+
" for d in [p] + list(p.parents):\n",
345+
" if (d/'settings.ini').exists():\n",
346+
" raise ValueError(f\"Found old settings.ini. Migrate to pyproject.toml using `nbdev_migrate`. See https://nbdev.fast.ai/getting_started.html\")"
344347
]
345348
},
346349
{
@@ -439,10 +442,6 @@
439442
" \"Return nbdev config.\"\n",
440443
" cfg_file = _find_nbdev_pyproject(path)\n",
441444
" if cfg_file is not None:\n",
442-
" # Check for old settings.ini and complain loudly\n",
443-
" old_cfg = cfg_file.parent / 'settings.ini'\n",
444-
" if old_cfg.exists() and not also_settings:\n",
445-
" raise ValueError(f\"Found old settings.ini at {old_cfg}. Please migrate to pyproject.toml using `nbdev_migrate`. See https://nbdev.fast.ai/getting_started.html for details.\")\n",
446445
" d = _load_toml(cfg_file)\n",
447446
" user = _user_config()\n",
448447
" nbdev = {**user, **d.get('tool', {}).get('nbdev', {})}\n",
@@ -926,10 +925,7 @@
926925
]
927926
}
928927
],
929-
"metadata": {
930-
"solveit_dialog_mode": "learning",
931-
"solveit_ver": 2
932-
},
928+
"metadata": {},
933929
"nbformat": 4,
934930
"nbformat_minor": 5
935931
}

0 commit comments

Comments
 (0)