Skip to content

Commit 93fb60e

Browse files
authored
Merge pull request #58 from martinRenou/consistent_naming
More consistent naming
2 parents 870b494 + ab0ed44 commit 93fb60e

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
html_theme = "pydata_sphinx_theme"
88
html_logo = "_static/icon.svg"
99

10-
jupyterlite_config = "jupyterlite_config.json"
11-
jupyterlite_contents = "./custom_contents"
10+
jupyter_lite_config = "jupyter_lite_config.json"
11+
jupyter_lite_contents = "./custom_contents"
1212

1313
master_doc = 'index'
1414

File renamed without changes.

src/jupyterlite_sphinx.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import shutil
33
import tempfile
4+
from warnings import warn
45

56
from pathlib import Path
67

@@ -10,7 +11,6 @@
1011

1112
from docutils.parsers.rst import directives
1213
from docutils.nodes import SkipNode, Element
13-
from docutils.parsers import rst
1414

1515
from sphinx.application import Sphinx
1616
from sphinx.util.docutils import SphinxDirective
@@ -266,19 +266,33 @@ def jupyterlite_build(app: Sphinx, error):
266266
if app.builder.format == "html":
267267
print("[jupyterlite-sphinx] Running JupyterLite build")
268268

269-
config = []
269+
jupyter_lite_config = app.env.config.jupyter_lite_config
270+
jupyter_lite_contents = app.env.config.jupyter_lite_contents
271+
jupyter_lite_dir = app.env.config.jupyter_lite_dir
272+
270273
if app.env.config.jupyterlite_config:
271-
config = ["--config", app.env.config.jupyterlite_config]
274+
warn(
275+
"jupyterlite_config config option is deprecated, please use jupyter_lite_config instead"
276+
)
277+
jupyter_lite_config = app.env.config.jupyterlite_config
272278

273-
contents = []
274-
if app.env.config.jupyterlite_contents:
275-
jupyterlite_contents = app.env.config.jupyterlite_contents
279+
if app.env.config.jupyterlite_dir:
280+
warn(
281+
"jupyterlite_dir config option is deprecated, please use jupyter_lite_dir instead"
282+
)
283+
jupyter_lite_dir = app.env.config.jupyterlite_dir
276284

277-
if isinstance(jupyterlite_contents, str):
278-
contents.extend(["--contents", jupyterlite_contents])
285+
config = []
286+
if jupyter_lite_config:
287+
config = ["--config", jupyter_lite_config]
279288

280-
if isinstance(jupyterlite_contents, (tuple, list)):
281-
for content in jupyterlite_contents:
289+
contents = []
290+
if jupyter_lite_contents:
291+
if isinstance(jupyter_lite_contents, str):
292+
contents.extend(["--contents", jupyter_lite_contents])
293+
294+
if isinstance(jupyter_lite_contents, (tuple, list)):
295+
for content in jupyter_lite_contents:
282296
contents.extend(["--contents", content])
283297

284298
command = [
@@ -306,8 +320,8 @@ def jupyterlite_build(app: Sphinx, error):
306320
os.path.join(app.outdir, JUPYTERLITE_DIR),
307321
]
308322

309-
if app.env.config.jupyterlite_dir:
310-
command.extend(["--lite-dir", app.env.config.jupyterlite_dir])
323+
if jupyter_lite_dir:
324+
command.extend(["--lite-dir", jupyter_lite_dir])
311325

312326
subprocess.run(command, check=True)
313327
else:
@@ -336,8 +350,10 @@ def setup(app):
336350

337351
# Config options
338352
app.add_config_value("jupyterlite_config", None, rebuild="html")
353+
app.add_config_value("jupyter_lite_config", None, rebuild="html")
339354
app.add_config_value("jupyterlite_dir", None, rebuild="html")
340-
app.add_config_value("jupyterlite_contents", None, rebuild="html")
355+
app.add_config_value("jupyter_lite_dir", None, rebuild="html")
356+
app.add_config_value("jupyter_lite_contents", None, rebuild="html")
341357

342358
# Initialize RetroLite and JupyterLite directives
343359
app.add_node(

0 commit comments

Comments
 (0)