_re_proj in update_proj replaces **all** `name` attributes in pyproject.toml
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
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
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AnswerDotAI/nbdev
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AnswerDotAI/nbdev#1596 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
AnswerDotAI/nbdev#1587 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
AnswerDotAI/nbdev#1584 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
AnswerDotAI/nbdev#1583 · 1 comment · 1 reaction ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
AnswerDotAI/nbdev#1569 · 1 comment ·
All issues in AnswerDotAI/nbdev
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
symfony/maker-bundle#1841 ·
Maintainers usually reply within 1 day
-
package-request
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ScoopInstaller/Versions#3079 ·
Maintainers usually reply within 1 day
-
area:release bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
registrystack/registry-stack#1874 ·
Maintainers usually reply within 1 day
-
namespace operations
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
EclipseFdn/open-vsx.org#13702 ·
Maintainers usually reply within 1 day