Skip to content

Commit

Permalink
major reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusmota committed Aug 18, 2024
1 parent 816a7b0 commit 331cb14
Show file tree
Hide file tree
Showing 45 changed files with 2,671 additions and 979 deletions.
27 changes: 27 additions & 0 deletions .ipython/extensions/neo4j_cypher_query.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from yfiles_jupyter_graphs_for_neo4j import Neo4jGraphWidget
from neo4j import GraphDatabase
from yfiles_jupyter_graphs import GraphWidget
from IPython.core.magic import (register_line_magic,
register_cell_magic)

driver = GraphDatabase.driver(uri = "neo4j://localhost")

def query_neo4j(cypher_query: str):
query_graph_result = driver.session().run(cypher_query).graph()
graph_widget = GraphWidget(overview_enabled=False, context_start_with='Data', graph = query_graph_result)
graph_widget.set_sidebar(enabled=False, start_with='Data')
display(graph_widget)
return graph_widget

def cypher(line, cell_content):
print(line)
query_neo4j(cell_content)

def load_ipython_extension(ipython):
"""This function is called when the extension is
loaded. It accepts an IPython InteractiveShell
instance. We can register the magic with the
`register_magic_function` method of the shell
instance."""
ipython.register_magic_function(cypher, 'cell')

2 changes: 1 addition & 1 deletion binder/apt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ curl
wget
net-tools
lsof
openjdk-11-jdk
openjdk-21-jdk
22 changes: 9 additions & 13 deletions binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@
# jupyter/jupyterlab extensions/kernels #
###############################################################

# echo "IPywidgets Jupyterlab"
# jupyter labextension install @jupyter-widgets/jupyterlab-manager


# # Table of contents Jupyter Lab Extension
# echo "Table of contents Jupyter Lab extension install"
# jupyter labextension install @jupyterlab/toc --no-build


# Building everything up
echo "Building everything up (jupyter lab build)"
# Building jupyter lab
echo "Building jupyter lab..."
# jupyter lab build
echo "Finished building jupyter lab!"

###############################################################
# moving to a local installation folder #
Expand All @@ -24,12 +16,12 @@ echo "Building everything up (jupyter lab build)"
mkdir ~/resources/local
cd ~/resources/local


###############################################################
# neo4j installation commands #
###############################################################
echo "Installing Neo4j..."

export NEO4J_VERSION=3.5.8
export NEO4J_VERSION=5.22.0
echo "export NEO4J_VERSION=${NEO4J_VERSION}" >> ~/.bashrc
echo "export NEO4J_VERSION=${NEO4J_VERSION}" >> ~/.profile

Expand All @@ -52,12 +44,14 @@ rm artifact.php?name=neo4j-community-${NEO4J_VERSION}-unix.tar.gz
echo "export PATH=\$PATH:\$NEO4J_HOME/bin" >> ~/.bashrc
echo "export PATH=\$PATH:\$NEO4J_HOME/bin" >> ~/.profile

echo "Finished installing Neo4j!"



###############################################################
# vscode server installation #
###############################################################
echo "Installing VScode..."

cd ~/resources/local

Expand All @@ -84,3 +78,5 @@ echo "export PATH=\$PATH:\$CODE_SERVER_HOME/bin" >> ~/.profile

source ~/.bashrc

echo "Finished installing VScode!"

7 changes: 4 additions & 3 deletions binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# jupyter/jupyterlab extensions
jupyter-server-proxy
jupyter-vscode-proxy
jupyterlab
jupyterlab>=3,<4
jupyterlab-rise
ipywidgets

# lab-related packages
neo4j
numpy
pandas
matplotlib
plotly
Expand All @@ -18,4 +17,6 @@ igraph
jgraph
pprintpp
yfiles_jupyter_graphs
yfiles_jupyter_graphs_for_neo4j
yfiles_jupyter_graphs_for_neo4j
graph-notebook
numpy<1.24
6 changes: 3 additions & 3 deletions binder/start
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

mkdir logs


chmod +x ~/binder/start.neo4j
chmod +x ~/binder/start.vscode

Expand All @@ -12,6 +9,9 @@ chmod +x ~/binder/start.vscode
# starting vscode in parallel
~/binder/start.vscode &

# adding my own extensions
mkdir -p ~/.ipython/extensions/
cp ~/.ipython/extensions/* ~/.ipython/extensions/

# DO NOT REMOVE(!)
# Here is why: https://mybinder.readthedocs.io/en/latest/config_files.html#start-run-code-before-the-user-sessions-starts
Expand Down
7 changes: 3 additions & 4 deletions binder/start.neo4j
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

cp ~/resources/configs/neo4j/${NEO4J_VERSION}/neo4j.conf ${NEO4J_HOME}/conf/
nohup neo4j start &> ~/logs/neo4j-$NEO4J_VERSION.log &

mkdir ~/resources/logs
cp ~/resources/configs/neo4j/${NEO4J_VERSION}/neo4j.conf ${NEO4J_HOME}/conf/
nohup neo4j start &> ~/resources/logs/neo4j-$NEO4J_VERSION.log &
Loading

0 comments on commit 331cb14

Please sign in to comment.