Skip to content

soney/snn-from-scratch

Repository files navigation

Visit https://soney.github.io/snn-from-scratch

Initializing

  1. Create a virtual environment in the .venv directory.
python3 -m venv .venv
  1. Activate the virtual environment.
source .venv/bin/activate

...or if you are on Windows, .\.venv\Scripts\activate.

  1. Install the required packages.
pip install -r requirements.txt
  1. Install the node packages.
npm install
  1. Build
npm run build

JavaScript Components

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.