> For the complete documentation index, see [llms.txt](https://swatplus.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swatplus.gitbook.io/docs/1.2.3/source-code.md).

# Source Code

## Repository Links

* [SWAT+ source code repository](https://bitbucket.org/blacklandgrasslandmodels/modular_swatplus)
* [SWAT+ Editor source code repository](https://bitbucket.org/swatplus/swatplus.editor)
* [QSWAT+ source code repository](https://bitbucket.org/ChrisWGeorge/qswatplus3)

## Run and Compile SWAT+ Editor

### Install Development Tools

* You may use any IDE of your choice, however [Visual Studio Code](https://code.visualstudio.com/) is used by the developer.
* Install [Python 3.7](https://www.python.org/)
* Install required Python packages. From command prompt, go to source code /api directory and run:

```
pip install -r requirements.txt
```

* Install [Node.js](https://nodejs.org/en/)
* Install required Node.js packages. From command prompt, go to the root directory of the source code and run:

```
npm install
```

### Run the Source Code

From a command prompt in the root directory (terminal inside Visual Studio Code)

```
npm run dev
```

Open a second command prompt and run

```
npm run electron
```

### Build the Source Code

First, use [PyInstaller](https://www.pyinstaller.org/) (included in the Python packages during install) to freeze the Python into executable files. This should be done from the /api directory in the source code. In Windows, run the supplied .bat file from a command prompt:

```
pyinstaller_builds
```

{% hint style="info" %}
Note: PyInstaller will create 32 or 64-bit executables depending on the version of Python you have installed.
{% endhint %}

Next, build the Vue.js code. Open a command prompt and run:

```
npm run build
```

Finally, package the code for distribution using [Electron Builder](https://www.electron.build/). Configuration is set in the package.json file. Results of the build will be placed in the /release/dist directory.

Create an installer:

```
npm run dist
```

Or, build a portable executable:

```
npm run dist-port
```

Or, pack the files into a directory:

```
npm run pack
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://swatplus.gitbook.io/docs/1.2.3/source-code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
