From 773dcb60908ae65ec2c30062d5a1d8a4842fefa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Dufka?= Date: Thu, 3 Aug 2023 17:09:59 +0200 Subject: [PATCH] Use Colab instead of Binder --- Dockerfile | 15 +++------------ README.md | 6 +++--- dissect/analysis/playground.ipynb | 9 +++++++-- pyproject.toml | 1 + 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ec7fc7..66e6b29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,16 @@ FROM sagemath/sagemath:9.8 -# Setup sage and jupyter -RUN sage --pip install --no-cache-dir notebook - -# Conform to mybinder -ARG NB_USER=jovyan -ARG NB_UID=1000 -ENV USER ${NB_USER} ENV HOME /home/sage ENV TARGET "${HOME}/dissect" USER root RUN apt-get update && apt-get install ca-certificates -RUN usermod -l ${NB_USER} sage COPY . ${TARGET} -RUN chown -R ${NB_UID} ${TARGET} -USER ${NB_USER} +RUN chown -R sage ${TARGET} +USER sage -# Install DiSSECT WORKDIR ${TARGET} ENV PATH "${HOME}/.sage/local/bin:${PATH}" RUN sage --pip install --user . RUN sed -i 's/^#!.*$/#!\/usr\/bin\/env sage/' ${HOME}/.sage/local/bin/dissect-* -ENTRYPOINT [] +CMD ["sage", "-n", "jupyter", "dissect/analysis/playground.ipynb", "--ip='0.0.0.0'", "--port=8888"] diff --git a/README.md b/README.md index 67c200d..853e543 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://gitlab.fi.muni.cz/x408178/curve_analyzer/-/blob/master/LICENSE) [![language](https://badgen.net/badge/language/python,sage/purple?list=/)](https://www.sagemath.org/) [![traits](https://badgen.net/badge/traits/23/blue)](https://github.com/crocs-muni/DiSSECT/tree/master/dissect/traits) -[![Binder](https://static.mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/crocs-muni/DiSSECT/HEAD?labpath=dissect%2Fanalysis%2Fplayground.ipynb) +[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/crocs-muni/DiSSECT/blob/master/dissect/analysis/playground.ipynb#offline=1) DiSSECT is, to the best of our knowledge, the largest publicly available database of standardized elliptic curves (taken from our [sister project](https://neuromancer.sk/std/)) and offers generation of simulated curves according to the mentioned standards. The tool contains over 20 tests (which we call traits), each computing curve properties, ranging from classical algebraic ones to unconventional ones and those connected to implementations. After obtaining their empirical distributions, the traits allow us to compare the simulated curves to the standard ones. Finally, DiSSECT provides an easy-to-use interface for implementations of custom traits and their interactive visualization via Jupyter notebook. @@ -36,7 +36,7 @@ When the image is successfully built, you can start using DiSSECT. To run Jupyter Notebook, use the following command and access the provided link in your web browser. ```shell -docker run -it -p 8888:8888 dissect jupyter notebook dissect/analysis --ip='0.0.0.0' --port=8888 +docker run -it -p 8888:8888 dissect ``` To use advanced components of DiSSECT, access the container directly. @@ -96,7 +96,7 @@ To run analysis notebook, use the following command and select the `venv` kernel ``` jupyter notebook dissect/analysis/playground.ipynb ``` -Alternatively, you may try using the notebook directly in your browser using [Binder](https://mybinder.org/v2/gh/crocs-muni/DiSSECT/HEAD?labpath=dissect%2Fanalysis%2Fplayground.ipynb). +Alternatively, you may try using the notebook directly in your browser using [Colab](https://colab.research.google.com/github/crocs-muni/DiSSECT/blob/master/dissect/analysis/playground.ipynb#offline=1). ### Automated analysis diff --git a/dissect/analysis/playground.ipynb b/dissect/analysis/playground.ipynb index 62f7311..8941265 100644 --- a/dissect/analysis/playground.ipynb +++ b/dissect/analysis/playground.ipynb @@ -14,8 +14,13 @@ "outputs": [], "source": [ "# Import dependencies\n", - "from dissect.analysis.data_processing import get_curves, get_trait, find_outliers\n", - "import plotly.express as px" + "try:\n", + " from dissect.analysis.data_processing import get_curves, get_trait, find_outliers\n", + " import plotly.express as px\n", + "except:\n", + " %pip install git+https://github.com/crocs-muni/dissect\n", + " from dissect.analysis.data_processing import get_curves, get_trait, find_outliers\n", + " import plotly.express as px" ] }, { diff --git a/pyproject.toml b/pyproject.toml index 2e7b4a2..c789048 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ dependencies = [ "pandas==2.0.3", "scikit-learn==1.3.0", "plotly==5.15.0", + "nbformat>=4.2.0", ] [project.urls]