mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Update Windows command and minor update to installation cell (#12361)
* Fix windows command and minor update to installation cell * Add expand_section field on the first section of the book
This commit is contained in:
@@ -39,24 +39,38 @@
|
||||
"azdata_cell_guid": "97541c75-b1c9-4e4c-9f0a-f93df4a550ef"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"def getJupyterBookVersion():\n",
|
||||
" cmd = f'{sys.executable} -m pip show jupyter-book'\n",
|
||||
" cmdOutput = !{cmd}\n",
|
||||
" if len(cmdOutput) <= 1:\n",
|
||||
" !pip install jupyter-book\n",
|
||||
" cmd = f'{sys.executable} -m pip show jupyter-book'\n",
|
||||
" cmdOutput = !{cmd}\n",
|
||||
" for x in cmdOutput:\n",
|
||||
" if 'version' in x.lower():\n",
|
||||
" version_str = tuple(x.split(': ')[1].replace('.', ''))\n",
|
||||
" version = tuple(int(x) for x in version_str)\n",
|
||||
" return version, version_str"
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "4bc12e83-cd03-425b-ad82-3ea9e0393b2c",
|
||||
"tags": [
|
||||
"hide_input"
|
||||
]
|
||||
},
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import sys\r\n",
|
||||
"\r\n",
|
||||
"def getJupyterBookVersion():\r\n",
|
||||
" cmd = f'{sys.executable} -m pip show jupyter-book'\r\n",
|
||||
" cmdOutput = !{cmd}\r\n",
|
||||
" if len(cmdOutput) <= 1:\r\n",
|
||||
" !pip install jupyter-book\r\n",
|
||||
" cmd = f'{sys.executable} -m pip show jupyter-book'\r\n",
|
||||
" cmdOutput = !{cmd}\r\n",
|
||||
" for x in cmdOutput:\r\n",
|
||||
" if 'version' in x.lower():\r\n",
|
||||
" version_str = tuple(x.split(': ')[1].replace('.', ''))\r\n",
|
||||
" version = tuple(int(x) for x in version_str)\r\n",
|
||||
" return version, version_str\r\n",
|
||||
"\r\n",
|
||||
"try:\r\n",
|
||||
" version, version_str = getJupyterBookVersion()\r\n",
|
||||
" if version:\r\n",
|
||||
@@ -64,7 +78,7 @@
|
||||
" print(f'Jupyter-book version {display_version} is already installed!')\r\n",
|
||||
" use_current = input(f'Would you like to create a book using the current installed version [{display_version}] of jupyter-book? [y/n]').lower()\r\n",
|
||||
"\r\n",
|
||||
" while use_current not in ['yes', 'y', 'no', 'n']:\r\n",
|
||||
" while use_current not in ['','yes', 'y', 'no', 'n']:\r\n",
|
||||
" use_current = input(f'Would you like to create a book using the current installed version [{display_version}] of jupyter-book? [y/n]').lower()\r\n",
|
||||
" if use_current in ['no', 'n']:\r\n",
|
||||
" install_version = input(f'Please enter the version you would like to use (eg. 0.7.4)')\r\n",
|
||||
@@ -138,7 +152,7 @@
|
||||
" if platform in ['linux', 'darwin']:\r\n",
|
||||
" subprocess.check_call(['cp', '-r',content_folder, book_name])\r\n",
|
||||
" else:\r\n",
|
||||
" subprocess.check_call(['xcopy', content_folder, book_name])\r\n",
|
||||
" subprocess.check_call(['xcopy', content_folder, book_name, '/E', '/H'])\r\n",
|
||||
" !jupyter-book toc \"$book_name\"\r\n",
|
||||
"except Exception as e:\r\n",
|
||||
" raise SystemExit(str(e))"
|
||||
@@ -328,6 +342,8 @@
|
||||
" if k == 'file':\n",
|
||||
" new_data.append({k : data[k]})\n",
|
||||
" elif k == 'sections':\n",
|
||||
" new_data[-1].update({'numbered' : 'false'})\n",
|
||||
" new_data[-1].update({'expand_sections' : 'true'})\n",
|
||||
" new_data[-1].update({k : data[k]})\n",
|
||||
" data = new_data\n",
|
||||
" for k in data:\n",
|
||||
@@ -407,7 +423,9 @@
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "bd2fe173-66ce-48b3-8dc3-c4d7560953c8",
|
||||
"tags": []
|
||||
"tags": [
|
||||
"hide_input"
|
||||
]
|
||||
},
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
|
||||
Reference in New Issue
Block a user