Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

_re_proj in update_proj replaces **all** `name` attributes in pyproject.toml

Open
#1,581 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start with the reproducible example in main.py and inspect nbdev.config.update_proj, which rewrites pyproject.toml. Run it with uv and verify that the [project] name is updated while the [tool.uv.index] name remains "pytorch-cpu".

Written by the indexing model from the issue text.

Description

bug

Description

The attribute name can occur not only in the project section of a pyproject.toml. Using nbdev-export will result in the command replacing the other name attributes with the project name. In our case, this occurred because we specified an alternative package index for PyTorch, as shown in the example below.

Provide a minimally reproducible example

main.py with:

from nbdev.config import update_proj 
from pathlib import Path
import tempfile
from fastcore.utils import *

pyproj_tmpl = """[build-system]
requires = ["setuptools>=64.0"]
build-backend = "setuptools.build_meta"

[project]
name = "FILL_IN"
requires-python="FILL_IN"
dynamic = [ "keywords", "description", "version", "dependencies", "optional-dependencies", "readme",
    "license", "authors", "classifiers", "entry-points", "scripts", "urls"]

[tool.uv]
cache-keys = [{ file = "pyproject.toml" }, { file = "setup.py" }]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
"""

with tempfile.TemporaryDirectory() as d:
    d = Path(d)
    cfg_text = (pyproj_tmpl.replace('name = "FILL_IN"', 'name = "testpkg"').replace('requires-python="FILL_IN"', 'requires-python=">=3.10"'))
    cfg_text += '\n[tool.nbdev]\n'
    (d/'pyproject.toml').write_text(cfg_text)
    (d/'testpkg').mkdir()

    with working_directory(d):
        update_proj(d)

    result = (d/'pyproject.toml').read_text()
    assert 'name = "testpkg"' in result
    assert 'name = "pytorch-cpu"' in result, "update_proj incorrectly modified the uv index name!"

Run with uv run --with nbdev,fastcore main.py

Dominant language
Jupyter Notebook
Stars
5.3k
Forks
516
Avg merge
1m
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AnswerDotAI/nbdev

All issues in AnswerDotAI/nbdev

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.