5
5
import docutils
6
6
import ipywidgets
7
7
from IPython .lib .lexers import IPython3Lexer , IPythonTracebackLexer
8
+ from sphinx .application import Sphinx
8
9
from sphinx .errors import ExtensionError
9
10
from sphinx .util import logging
10
- from sphinx .util .fileutil import copy_asset
11
+ from sphinx .util .fileutil import copy_asset_file
11
12
12
13
from ._version import __version__
13
14
from .ast import (
@@ -89,7 +90,7 @@ def visit_thebe_source(self, node):
89
90
90
91
91
92
# Sphinx callback functions
92
- def builder_inited (app ):
93
+ def builder_inited (app : Sphinx ):
93
94
"""Init the build.
94
95
95
96
2 cases
@@ -108,17 +109,17 @@ def builder_inited(app):
108
109
app .add_js_file (embed_url )
109
110
110
111
111
- def copy_file (src , dst ):
112
- if not ( dst / src . name ). exists ():
113
- copy_asset (str (src ) , str (dst ))
112
+ def copy_file (src : Path , dst : Path ):
113
+ """wrapper of copy_asset_file to handle path"""
114
+ copy_asset_file (str (src . resolve ()) , str (dst . resolve () ))
114
115
115
116
116
- def build_finished (app , env ):
117
+ def build_finished (app : Sphinx , env ):
117
118
if app .builder .format != "html" :
118
119
return
119
120
120
121
module_dir = Path (__file__ ).parent
121
- static = Path (app .outdir ) / "_static"
122
+ static = Path (app .builder . outdir ) / "_static"
122
123
123
124
# Copy stylesheet
124
125
src = module_dir / "css" / "jupyter-sphinx.css"
@@ -136,7 +137,7 @@ def build_finished(app, env):
136
137
137
138
##############################################################################
138
139
# Main setup
139
- def setup (app ):
140
+ def setup (app : Sphinx ):
140
141
"""A temporary setup function so that we can use it here and in execute.
141
142
142
143
This should be removed and converted into `setup` after a deprecation
0 commit comments