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 (
@@ -91,7 +92,7 @@ def visit_thebe_source(self, node):
91
92
92
93
93
94
# Sphinx callback functions
94
- def builder_inited (app ):
95
+ def builder_inited (app : Sphinx ):
95
96
"""
96
97
2 cases
97
98
case 1: ipywidgets 7, with require
@@ -113,17 +114,17 @@ def builder_inited(app):
113
114
app .add_js_file (embed_url )
114
115
115
116
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 () ))
119
120
120
121
121
- def build_finished (app , env ):
122
+ def build_finished (app : Sphinx , env ):
122
123
if app .builder .format != "html" :
123
124
return
124
125
125
126
module_dir = Path (__file__ ).parent
126
- static = Path (app .outdir ) / "_static"
127
+ static = Path (app .builder . outdir ) / "_static"
127
128
128
129
# Copy stylesheet
129
130
src = module_dir / "css" / "jupyter-sphinx.css"
@@ -141,7 +142,7 @@ def build_finished(app, env):
141
142
142
143
##############################################################################
143
144
# Main setup
144
- def setup (app ):
145
+ def setup (app : Sphinx ):
145
146
"""A temporary setup function so that we can use it here and in execute.
146
147
147
148
This should be removed and converted into `setup` after a deprecation
0 commit comments