Skip to content

Commit c1076db

Browse files
committed
Updated with new abuseipdb and nicer js bundling
1 parent 0b0b5dc commit c1076db

File tree

12 files changed

+252
-4795
lines changed

12 files changed

+252
-4795
lines changed

.github/workflows/deploy.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
uses: fastai/workflows/quarto-ghp@master
1414
with:
1515
version: '3.11'
16-
- name: npm build
17-
run: npm install && npm run build
18-
- name: npm release upload
16+
- name: build
17+
run: build.sh
18+
- name: release upload
1919
uses: softprops/action-gh-release@v1
2020
if: startsWith(github.ref, 'refs/tags/')
2121
with:
22-
files: atlaskit-transformer.bundle.js
22+
files: dist/*

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ include settings.ini
22
include LICENSE
33
include CONTRIBUTING.md
44
include README.md
5-
include squ/atlaskit-transformer.bundle.js
5+
include nbdev_squ/atlaskit-transformer.bundle.js
66
recursive-exclude * __pycache__

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Below is how to install in a plain python 3.11+ environment
99

1010
``` sh
11-
pip install https://github.com/wagov/nbdev-squ/archive/refs/tags/v1.3.1.tar.gz
11+
https://github.com/wagov/nbdev-squ/releases/download/v1.3.2/nbdev_squ-1.3.2-py3-none-any.whl
1212
```
1313

1414
The installation can also be run in a notebook (we tend to use
@@ -18,7 +18,7 @@ should load the json secret *squconfig-`my_keyvault_tenantid`* from the
1818
`my_kevault_name` keyvault.
1919

2020
``` python
21-
%pip install https://github.com/wagov/nbdev-squ/archive/refs/tags/v1.3.1.tar.gz
21+
%pip install https://github.com/wagov/nbdev-squ/releases/download/v1.3.2/nbdev_squ-1.3.2-py3-none-any.whl
2222
import os; os.environ["SQU_CONFIG"] = "{{ my_keyvault_name }}/{{ my_keyvault_tenantid }}"
2323

2424
from nbdev_squ import api

build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
# Just used during CI to build static assets and add to release
3+
npm install
4+
npm run build
5+
python -m build

install.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/bin/bash
2+
# This is meant to be run to setup and prep for committing a release
3+
# use nbdev_bump_version to increment the version itself then rerun this to update README.md etc
24
pip install nbdev
35
nbdev_install
6+
npx npm-check-updates -u # convenient way to freshen package.json on each release
47
npm install
58
npm run build
69
nbdev_clean
710
nbdev_export
811
nbdev_readme
912
nbdev_install_hooks
10-
13+
version=$(awk -F' = ' '/^version/{print $2}' settings.ini)
14+
sed -i '' "s/{{ version }}/$version/g" README.md

nbdev_squ/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.3.1"
1+
__version__ = "1.3.2"

nbdev_squ/api.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
'atlaskit_transformer', 'security_incidents', 'security_alerts']
77

88
# %% ../nbs/01_api.ipynb 3
9-
import pandas, json, logging, time, requests, httpx_cache, io
9+
import pandas, json, logging, time, requests, httpx_cache, io, pkgutil
10+
from importlib.metadata import version
1011
from .core import *
1112
from diskcache import memoize_stampede
1213
from subprocess import run, CalledProcessError
@@ -237,11 +238,9 @@ def hunt(indicators, expression="has", columns=columns, workspaces=None, timespa
237238

238239
# %% ../nbs/01_api.ipynb 22
239240
def atlaskit_transformer(inputtext, inputfmt="md", outputfmt="wiki", runtime="node"):
240-
import nbdev_squ
241-
transformer = dirs.user_cache_path / f"atlaskit-transformer.bundle_v{nbdev_squ.__version__}.js"
241+
transformer = dirs.user_cache_path / f"atlaskit-transformer.bundle_v{version('nbdev_squ')}.js"
242242
if not transformer.exists():
243-
transformer_url = f'https://github.com/wagov/nbdev-squ/releases/download/v{nbdev_squ.__version__}/atlaskit-transformer.bundle.js'
244-
transformer.write_bytes(requests.get(transformer_url).content)
243+
transformer.write_bytes(pkgutil.get_data("nbdev_squ", "atlaskit-transformer.bundle.js"))
245244
cmd = [runtime, str(transformer), inputfmt, outputfmt]
246245
logger.debug(" ".join(cmd))
247246
try:

nbs/01_api.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"outputs": [],
3636
"source": [
3737
"#| export\n",
38-
"import pandas, json, logging, time, requests, httpx_cache, io\n",
38+
"import pandas, json, logging, time, requests, httpx_cache, io, pkgutil\n",
39+
"from importlib.metadata import version\n",
3940
"from nbdev_squ.core import *\n",
4041
"from diskcache import memoize_stampede\n",
4142
"from subprocess import run, CalledProcessError\n",
@@ -428,11 +429,9 @@
428429
"source": [
429430
"#| exports\n",
430431
"def atlaskit_transformer(inputtext, inputfmt=\"md\", outputfmt=\"wiki\", runtime=\"node\"):\n",
431-
" import nbdev_squ\n",
432-
" transformer = dirs.user_cache_path / f\"atlaskit-transformer.bundle_v{nbdev_squ.__version__}.js\"\n",
432+
" transformer = dirs.user_cache_path / f\"atlaskit-transformer.bundle_v{version('nbdev_squ')}.js\"\n",
433433
" if not transformer.exists():\n",
434-
" transformer_url = f'https://github.com/wagov/nbdev-squ/releases/download/v{nbdev_squ.__version__}/atlaskit-transformer.bundle.js'\n",
435-
" transformer.write_bytes(requests.get(transformer_url).content)\n",
434+
" transformer.write_bytes(pkgutil.get_data(\"nbdev_squ\", \"atlaskit-transformer.bundle.js\"))\n",
436435
" cmd = [runtime, str(transformer), inputfmt, outputfmt]\n",
437436
" logger.debug(\" \".join(cmd))\n",
438437
" try:\n",

nbs/index.ipynb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
"Below is how to install in a plain python 3.11+ environment\n",
2929
"\n",
3030
"```sh\n",
31-
"pip install https://github.com/wagov/nbdev-squ/archive/refs/tags/v1.3.1.tar.gz\n",
31+
"https://github.com/wagov/nbdev-squ/releases/download/v{{ version }}/nbdev_squ-{{ version }}-py3-none-any.whl\n",
3232
"```\n",
3333
"\n",
3434
"The installation can also be run in a notebook (we tend to use [JupyterLab Desktop](https://github.com/jupyterlab/jupyterlab-desktop) for local dev). The `SQU_CONFIG` env var indicates to nbdev_squ it should load the json secret *squconfig-`my_keyvault_tenantid`* from the `my_kevault_name` keyvault.\n",
3535
"\n",
3636
"```python\n",
37-
"%pip install https://github.com/wagov/nbdev-squ/archive/refs/tags/v1.3.1.tar.gz\n",
37+
"%pip install https://github.com/wagov/nbdev-squ/releases/download/v{{ version }}/nbdev_squ-{{ version }}-py3-none-any.whl\n",
3838
"import os; os.environ[\"SQU_CONFIG\"] = \"{{ my_keyvault_name }}/{{ my_keyvault_tenantid }}\" \n",
3939
"\n",
4040
"from nbdev_squ import api\n",
@@ -201,6 +201,9 @@
201201
"display_name": "python3",
202202
"language": "python",
203203
"name": "python3"
204+
},
205+
"language_info": {
206+
"name": ""
204207
}
205208
},
206209
"nbformat": 4,

0 commit comments

Comments
 (0)