Skip to content

Commit

Permalink
Networkx v2 (#133)
Browse files Browse the repository at this point in the history
* Add nbstripout

* update to networkx v2 API

* install ffmpeg from native ubuntu repo

* comment out xvfb

* change python to 3.8

* switch to py37

* manual listing of notebooks to execute
  • Loading branch information
ericmjl authored Apr 25, 2020
1 parent c5566e5 commit 9c0f148
Show file tree
Hide file tree
Showing 24 changed files with 895 additions and 10,567 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.ipynb filter=nbstripout
*.ipynb diff=ipynb
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ datasets/divvy_2013/*
datasets/amazon_reviews/*.json
network
__pycache__/*
.ipynb_checkpoints/*
*.ipynb_checkpoints/*
*.pyc
custom/__pycache__/*
.DS_Store
30 changes: 18 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# This is necessary for pyjanitor as matplotlib is involved.
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 5 # give xvfb some time to start
# before_script:
# - "export DISPLAY=:99.0"
# - "sh -e /etc/init.d/xvfb start"
# - sleep 5 # give xvfb some time to start

language: python
matrix:
include:
- python: 3.5 # we don't actually use this
env: PYTHON_VERSION=3.6
env: PYTHON_VERSION=3.7

before_install:
# Ensure that ffmpeg is installed
# Inspired from here: https://gist.github.com/kevinGodell/bd52cd74c8c2d66fb69f108ef223c356
# However, I also changed the PPA based on this URL: https://tecadmin.net/install-ffmpeg-on-linux/
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:jonathonf/ffmpeg-3; fi
# - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:jonathonf/ffmpeg-3; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y ffmpeg; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
Expand Down Expand Up @@ -44,12 +43,19 @@ install:
script:
# Your test script goes here
# - command -v jupyter
- |
for nb in $(ls *-instructor.ipynb); do
jupyter nbconvert --config nbconvert_config.py --execute $nb
# - |
# for nb in $(ls *-instructor.ipynb); do
# jupyter nbconvert --config nbconvert_config.py --execute $nb

done
# - jupyter nbconvert --config nbconvert_config.py --execute 2-networkx-basics-instructor.ipynb
# done
- jupyter nbconvert --config nbconvert_config.py --execute 2-networkx-basics-instructor.ipynb
- jupyter nbconvert --config nbconvert_config.py --execute 3-hubs-and-paths-instructor.ipynb
- jupyter nbconvert --config nbconvert_config.py --execute 4-cliques-triangles-structures-instructor.ipynb
- jupyter nbconvert --config nbconvert_config.py --execute 5-graph-input-output-instructor.ipynb
- jupyter nbconvert --config nbconvert_config.py --execute 6-bipartite-graphs-instructor.ipynb
- jupyter nbconvert --config nbconvert_config.py --execute 7-game-of-thrones-case-study-instructor.ipynb
- jupyter nbconvert --config nbconvert_config.py --execute bonus-1-network-statistical-inference-instructor.ipynb
- jupyter nbconvert --config nbconvert_config.py --execute bonus-3-matrices-instructor.ipynb

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
42 changes: 6 additions & 36 deletions 0-pre-tutorial-exercises.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2017-07-08T12:07:28.341024-04:00",
"start_time": "2017-07-08T12:07:28.328856Z"
},
"collapsed": true
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# 1. Basic Python data structures\n",
Expand Down Expand Up @@ -51,27 +45,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2017-07-08T12:07:28.468914-04:00",
"start_time": "2017-07-08T12:07:28.343869Z"
}
},
"outputs": [
{
"ename": "UnboundLocalError",
"evalue": "local variable '______' referenced before assignment",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mUnboundLocalError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-2-d7bd54c0478d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# Test your result below.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfind_persons_with_surname\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnames\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Lee'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresults\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfind_persons_with_surname\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnames\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Elmer'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-1-5332cbff266c>\u001b[0m in \u001b[0;36mfind_persons_with_surname\u001b[0;34m(persons, query_surname)\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 22\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0m______\u001b[0m \u001b[0;32min\u001b[0m \u001b[0m______\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 23\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m___________\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0m__________\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[0mresults\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m________\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mUnboundLocalError\u001b[0m: local variable '______' referenced before assignment"
]
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Test your result below.\n",
"results = find_persons_with_surname(names, 'Lee')\n",
Expand All @@ -84,9 +60,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
}
Expand Down Expand Up @@ -161,10 +135,6 @@
"_Feature"
],
"window_display": false
},
"widgets": {
"state": {},
"version": "1.1.1"
}
},
"nbformat": 4,
Expand Down
27 changes: 3 additions & 24 deletions 1-introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,13 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2017-07-11T16:59:15.527287Z",
"start_time": "2017-07-11T16:59:15.501751Z"
},
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [
{
"data": {
"text/plain": [
"[{'line': 1, 'name': 'raindrops on roses'}]"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"my_fav_things = []\n",
"my_fav_things.append({'name': 'raindrops on roses', 'line': 1})\n",
Expand Down Expand Up @@ -245,9 +230,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
}
Expand Down Expand Up @@ -323,10 +306,6 @@
"_Feature"
],
"window_display": false
},
"widgets": {
"state": {},
"version": "1.1.1"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 9c0f148

Please sign in to comment.