Skip to content

Commit

Permalink
Merge pull request #348 from ericmjl/bump_up_actions
Browse files Browse the repository at this point in the history
bump up actions
  • Loading branch information
MridulS authored Jun 8, 2023
2 parents f8800b9 + 4e4a495 commit d0ae6f7
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 40 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
jobs:
# Check that source code is black-ified
black:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
name: Checkout repository

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
name: Setup Python
with:
python-version: 3.9
Expand All @@ -28,9 +28,9 @@ jobs:
# This job is copied over from `deploy.yaml`
build-environment:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# See: https://github.com/marketplace/actions/setup-conda
- uses: s-weigand/setup-conda@v1
Expand All @@ -40,7 +40,7 @@ jobs:
# Build cache of environment
- name: Cache conda environment
id: cache-environment
uses: actions/cache@v2
uses: actions/cache@v3
# Conda environment build step depends on two files,
# so we ensure that the hash key contains both their hashes.
with:
Expand All @@ -54,21 +54,21 @@ jobs:

# See: https://github.com/actions/upload-artifact
- name: Upload environment
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: nams-tarball
path: nams.tar.gz

# This job is copied over from `deploy.yaml`
build-deploy-website:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
needs: build-environment
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: nams-tarball

Expand All @@ -78,7 +78,7 @@ jobs:
# Build cache of website
- name: Cache website
id: cache-website
uses: actions/cache@v2
uses: actions/cache@v3
# Website build step depends on the following files:
# - mkdocs.yml
# - scripts/ci/build_website.sh
Expand All @@ -105,13 +105,13 @@ jobs:

# This job is copied over from `deploy.yaml`
build-deploy-leanpub:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
needs: build-environment
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download environment tarball
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: nams-tarball

Expand All @@ -121,7 +121,7 @@ jobs:
# Build cache of leanpub source
- name: Cache LeanPub
id: cache-leanpub
uses: actions/cache@v2
uses: actions/cache@v3
# Leanpub build step depends on the following files:
# - scripts/bookbuilder
# - scripts/ci/build_website.sh
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ on:

jobs:
build-environment:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# See: https://github.com/marketplace/actions/setup-conda
- uses: s-weigand/setup-conda@v1
Expand All @@ -25,7 +25,7 @@ jobs:
# Build cache of environment
- name: Cache conda environment
id: cache-environment
uses: actions/cache@v2
uses: actions/cache@v3
# Conda environment build step depends on two files,
# so we ensure that the hash key contains both their hashes.
with:
Expand All @@ -39,20 +39,20 @@ jobs:

# See: https://github.com/actions/upload-artifact
- name: Upload environment
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: nams-tarball
path: nams.tar.gz

build-deploy-website:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
needs: build-environment
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: nams-tarball

Expand All @@ -77,13 +77,13 @@ jobs:
disable_nojekyll: false

build-deploy-leanpub:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
needs: build-environment
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download environment tarball
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: nams-tarball

Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies:
- pymdown-extensions
- pyprojroot
- python-louvain
- rise
- scipy
- seaborn
- tabulate # used for exporting dataframe as Markdown tables
Expand Down
2 changes: 1 addition & 1 deletion nams/solutions/got.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def weighted_degree(G, weight):
def correlation_centrality(G):
cor = pd.DataFrame.from_records(
[
nx.pagerank_numpy(G, weight="weight"),
nx.pagerank(G, weight="weight"),
nx.betweenness_centrality(G, weight="weight_inv"),
weighted_degree(G, "weight"),
nx.degree_centrality(G),
Expand Down
14 changes: 6 additions & 8 deletions notebooks/03-practical/01-io.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(nx.info(G))"
"print(G)"
]
},
{
Expand Down Expand Up @@ -531,11 +531,6 @@
"\n",
"Since NetworkX graphs are Python objects,\n",
"the canonical way to save them is by pickling them.\n",
"You can do this using:\n",
"\n",
"```python\n",
"nx.write_gpickle(G, file_path)\n",
"```\n",
"\n",
"Here's an example in action:"
]
Expand All @@ -546,7 +541,9 @@
"metadata": {},
"outputs": [],
"source": [
"nx.write_gpickle(G, \"/tmp/divvy.pkl\")"
"import pickle\n",
"with open(\"/tmp/divvy.pkl\", \"wb\") as f:\n",
" pickle.dump(G, f, pickle.HIGHEST_PROTOCOL)"
]
},
{
Expand All @@ -562,7 +559,8 @@
"metadata": {},
"outputs": [],
"source": [
"G_loaded = nx.read_gpickle(\"/tmp/divvy.pkl\")"
"with open(\"/tmp/divvy.pkl\", \"rb\") as f:\n",
" G_loaded = pickle.load(f)"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions notebooks/05-casestudies/01-gameofthrones.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@
"source": [
"# by default weight attribute in PageRank is weight\n",
"# so we use weight=None to find the unweighted results\n",
"sorted(nx.pagerank_numpy(graphs[0],\n",
"sorted(nx.pagerank(graphs[0],\n",
" weight=None).items(),\n",
" key=lambda x:x[1], reverse=True)[0:10]"
]
Expand All @@ -402,7 +402,7 @@
"metadata": {},
"outputs": [],
"source": [
"sorted(nx.pagerank_numpy(\n",
"sorted(nx.pagerank(\n",
" graphs[0], weight='weight').items(),\n",
" key=lambda x:x[1], reverse=True)[0:10]"
]
Expand Down
4 changes: 2 additions & 2 deletions notebooks/05-casestudies/02-airport.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
"# Number of nodes = airports\n",
"# Number of edges = routes\n",
"\n",
"print(nx.info(pass_2015_network))"
"print(pass_2015_network)"
]
},
{
Expand Down Expand Up @@ -1354,7 +1354,7 @@
"source": [
"# number of nodes -> airports\n",
"# number of edges -> routes\n",
"print(nx.info(united_network))"
"print(united_network)"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion scripts/ci/build_environment.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Build conda environment.
conda update -n base -c defaults conda
conda install -c conda-forge mamba
conda env create -f environment.yml
mamba env create -f environment.yml
conda activate nams || source activate nams
python -m pip install --no-deps git+https://github.com/greenape/mknotebooks.git
python -m pip install --no-deps .
Expand Down

0 comments on commit d0ae6f7

Please sign in to comment.