Skip to content

Commit 41bd89e

Browse files
authored
Merge pull request #985 from minrk/rm-stencila
Drop support for stencila
2 parents 968cc43 + edfca79 commit 41bd89e

File tree

21 files changed

+18
-1278
lines changed

21 files changed

+18
-1278
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ jobs:
7474
- nix
7575
- pipfile
7676
- r
77-
- stencila-py
7877
- unit
7978
- venv
8079
include:

docs/source/architecture.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ It takes the following steps to determine this:
4444
repository' by returning `True`. Usually buildpacks look for presence of specific files
4545
(`requirements.txt`, `environment.yml`, `install.R`, `manifest.xml` etc) to determine if they can handle a
4646
repository or not. Buildpacks may also look into specific files to determine specifics of the
47-
required environment, such as the Stencila integration which extracts the required language-specific
48-
executions contexts from an XML file (see base `BuildPack`). More than one buildpack may use such
49-
information, as properties can be inherited (e.g. the R buildpack uses the list of required Stencila
50-
contexts to see if R must be installed).
47+
required environment.
48+
More than one buildpack may use such information,
49+
as properties can be inherited.
5150
3. If no `BuildPack` returns true, then repo2docker will use the default `BuildPack` (defined in
5251
`Repo2Docker.default_buildpack` traitlet).
5352

docs/source/config_files.rst

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -149,25 +149,6 @@ You also need to have a ``runtime.txt`` file that is formatted as
149149
used for your R installation.
150150

151151

152-
.. _manifest.xml:
153-
154-
``manifest.xml`` - Install Stencila
155-
===================================
156-
157-
`Stencila <https://stenci.la/>`_ is an open source office suite for reproducible research.
158-
It is powered by the open file format `Dar <https://github.com/substance/dar>`_.
159-
160-
If your repository contains a Stencila document, repo2docker detects it based on the file ``manifest.xml``.
161-
The required `execution contexts <https://stenci.la/learn/intro.html>`_ are extracted from a Dar article (i.e.
162-
files named ``*.jats.xml``).
163-
164-
You may also have a ``runtime.txt`` and/or an ``install.R`` to manually configure your R installation.
165-
166-
To see example repositories, visit our
167-
`Stencila with R <https://github.com/binder-examples/stencila-r/>`_ and
168-
`Stencila with Python <https://github.com/binder-examples/stencila-py>`_ examples.
169-
170-
171152
.. _postBuild:
172153

173154
``postBuild`` - Run code after installing the environment

docs/source/howto/user_interface.rst

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,7 @@ http://mybinder.org/v2/gh/binder-examples/r/master?urlpath=shiny/bus-dashboard/
112112
Stencila
113113
========
114114

115-
The Stencila user interface is automatically enabled if a Stencila document (i.e.
116-
a file ``manifest.xml``) is detected. Stencila will be accessible by appending
117-
``/stencila`` to the URL, like so:
115+
.. note::
118116

119-
.. code-block:: none
120-
121-
http(s)://<server:port>/stencila
122-
123-
The editor will open the Stencila document corresponding to the last ``manifest.xml``
124-
found in the file tree. If you want to open a different document, you can configure
125-
the path in the URL parameter ``archive``:
126-
127-
.. code-block:: none
128-
129-
http(s)://<server:port>/stencila/?archive=other-dir
117+
Stencila support has been removed due to changes in stencila making it incompatible.
118+
Please `get in touch <https://discourse.jupyter.org>`__ if you would like to help restore stencila support.

repo2docker/buildpacks/base.py

