Closed chisholm closed 7 years ago
Actually, there's a test.json file in this repo, accessible from the same domain, which can be used to test the "fetch STIX from URL" function. That worked for me.
Hmm... issue #16 purports to be required to fix #15. I hadn't interpreted this issue to be to fix the global variable problem. I thought it was simply to create the installable Jupyter notebook extension and nothing else. What all is entailed here?
I think fixing the global variable problem is necessary to include multiple graphs in the same Jupyter notebook (if I understand the issue behind #16 correctly).
Yeah, but what the extension does (or doesn't do) is a different issue than making things installable as a notebook extension via a python package in the first place. I'd thought this was just about a repackaging or restructuring.
Looks good!
My preferences on naming:
stix2viz
, since if we ever (figure out how and) decide to distribute just the JS/Image files on NPM, for instance, Jupyter is not relevant.stix2-viz
or stix2-visualization
(to match the naming pattern for the other libraries, and because "stix-viz" is a separate project (it doesn't have a Python component, but I'd still like to avoid the name collision).stix2jupyter/viz.py
into stix2viz/__init__.py
. Then the installation is just jupyter nbextension install/enable --py stix2viz
and usage is just import stix2viz; stix2viz.display(...)
.We won't release a version of the Python package until we fix #16, but I think this is good to merge in now. If the renaming will take a long time, let's merge now and handle it separately, otherwise let's rename first.
Renaming is done. To your points:
pip install X
somehow triggers an npm install Y
)? Or were you thinking of having a python package and npm package coexist in the same repo and share the same files? Is that done? Unfortunately, as it stands, the stix2viz js module imports "nbextensions/stix2viz/d3"
, which includes a hard-coding of a Jupyter notebook extension path component. Because of that, I had to add extra config to application.js so that the stix2viz js module would work outside of Jupyter (it would find its d3 dependency). I didn't like it, but that's what the comment blurb at the top of application.js is about. So Jupyter is unfortunately still relevant, in the implementation.I was thinking about a co-existing npm package, but that's little more than an idea at this point. Maybe with the D3 customizations it's not that feasible.
Intended to fix issue #15.
I had to create a setup.py and invent some packages and names, in order to do this. So I don't know if you agree with my naming.
stix-visualization
stix2jupyter.viz
To install the extension, after having installed stix-visualization:
To uninstall:
(wish they both could be one command.) An example notebook command to make use of the extension:
The extension (actually the js code itself) still doesn't really work as we need it to, due to its problematic reliance on globals. So this is perhaps a step in the right direction as far as releaseability, but it isn't good enough yet.
This repo also contains a regular web application, which I had to modify to keep it working, after having changed the stix2viz code to be an AMD module. The web application must now also be structured as an AMD module, so I've fixed it so it still works, as far as I can test it. To see it while I still have the proper branch in place (which won't be long term), go to: https://chisholm.github.io/cti-stix-visualization/
The "fetch STIX from a URL" function still isn't easily testable due to cross-origin restrictions. There is content at github.com, but that's not the same domain as chisholm.github.io. So I haven't tested it.