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: README.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
# Traffic Generator
2
+
2
3
The tool generates a structured set of encounters for verifying automatic collision and grounding avoidance systems.
3
4
Based on input parameters such as desired situation, relative speed, relative bearing etc,
4
5
the tool will generate a set of traffic situations. The traffic situations may be written to files and/or inspected using plots.
@@ -10,12 +11,15 @@ For package documentation, see [https://dnv-opensource.github.io/ship-traffic-ge
10
11
## Installation
11
12
12
13
To install Ship Traffic Generator, run this command in your terminal:
14
+
13
15
```sh
14
16
pip install trafficgen
15
17
```
18
+
16
19
This is the preferred method to install Traffic Generator, as it will always install the most recent stable release.
17
20
18
21
You can check your installation by running:
22
+
19
23
```sh
20
24
uv run trafficgen --help
21
25
```
@@ -35,52 +39,68 @@ For further explanations, see the [documentation pages](https://dnv-opensource.g
35
39
This project uses `uv` as package manager.
36
40
If you haven't already, install [uv](https://docs.astral.sh/uv), preferably using it's ["Standalone installer"](https://docs.astral.sh/uv/getting-started/installation/#__tabbed_1_2) method: <br>
Run `uv sync -U` to create a virtual environment and install all project dependencies into it:
99
+
81
100
```sh
82
101
uv sync -U
83
102
```
103
+
84
104
> **Note**: Using `--no-dev` will omit installing development dependencies.
85
105
86
106
> **Note**: You can also define the python environment at the same time, by running for example ```uv sync -U -p 3.12``` to install Python 3.12.
@@ -90,8 +110,10 @@ uv sync -U
90
110
> `uv sync`.
91
111
92
112
### (Optional) Activate the virtual environment
113
+
93
114
When using `uv`, there is in almost all cases no longer a need to manually activate the virtual environment. <br>
94
115
`uv` will find the `.venv` virtual environment in the working directory or any parent directory, and activate it on the fly whenever you run a command via `uv` inside your project folder structure:
116
+
95
117
```sh
96
118
uv run <command>
97
119
```
@@ -100,11 +122,15 @@ However, you still _can_ manually activate the virtual environment if needed.
100
122
When developing in an IDE, for instance, this can in some cases be necessary depending on your IDE settings.
101
123
To manually activate the virtual environment, run one of the "known" legacy commands: <br>
102
124
..on Windows:
125
+
103
126
```sh
104
127
.venv\Scripts\activate.bat
105
128
```
129
+
106
130
> **Note**: If you use the cmd terminal in VS Code, it will show this activated venv as (trafficgen) at the start of every line command.
131
+
107
132
..on Linux:
133
+
108
134
```sh
109
135
source .venv/bin/activate
110
136
```
@@ -126,7 +152,31 @@ pytest .
126
152
For pre-generated package documentation, see [https://dnv-opensource.github.io/ship-traffic-generator/](https://dnv-opensource.github.io/ship-traffic-generator/)
127
153
128
154
To generate documentation from the source code, use:
155
+
129
156
```sh
130
157
uv run docs/make.bat html
131
158
```
159
+
132
160
The html documentation will then be available in `docs/build/html/index.html`
161
+
162
+
### Testing PRs
163
+
164
+
1. Check out the PR branch
165
+
166
+
1. Update dependencies, re-install latest package, and run tests (ensure all pass):
167
+
168
+
```sh
169
+
.venv\Scripts\activate.bat
170
+
uv self update
171
+
uv sync -U
172
+
uv pip install -e .
173
+
pytest .
174
+
```
175
+
176
+
1. Run any additional tests you want / care about / related to PR topic, e.g.:
177
+
178
+
```sh
179
+
trafficgen gen-situation -o test_output
180
+
```
181
+
182
+
and make edits to config or change this command to test new functionalities.
0 commit comments