Skip to content

Commit fd838ad

Browse files
docs: update dev env docs to mirror the launcher's install method
1 parent 5e9227c commit fd838ad

File tree

1 file changed

+31
-51
lines changed

1 file changed

+31
-51
lines changed

docs/contributing/dev-environment.md

Lines changed: 31 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Dev Environment
22

3-
To make changes to Invoke's backend, frontend, or documentation, you'll need to set up a dev environment.
3+
To make changes to Invoke's backend, frontend or documentation, you'll need to set up a dev environment.
44

5-
If you just want to use Invoke, you should use the [installer][installer link].
5+
If you only want to make changes to the docs site, you can skip the frontend dev environment setup as described in the below guide.
66

7-
!!! info "Why do I need the frontend toolchain?"
8-
9-
The repo doesn't contain a build of the frontend. You'll be responsible for rebuilding it every time you pull in new changes, or run it in dev mode (which incurs a substantial performance penalty).
7+
If you just want to use Invoke, you should use the [launcher][launcher link].
108

119
!!! warning
1210

@@ -17,84 +15,66 @@ If you just want to use Invoke, you should use the [installer][installer link].
1715
## Setup
1816

1917
1. Run through the [requirements][requirements link].
18+
2019
2. [Fork and clone][forking link] the [InvokeAI repo][repo link].
20+
2121
3. Create an directory for user data (images, models, db, etc). This is typically at `~/invokeai`, but if you already have a non-dev install, you may want to create a separate directory for the dev install.
22-
4. Create a python virtual environment inside the directory you just created:
2322

24-
```sh
25-
python3 -m venv .venv --prompt InvokeAI-Dev
26-
```
23+
4. Follow the [manual install][manual install link] guide, with some modifications to the install command:
2724

28-
5. Activate the venv (you'll need to do this every time you want to run the app):
25+
- Use `.` instead of `invokeai` to install from the current directory.
2926

30-
```sh
31-
source .venv/bin/activate
32-
```
27+
- Add `-e` after the `install` operation to make this an [editable install][editable install link]. That means your changes to the python code will be reflected when you restart the Invoke server.
3328

34-
6. Install the repo as an [editable install][editable install link]:
29+
- When installing the `invokeai` package, add the `dev`, `test` and `docs` package options to the package specifier. You may or may not need the `xformers` option - follow the manual install guide to figure that out. So, your package specifier will be either `".[dev,test,docs]"` or `".[dev,test,docs,xformers]"`. Note the quotes!
30+
31+
With the modifications made, the install command should look something like this:
3532

3633
```sh
37-
pip install -e ".[dev,test,xformers]" --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121
34+
uv pip install -e ".[dev,test,docs,xformers]"=5.5.0 --python 3.11 --python-preference only-managed --index=https://download.pytorch.org/whl/cu124 --reinstall
3835
```
3936

40-
Refer to the [manual installation][manual install link] instructions for more determining the correct install options. `xformers` is optional, but `dev` and `test` are not.
37+
5. At this point, you should have Invoke installed, a venv set up and activated, and the server running. But you will see a warning in the terminal that no UI was found. If you go to the URL for the server, you won't get a UI.
4138
42-
7. Install the frontend dev toolchain:
39+
This is because the UI build is not distributed with the source code. You need to build it manually. End the running server instance.
4340
44-
- [`nodejs`](https://nodejs.org/) (recommend v20 LTS)
45-
- [`pnpm`](https://pnpm.io/8.x/installation) (must be v8 - not v9!)
41+
If you only want to edit the docs, you can stop here and skip to the **Documentation** section below.
4642
47-
8. Do a production build of the frontend:
43+
6. Install the frontend dev toolchain:
4844
49-
```sh
50-
cd PATH_TO_INVOKEAI_REPO/invokeai/frontend/web
51-
pnpm i
52-
pnpm build
53-
```
45+
- [`nodejs`](https://nodejs.org/) (v20+)
46+
47+
- [`pnpm`](https://pnpm.io/8.x/installation) (must be v8 - not v9!)
5448
55-
9. Start the application:
49+
7. Do a production build of the frontend:
5650
5751
```sh
58-
cd PATH_TO_INVOKEAI_REPO
59-
python scripts/invokeai-web.py
52+
cd <PATH_TO_INVOKEAI_REPO>/invokeai/frontend/web
53+
pnpm i
54+
pnpm build
6055
```
6156
62-
10. Access the UI at `localhost:9090`.
57+
8. Restart the server and navigate to the URL. You should get a UI. After making changes to the python code, restart the server to see those changes.
6358
6459
## Updating the UI
6560
66-
You'll need to run `pnpm build` every time you pull in new changes. Another option is to skip the build and instead run the app in dev mode:
61+
You'll need to run `pnpm build` every time you pull in new changes.
62+
63+
Another option is to skip the build and instead run the UI in dev mode:
6764

6865
```sh
6966
pnpm dev
7067
```
7168

72-
This starts a dev server at `localhost:5173`, which you will use instead of `localhost:9090`.
69+
This starts a vite dev server for the UI at `127.0.0.1:5173`, which you will use instead of `127.0.0.1:9090`.
7370

74-
The dev mode is substantially slower than the production build but may be more convenient if you just need to test things out.
71+
The dev mode is substantially slower than the production build but may be more convenient if you just need to test things out. It will hot-reload the UI as you make changes to the frontend code. Sometimes the hot-reload doesn't work, and you need to manually refresh the browser tab.
7572
7673
## Documentation
7774
78-
The documentation is built with `mkdocs`. To preview it locally, you need a additional set of packages installed.
79-
80-
```sh
81-
# after activating the venv
82-
pip install -e ".[docs]"
83-
```
84-
85-
Then, you can start a live docs dev server, which will auto-refresh when you edit the docs:
86-
87-
```sh
88-
mkdocs serve
89-
```
90-
91-
On macOS and Linux, there is a `make` target for this:
92-
93-
```sh
94-
make docs
95-
```
75+
The documentation is built with `mkdocs`. It provides a hot-reload dev server for the docs. Start it with `mkdocs serve`.
9676
97-
[installer link]: ../installation/installer.md
77+
[launcher link]: ../installation/quick_start.md
9878
[forking link]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo
9979
[requirements link]: ../installation/requirements.md
10080
[repo link]: https://github.com/invoke-ai/InvokeAI

0 commit comments

Comments
 (0)