Skip to content

Commit cf036f7

Browse files
committed
fix version and repo
1 parent 71c25f8 commit cf036f7

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

nbdev/_modidx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'nbdev.config.ConfigToml.d': ('api/config.html#configtoml.d', 'nbdev/config.py'),
3636
'nbdev.config.ConfigToml.get': ('api/config.html#configtoml.get', 'nbdev/config.py'),
3737
'nbdev.config.ConfigToml.path': ('api/config.html#configtoml.path', 'nbdev/config.py'),
38+
'nbdev.config.ConfigToml.version': ('api/config.html#configtoml.version', 'nbdev/config.py'),
3839
'nbdev.config._basic_export_nb': ('api/config.html#_basic_export_nb', 'nbdev/config.py'),
3940
'nbdev.config._fetch_from_git': ('api/config.html#_fetch_from_git', 'nbdev/config.py'),
4041
'nbdev.config._find_nbdev_pyproject': ('api/config.html#_find_nbdev_pyproject', 'nbdev/config.py'),

nbdev/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ def __init__(self, d, proj, cfg_file):
180180
auths = proj.get('authors') or [{}]
181181
self.author = auths[0].get('name')
182182
self.author_email = auths[0].get('email')
183-
self.version = proj.get('version', '0.0.1')
183+
184184

185185
urls = proj.get('urls') or {}
186-
self.git_url = urls.get('Repository') or urls.get('Source') or ''
186+
self.git_url = (urls.get('Repository') or urls.get('Source') or '').rstrip('/')
187187
self.doc_url = urls.get('Documentation') or ''
188188
self.user, self.repo = repo_details(self.git_url) if self.git_url else ('', '')
189189
# Derive doc_host and doc_baseurl from doc_url
@@ -193,6 +193,10 @@ def __init__(self, d, proj, cfg_file):
193193
self.doc_baseurl = (u.path or '/').rstrip('/') or '/'
194194
if 'lib_path' not in self: self['lib_path'] = self.lib_name.replace('-', '_')
195195

196+
@property
197+
def version(self):
198+
return read_version(self.config_path / self['lib_path']) or '0.0.1'
199+
196200
@property
197201
def d(self): return {k:v for k,v in super().items()}
198202

nbs/api/01_config.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,10 @@
376376
" auths = proj.get('authors') or [{}]\n",
377377
" self.author = auths[0].get('name')\n",
378378
" self.author_email = auths[0].get('email')\n",
379-
" self.version = proj.get('version', '0.0.1')\n",
379+
" \n",
380380
" \n",
381381
" urls = proj.get('urls') or {}\n",
382-
" self.git_url = urls.get('Repository') or urls.get('Source') or ''\n",
382+
" self.git_url = (urls.get('Repository') or urls.get('Source') or '').rstrip('/')\n",
383383
" self.doc_url = urls.get('Documentation') or ''\n",
384384
" self.user, self.repo = repo_details(self.git_url) if self.git_url else ('', '')\n",
385385
" # Derive doc_host and doc_baseurl from doc_url\n",
@@ -390,6 +390,10 @@
390390
" if 'lib_path' not in self: self['lib_path'] = self.lib_name.replace('-', '_')\n",
391391
"\n",
392392
" @property\n",
393+
" def version(self):\n",
394+
" return read_version(self.config_path / self['lib_path']) or '0.0.1'\n",
395+
"\n",
396+
" @property\n",
393397
" def d(self): return {k:v for k,v in super().items()}\n",
394398
"\n",
395399
" def __getattr__(self, k): return stop(AttributeError(k)) if k=='d' or k not in self.d else self.get(k)\n",

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ requires = ["setuptools>=64"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name="nbdev"
6+
name = "nbdev"
77
description = "Create delightful software with Jupyter Notebooks"
88
readme = "README.md"
9-
requires-python=">=3.9"
9+
requires-python = ">=3.9"
1010
license = {text = "Apache-2.0"}
1111
authors = [{name = "Jeremy Howard and the fast.ai community", email = "j@fast.ai"}]
1212
keywords = ["nbdev", "fastai", "jupyter", "notebook", "export"]

0 commit comments

Comments
 (0)