Skip to content

Commit

Permalink
fixes #1415
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Jun 2, 2024
1 parent b42fa70 commit 60bb8e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions nbdev/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ def write_conda_meta(path='conda'):
_write_yaml(path, *_get_conda_meta())

# %% ../nbs/api/18_release.ipynb 43
# This function is used as a utility for creating HF spaces.
def write_requirements(directory=None):
@call_parse
def write_requirements(path:str=''):
"Writes a `requirements.txt` file to `directory` based on settings.ini."
cfg = get_config()
d = Path(directory) if directory else cfg.config_path
d = Path(path) if path else cfg.config_path
req = '\n'.join([cfg.get(k, '').replace(' ', '\n') for k in ['requirements', 'pip_requirements']])
(d/'requirements.txt').mk_write(req)

Expand Down
8 changes: 4 additions & 4 deletions nbs/api/18_release.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,12 @@
"metadata": {},
"outputs": [],
"source": [
"#|export\n",
"# This function is used as a utility for creating HF spaces.\n",
"def write_requirements(directory=None):\n",
"#| export\n",
"@call_parse\n",
"def write_requirements(path:str=''):\n",
" \"Writes a `requirements.txt` file to `directory` based on settings.ini.\"\n",
" cfg = get_config()\n",
" d = Path(directory) if directory else cfg.config_path\n",
" d = Path(path) if path else cfg.config_path\n",
" req = '\\n'.join([cfg.get(k, '').replace(' ', '\\n') for k in ['requirements', 'pip_requirements']])\n",
" (d/'requirements.txt').mk_write(req)"
]
Expand Down
1 change: 1 addition & 0 deletions settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ console_scripts = nbdev_create_config=nbdev.config:nbdev_create_config
nbdev_conda=nbdev.release:release_conda
nbdev_release_both=nbdev.release:release_both
nbdev_bump_version=nbdev.release:nbdev_bump_version
nbdev_requirements=nbdev.release:write_requirements
nbdev_proc_nbs=nbdev.quarto:nbdev_proc_nbs
nbdev_help=nbdev.cli:chelp
tst_flags = notest
Expand Down

0 comments on commit 60bb8e9

Please sign in to comment.