nbdev
nbdev copied to clipboard
settings.ini not inferred by nbdev_new on newly cloned repo on MacOS
Attempting to run nbdev_new
on a cloned empty repository fails to infer settings from git and returns an error after entering settings values.
nbdev 2.0.7 is installed.
Steps to reproduce:
- create a new repository: https://github.com/new
- clone and move to repository in terminal
- run
nbdev_new
in repository root directory
The following will appear:
(base) username@Users-MBP testrepo % nbdev_new
================ nbdev Configuration ================
Please enter information for the following field in settings.ini:
lib_name:
Filling out all request fields:
Please enter information for the following field in settings.ini:
lib_name: testrepo
Please enter information for the following field in settings.ini:
user: wnoxchi
Please enter information for the following field in settings.ini:
branch: main
Please enter information for the following field in settings.ini:
author: "Author Name"
Please enter information for the following field in settings.ini:
author_email: ""
Please enter information for the following field in settings.ini:
keywords: "AI"
Please enter information for the following field in settings.ini:
description: "sample description"
Will result in the following error:
`settings.ini` updated with configuration values.
Traceback (most recent call last):
File "/Users/username/mambaforge/bin/nbdev_new", line 8, in <module>
sys.exit(nbdev_new())
File "/Users/username/mambaforge/lib/python3.9/site-packages/fastcore/script.py", line 116, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/Users/username/mambaforge/lib/python3.9/site-packages/nbdev/cli.py", line 296, in nbdev_new
settings = settings.format(**config)
KeyError: 'repo'
The settings.ini file will not be updated with new values.
Could it be that the CLI is not asking for repo
so when the underlying script queries a dictionary for repo
it returns the KeyError?
@WNoxchi can you try the same thing but install from git?
pip install -U git+https://github.com/fastai/nbdev.git
IIRC this error was fixed already
Unfortunately no change with 2.0.8. I tried creating a new (mamba) conda environment and only installing nbdev as above, on a fresh clone of a new empty repo, running nbdev_new
after restarting terminal just in case. I'm running on mambaforge with pip installed through mamba.
Thanks for your efforts :-)
On Ubuntu 20.04. I've tried creating with gh repo, and also by cloning a new repository. The nbdev_new fails to recognise any metadata from the repository, prompts me for fields then fails to save an edited ini file. Error looks like:
`settings.ini` updated with configuration values.
Traceback (most recent call last):
File "/home/<me>/miniconda3/envs/jupyter-nbdev/bin/nbdev_new", line 8, in <module>
sys.exit(nbdev_new())
File "/home/<me>/miniconda3/envs/jupyter-nbdev/lib/python3.10/site-packages/fastcore/script.py", line 116, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/home/<me>/miniconda3/envs/jupyter-nbdev/lib/python3.10/site-packages/nbdev/cli.py", line 296, in nbdev_new
settings = settings.format(**config)
KeyError: 'repo'
environment created using ❯ mamba env create -f ./environment.yml
❯ cat environment.yml
name: jupyter-nbdev
channels:
- fastai
- conda-forge
- defaults
dependencies:
- pip
- conda-forge::python>=3.8
- conda-forge::jupyterlab
- conda-forge::nb_conda_kernels
- fastai::nbdev
❯ mamba list | grep nbdev
# packages in environment at /home/<me>/miniconda3/envs/jupyter-nbdev:
nbdev 2.0.7 py_0 fastai
I tried again with a new clone, and having rebuilt the environment using python 3.8. Same result I think.
❯ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
❯ nbdev_new
================ nbdev Configuration ================
Please enter information for the following field in settings.ini:
lib_name: nbdev-tutorial
Please enter information for the following field in settings.ini:
user: pjgoodall
Please enter information for the following field in settings.ini:
branch: main
Please enter information for the following field in settings.ini:
author: Peter Goodall
Please enter information for the following field in settings.ini:
author_email: <redacted>
Please enter information for the following field in settings.ini:
keywords: nbdev tutorial written
Please enter information for the following field in settings.ini:
description: the nbdev written tutorial attempt
`settings.ini` updated with configuration values.
Traceback (most recent call last):
File "/home/<me>/miniconda3/envs/jupyter-nbdev/bin/nbdev_new", line 8, in <module>
sys.exit(nbdev_new())
File "/home/<me>/miniconda3/envs/jupyter-nbdev/lib/python3.8/site-packages/fastcore/script.py", line 116, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/home/<me>/miniconda3/envs/jupyter-nbdev/lib/python3.8/site-packages/nbdev/cli.py", line 296, in nbdev_new
settings = settings.format(**config)
KeyError: 'repo'
I tried with the pip install from github described above. nbdev 2.0.8 pypi_0 pypi
Same result:
`settings.ini` updated with configuration values.
Traceback (most recent call last):
File "/home/<me>/miniconda3/envs/jupyter-nbdev/bin/nbdev_new", line 8, in <module>
sys.exit(nbdev_new())
File "/home/<me>/miniconda3/envs/jupyter-nbdev/lib/python3.8/site-packages/fastcore/script.py", line 116, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/home/<me>/miniconda3/envs/jupyter-nbdev/lib/python3.8/site-packages/nbdev/cli.py", line 296, in nbdev_new
settings = settings.format(**config)
KeyError: 'repo'
I've just updated nbdev to emit some diagnostic information if it can't get info from github. Would you be able to install from github master and try again from inside a git repo, and if it again prompts for info rather than grabbing it from github, please paste in a reply the warning that it emits?
I'm having the exact same issue on Arch, with python 3.10 and installing through pip instead of conda.
Thanks @golanor I was able to reproduce the error and have fixed it in #719
I was able to reproduce it with a private repo, by the way that was the trick to make it fail
On my end this was on public repos. Thanks for your work. I got it working with a new mamba env. Note: a user may have to update/reinstall fastcore. The issue persisted for me on my dev env (this time with a NameError: name 'urlsend' is not defined
), with the only packages referenced besides nbdev being fastcore and ghapi. Removing both and letting nbdev handle their reinstalls (fastcore → 1.5.13) fixed the issue.
Working nicely for me now, on Ubuntu 20.04
> cat environment.yml
name: jupyter-nbdev
channels:
- fastai
- conda-forge
- defaults
dependencies:
- pip
- pip:
- git+https://github.com/fastai/nbdev.git
- conda-forge::python=3.8
- conda-forge::jupyterlab
- conda-forge::nb_conda_kernels