55import docutils
66import ipywidgets
77from IPython .lib .lexers import IPython3Lexer , IPythonTracebackLexer
8+ from sphinx .application import Sphinx
89from sphinx .errors import ExtensionError
910from sphinx .util import logging
10- from sphinx .util .fileutil import copy_asset
11+ from sphinx .util .fileutil import copy_asset_file
1112
1213from ._version import __version__
1314from .ast import (
@@ -91,7 +92,7 @@ def visit_thebe_source(self, node):
9192
9293
9394# Sphinx callback functions
94- def builder_inited (app ):
95+ def builder_inited (app : Sphinx ):
9596 """
9697 2 cases
9798 case 1: ipywidgets 7, with require
@@ -113,17 +114,17 @@ def builder_inited(app):
113114 app .add_js_file (embed_url )
114115
115116
116- def copy_file (src , dst ):
117- if not ( dst / src . name ). exists ():
118- copy_asset (str (src ) , str (dst ))
117+ def copy_file (src : Path , dst : Path ):
118+ """wrapper of copy_asset_file to handle path"""
119+ copy_asset_file (str (src . resolve ()) , str (dst . resolve () ))
119120
120121
121- def build_finished (app , env ):
122+ def build_finished (app : Sphinx , env ):
122123 if app .builder .format != "html" :
123124 return
124125
125126 module_dir = Path (__file__ ).parent
126- static = Path (app .outdir ) / "_static"
127+ static = Path (app .builder . outdir ) / "_static"
127128
128129 # Copy stylesheet
129130 src = module_dir / "css" / "jupyter-sphinx.css"
@@ -141,7 +142,7 @@ def build_finished(app, env):
141142
142143##############################################################################
143144# Main setup
144- def setup (app ):
145+ def setup (app : Sphinx ):
145146 """A temporary setup function so that we can use it here and in execute.
146147
147148 This should be removed and converted into `setup` after a deprecation
0 commit comments