Skip to content

Commit

Permalink
Merge pull request #7 from itepifanio/clean-nb
Browse files Browse the repository at this point in the history
Clean nb
  • Loading branch information
itepifanio authored Apr 7, 2023
2 parents a83ff73 + cbd8fd5 commit 017b20c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 39 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
run: |
pip install -e .[dev]
- name: Check nbs are clean
run: ./scripts/check_nbs_clean.sh
shell: bash

- name: Run flake8
run: nbqa flake8 nbs/*.ipynb

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Publish package to TestPypi

on:
push:
branches: ["main"]
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Tests
on: [workflow_dispatch, pull_request, push]

jobs:
Expand Down
39 changes: 3 additions & 36 deletions nbs/06_hand.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,7 @@
"execution_count": null,
"id": "8cabce32",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Card(rank=1, suit='spades')"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"#| exec_doc\n",
"#| code-fold: false\n",
Expand All @@ -171,18 +160,7 @@
"execution_count": null,
"id": "45aa3d73",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[Card(rank=1, suit='spades')]"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"#| exec_doc\n",
"[card for card in hand]"
Expand All @@ -193,18 +171,7 @@
"execution_count": null,
"id": "1b8584bd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"#| exec_doc\n",
"hand.discard() # type: ignore\n",
Expand Down
14 changes: 14 additions & 0 deletions scripts/check_nbs_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

#set -x

nbdev_clean --clear_all

GIT_STATUS_FAILED(){
git status -uno -s |grep '.*\.ipynb'
}

if GIT_STATUS_FAILED; then
echo "!! ::error:: Detected notebooks that are not cleaned."
false;
fi

0 comments on commit 017b20c

Please sign in to comment.