Lines changed: 10 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -311,70 +311,16 @@ def get_build_script_files(self):
311311
"""
312312
return {}
313313

314-
@property
315-
def stencila_manifest_dir(self):
316-
"""Find the stencila manifest dir if it exists"""
317-
if hasattr(self, "_stencila_manifest_dir"):
318-
return self._stencila_manifest_dir
319-
320-
# look for a manifest.xml that suggests stencila could be used
321-
# when we find one, stencila should be installed
322-
# and set environment variables such that
323-
# this file is located at:
324-
# ${STENCILA_ARCHIVE_DIR}/${STENCILA_ARCHIVE}/manifest.xml
325-
326-
self._stencila_manifest_dir = None
314+
def _check_stencila(self):
315+
"""Find the stencila manifest dir if it exists
327316
317+
And warn about removed stencila support
318+
"""
328319
for root, dirs, files in os.walk("."):
329320
if "manifest.xml" in files:
330-
self.log.debug("Found a manifest.xml at %s", root)
331-
self._stencila_manifest_dir = root.split(os.path.sep, 1)[1]
332-
self.log.info(
333-
"Using stencila manifest.xml in %s", self._stencila_manifest_dir
321+
self.log.error(
322+
f"Found a stencila manifest.xml at {root}. Stencila is no longer supported."
334323
)
335-
break
336-
return self._stencila_manifest_dir
337-
338-
@property
339-
def stencila_contexts(self):
340-
"""Find the stencila manifest contexts from file path in manifest"""
341-
if hasattr(self, "_stencila_contexts"):
342-
return self._stencila_contexts
343-
344-
# look at the content of the documents in the manifest
345-
# to extract the required execution contexts
346-
self._stencila_contexts = set()
347-
348-
# get paths to the article files from manifest
349-
files = []
350-
if self.stencila_manifest_dir:
351-
manifest = ET.parse(
352-
os.path.join(self.stencila_manifest_dir, "manifest.xml")
353-
)
354-
documents = manifest.findall("./documents/document")
355-
files = [
356-
os.path.join(self.stencila_manifest_dir, x.get("path"))
357-
for x in documents
358-
]
359-
360-
else:
361-
return self._stencila_contexts
362-
363-
for filename in files:
364-
self.log.debug("Extracting contexts from %s", filename)
365-
366-
# extract code languages from file
367-
document = ET.parse(filename)
368-
code_chunks = document.findall('.//code[@specific-use="source"]')
369-
languages = [x.get("language") for x in code_chunks]
370-
self._stencila_contexts.update(languages)
371-
372-
self.log.info(
373-
"Added executions contexts, now have %s", self._stencila_contexts
374-
)
375-
break
376-
377-
return self._stencila_contexts
378324

379325
def get_build_scripts(self):
380326
"""
@@ -553,6 +499,9 @@ def render(self, build_args=None):
553499
for k, v in self.get_build_script_files().items()
554500
}
555501

