Skip to content

Instantly share code, notes, and snippets.

@pdxjohnny
Created April 22, 2021 17:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pdxjohnny/ae1430367040298b3a895abc4d2863ee to your computer and use it in GitHub Desktop.
dffml: 2ndparty: Start on CI for main package
diff --git a/.ci/run.sh b/.ci/run.sh
index d056bdb78..3ea8962ec 100755
--- a/.ci/run.sh
+++ b/.ci/run.sh
@@ -194,8 +194,36 @@ function run_docs() {
export GIT_SSH_COMMAND='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
cd "${SRC_ROOT}"
+ # TODO Stop using ~/.local here, make all pip related commands use venv
"${PYTHON}" -m pip install --prefix=~/.local -U -e "${SRC_ROOT}[dev]"
- "${PYTHON}" -m dffml service dev install -user
+
+ # We first attempt to install all the support level 1 and 2 plugins
+ # - If it works, then no warning on support level 2 tutorials.
+ # - If it doesn't work. Then we flag that the docs build need to set warnings
+ # on support level 2 tutorials.
+
+ # TODO We attempt to install all the support level 1 and 2 plugins
+ set +e
+ # This equates to `pip install ...support level 1 and 2 plugins...`
+ # This would parse plugins.json and install plugins of support levels 1 and 2
+ # TODO Create issue to track remove of install command from service dev, and
+ # moving into main CLI commands.
+ # Side note: We should also move create, export
+ # -git flag says install from Git URLs in plugins.json, rather than latest
+ # relase
+ dffml install -git -levels 1 2
+ exit_code=$?
+ set -e
+ # - If it doesn't work. Then we flag that the docs build need to set warnings
+ # on support level 2 tutorials.
+ rm -f somefile
+ if [[ "x${exit_code}" != "0" ]]; then
+ # TODO Add this file to the .gitignore
+ touch somefile
+ # This would parse plugins.json and install plugins of support level 1
+ "${PYTHON}" -m dffml install -git -levels 1
+ fi
+
# Remove dataclasses. See https://github.com/intel/dffml/issues/882
"${PYTHON}" "${TEMPFIX}/pytorch/pytorch/46930.py" ~/.local
@@ -231,12 +259,33 @@ function run_docs() {
git checkout "${last_release}"
git clean -fdx
git reset --hard HEAD
- # Uninstall dffml
- "${PYTHON}" -m pip uninstall -y dffml
- # Remove .local to force install of correct dependency versions
- rm -rf ~/.local
- "${PYTHON}" -m pip install --prefix=~/.local -U -e "${SRC_ROOT}[dev]"
- "${PYTHON}" -m dffml service dev install -user
+
+ # TODO Deactivate the venv and create a new one
+ # We first attempt to install all the support level 1 and 2 plugins
+ # - If it works, then no warning on support level 2 tutorials.
+ # - If it doesn't work. Then we flag that the docs build need to set warnings
+ # on support level 2 tutorials.
+
+ # TODO We attempt to install all the support level 1 and 2 plugins
+ set +e
+ # This equates to `pip install ...support level 1 and 2 plugins...`
+ # This would parse plugins.json and install plugins of support levels 1 and 2
+ # TODO Create issue to track remove of install command from service dev, and
+ # moving into main CLI commands.
+ # Side note: We should also move create, export
+ dffml install -levels 1 2
+ exit_code=$?
+ set -e
+ # - If it doesn't work. Then we flag that the docs build need to set warnings
+ # on support level 2 tutorials.
+ rm -f somefile
+ if [[ "x${exit_code}" != "0" ]]; then
+ # TODO Add this file to the .gitignore
+ touch somefile
+ # This would parse plugins.json and install plugins of support level 1
+ "${PYTHON}" -m dffml install -levels 1
+ fi
+
# Remove dataclasses. See https://github.com/intel/dffml/issues/882
"${PYTHON}" "${TEMPFIX}/pytorch/pytorch/46930.py" ~/.local
dffml service dev docs || ./scripts/docs.sh
diff --git a/docs/conf.py b/docs/conf.py
index aaf0de6c8..0ff1761a8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -98,7 +98,34 @@ html_context = {
}
+# We can add a directives for support level 2 and 3 plugins
+from docutils.parsers.rst import Directive, directives
+
+support_level_2_warning = (
+ pathlib.Path(__file__).parents[1].joinpath("somefile")
+)
+
+# At top of tutorials using support level 2 and 3 plugins we'll put
+
+# .. plugin-support-level:: 2
+# .. plugin-support-level:: 3
+class PluginSupportLevel(Directive):
+ required_arguments = 1
+ optional_arguments = 0
+ final_argument_whitespace = False
+ option_spec = {}
+
+ def run(self):
+ # Check argument for support level number (2 or 3)
+ if self.arguments[0] == "2":
+ if not support_level_2_warning.is_file():
+ return
+ # TODO Return a node with contents that say there might be an issue
+ return {}
+
+
def setup(app):
+ app.add_directive("plugin-support-level", PluginSupportLevel)
app.add_js_file("copybutton.js")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment