Visit https://soney.github.io/snn-from-scratch
- Create a virtual environment in the
.venv
directory.
python3 -m venv .venv
- Activate the virtual environment.
source .venv/bin/activate
...or if you are on Windows, .\.venv\Scripts\activate
.
- Install the required packages.
pip install -r requirements.txt
- Install the node packages.
npm install
- Build
npm run build
As webpack is compiling, it runs a loader for .ts
files (named component-spec-loader.js
) that contain a comment formatted in the style /*spec-start ... spec-end*/
. Whatever is between these two tags should be a JSON-formatted string in the following format:
/*spec-start {
"name": "bucket",
"has_content": true,
"required_arguments": 0,
"optional_arguments": 3,
"option_names": ["key1", "key2"]
} spec-end*/
name
: The name of the component.has_content
: Whether the component has content.required_arguments
: The number of required arguments.optional_arguments
: The number of optional arguments.option_names
: The names of the optional arguments.
These comments are then combined into a JSON file (ext/component-spec.json
) that is then read by ext/javascript.py
to create a bunch of custom Sphinx components.