502+
# check if there's a stencila manifest, support for which has been removd
503+
self._check_stencila()
504+
556505
return t.render(
557506
packages=sorted(self.get_packages()),
558507
path=self.get_path(),
@@ -706,23 +655,7 @@ def get_build_scripts(self):
706655

707656
def get_env(self):
708657
"""Return env directives to be set after build"""
709-
env = []
710-
if self.stencila_manifest_dir:
711-
# manifest_dir is the path containing the manifest.xml
712-
# archive_dir is the directory containing archive directories
713-
# (one level up) default archive is the name of the directory
714-
# in the archive_dir such that
715-
# ${STENCILA_ARCHIVE_DIR}/${STENCILA_ARCHIVE}/manifest.xml
716-
# exists.
717-
718-
archive_dir, archive = os.path.split(self.stencila_manifest_dir)
719-
env.extend(
720-
[
721-
("STENCILA_ARCHIVE_DIR", "${REPO_DIR}/" + archive_dir),
722-
("STENCILA_ARCHIVE", archive),
723-
]
724-
)
725-
return env
658+
return []
726659

727660
def detect(self):
728661
return True
@@ -765,32 +698,6 @@ def get_preassemble_scripts(self):
765698
except FileNotFoundError:
766699
pass
767700

768-
if "py" in self.stencila_contexts:
769-
scripts.extend(
770-
[
771-
(
772-
"${NB_USER}",
773-
r"""
774-
${KERNEL_PYTHON_PREFIX}/bin/pip install --no-cache https://github.com/stencila/py/archive/f1260796.tar.gz && \
775-
${KERNEL_PYTHON_PREFIX}/bin/python -m stencila register
776-
""",
777-
)
778-
]
779-
)
780-
if self.stencila_manifest_dir:
781-
scripts.extend(
782-
[
783-
(
784-
"${NB_USER}",
785-
r"""
786-
${NB_PYTHON_PREFIX}/bin/pip install --no-cache nbstencilaproxy==0.1.1 && \
787-
jupyter serverextension enable --sys-prefix --py nbstencilaproxy && \
788-
jupyter nbextension install --sys-prefix --py nbstencilaproxy && \
789-
jupyter nbextension enable --sys-prefix --py nbstencilaproxy
790-
""",
791-
)
792-
]
793-
)
794701
return scripts
795702

796703
def get_assemble_scripts(self):

repo2docker/buildpacks/r.py

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class RBuildPack(PythonBuildPack):
2525
2626
2. A `DESCRIPTION` file signaling an R package
2727
28-
3. A Stencila document (*.jats.xml) with R code chunks (i.e. language="r")
29-
3028
If there is no `runtime.txt`, then the MRAN snapshot is set to latest
3129
date that is guaranteed to exist across timezones.
3230
@@ -37,8 +35,7 @@ class RBuildPack(PythonBuildPack):
3735
3836
- as dependencies in a `DESCRIPTION` file
3937
40-
- are needed by a specific tool, for example the package `stencila` is
41-
installed and configured if a Stencila document is given.
38+
- are needed by a specific tool
4239
4340
The `r-base` package from Ubuntu apt repositories is used to install
4441
R itself, rather than any of the methods from https://cran.r-project.org/.
@@ -129,9 +126,7 @@ def detect(self):
129126
return True
130127

131128
description_R = "DESCRIPTION"
132-
if (
133-
not self.binder_dir and os.path.exists(description_R)
134-
) or "r" in self.stencila_contexts:
129+
if not self.binder_dir and os.path.exists(description_R):
135130
if not self.checkpoint_date:
136131
# no R snapshot date set through runtime.txt
137132
# set the R runtime to the latest date that is guaranteed to
@@ -226,7 +221,6 @@ def get_build_scripts(self):
226221
(determined by MRAN)
227222
- IRKernel
228223
- nbrsessionproxy (to access RStudio via Jupyter Notebook)
229-
- stencila R package (if Stencila document with R code chunks detected)
230224
231225
We set the snapshot date used to install R libraries from based on the
232226
contents of runtime.txt.
@@ -325,34 +319,6 @@ def get_build_scripts(self):
325319
),
326320
]
327321

328-
if "r" in self.stencila_contexts:
329-
# new versions of R require a different way of installing bioconductor
330-
if V(self.r_version) <= V("3.5"):
331-
scripts += [
332-
(
333-
"${NB_USER}",
334-
# Install and register stencila library
335-
r"""
336-
R --quiet -e "source('https://bioconductor.org/biocLite.R'); biocLite('graph')" && \
337-
R --quiet -e "devtools::install_github('stencila/r', ref = '361bbf560f3f0561a8612349bca66cd8978f4f24')" && \
338-
R --quiet -e "stencila::register()"
339-
""",
340-
)
341-
]
342-
343-
else:
344-
scripts += [
345-
(
346-
"${NB_USER}",
347-
# Install and register stencila library
348-
r"""
349-
R --quiet -e "install.packages('BiocManager'); BiocManager::install(); BiocManager::install(c('graph'))" && \
350-
R --quiet -e "devtools::install_github('stencila/r', ref = '361bbf560f3f0561a8612349bca66cd8978f4f24')" && \
351-
R --quiet -e "stencila::register()"
352-
""",
353-
)
354-
]
355-
356322
return super().get_build_scripts() + scripts
357323

358324
def get_preassemble_script_files(self):

tests/stencila-py/py/plain-python/bibliography.bibtex

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/stencila-py/py/plain-python/manifest.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/stencila-py/py/plain-python/py.ipynb

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)