You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/development/getting-started.md
+22-17
Original file line number
Diff line number
Diff line change
@@ -62,22 +62,7 @@ $issue-$description
62
62
63
63
The description should be just two or three words to imply the focus of the work being performed. For example, bug #1234 to fix a TypeError exception when creating a device might be named `1234-device-typerror`. This ensures that branches are always follow some logical ordering (e.g. when running `git branch -a`) and helps other developers quickly identify the purpose of each.
64
64
65
-
### 3. Enable Pre-Commit Hooks
66
-
67
-
NetBox ships with a [git pre-commit hook](https://githooks.com/) script that automatically checks for style compliance and missing database migrations prior to committing changes. This helps avoid erroneous commits that result in CI test failures. You are encouraged to enable it by creating a link to `scripts/git-hooks/pre-commit`:
68
-
69
-
```no-highlight
70
-
cd .git/hooks/
71
-
ln -s ../../scripts/git-hooks/pre-commit
72
-
```
73
-
For the pre-commit hooks to work, you will also need to install the [ruff](https://docs.astral.sh/ruff/) linter:
74
-
75
-
```no-highlight
76
-
python -m pip install ruff
77
-
```
78
-
...and set up the yarn packages as shown in the [Web UI Development Guide](web-ui.md)
79
-
80
-
### 4. Create a Python Virtual Environment
65
+
### 3. Create a Python Virtual Environment
81
66
82
67
A [virtual environment](https://docs.python.org/3/tutorial/venv.html) (or "venv" for short) is like a container for a set of Python packages. These allow you to build environments suited to specific projects without interfering with system packages or other projects. When installed per the documentation, NetBox uses a virtual environment in production.
Notice that the console prompt changes to indicate the active environment. This updates the necessary system environment variables to ensure that any Python scripts are run within the virtual environment.
103
88
104
-
### 5. Install Required Packages
89
+
### 4. Install Required Packages
105
90
106
91
With the virtual environment activated, install the project's required Python packages using the `pip` module. Required packages are defined in `requirements.txt`. Each line in this file specifies the name and specific version of a required package.
107
92
108
93
```no-highlight
109
94
python -m pip install -r requirements.txt
110
95
```
111
96
97
+
### 5. Install Pre-Commit
98
+
99
+
NetBox uses [`pre-commit`](https://pre-commit.com/) to automatically validate code when commiting new changes. This includes the following operations:
100
+
101
+
* Run the `ruff` Python linter
102
+
* Run Django's internal system check
103
+
* Check for missing database migrations
104
+
* Validate any changes to the documentation with `mkdocs`
105
+
* Validate Typescript & Sass styling with `yarn`
106
+
* Ensure that any modified static front end assets have been recompiled
107
+
108
+
Enable `pre-commit` with the following commands _prior_ to commiting any changes:
109
+
110
+
```no-highlight
111
+
python -m pip install ruff pre-commit
112
+
pre-commit install
113
+
```
114
+
115
+
You may also need to set up the yarn packages as shown in the [Web UI Development Guide](web-ui.md).
116
+
112
117
### 6. Configure NetBox
113
118
114
119
Within the `netbox/netbox/` directory, copy `configuration_example.py` to `configuration.py` and update the following parameters:
0 commit comments