mcprojsim 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcprojsim-0.2.0/LICENSE +21 -0
- mcprojsim-0.2.0/PKG-INFO +630 -0
- mcprojsim-0.2.0/README.md +594 -0
- mcprojsim-0.2.0/pyproject.toml +121 -0
- mcprojsim-0.2.0/src/mcprojsim/__init__.py +24 -0
- mcprojsim-0.2.0/src/mcprojsim/analysis/__init__.py +7 -0
- mcprojsim-0.2.0/src/mcprojsim/analysis/critical_path.py +52 -0
- mcprojsim-0.2.0/src/mcprojsim/analysis/sensitivity.py +57 -0
- mcprojsim-0.2.0/src/mcprojsim/analysis/statistics.py +67 -0
- mcprojsim-0.2.0/src/mcprojsim/cli.py +242 -0
- mcprojsim-0.2.0/src/mcprojsim/config.py +213 -0
- mcprojsim-0.2.0/src/mcprojsim/exporters/__init__.py +7 -0
- mcprojsim-0.2.0/src/mcprojsim/exporters/csv_exporter.py +103 -0
- mcprojsim-0.2.0/src/mcprojsim/exporters/html_exporter.py +672 -0
- mcprojsim-0.2.0/src/mcprojsim/exporters/json_exporter.py +114 -0
- mcprojsim-0.2.0/src/mcprojsim/models/__init__.py +27 -0
- mcprojsim-0.2.0/src/mcprojsim/models/project.py +306 -0
- mcprojsim-0.2.0/src/mcprojsim/models/simulation.py +144 -0
- mcprojsim-0.2.0/src/mcprojsim/parsers/__init__.py +6 -0
- mcprojsim-0.2.0/src/mcprojsim/parsers/error_reporting.py +746 -0
- mcprojsim-0.2.0/src/mcprojsim/parsers/toml_parser.py +98 -0
- mcprojsim-0.2.0/src/mcprojsim/parsers/yaml_parser.py +94 -0
- mcprojsim-0.2.0/src/mcprojsim/simulation/__init__.py +13 -0
- mcprojsim-0.2.0/src/mcprojsim/simulation/distributions.py +72 -0
- mcprojsim-0.2.0/src/mcprojsim/simulation/engine.py +264 -0
- mcprojsim-0.2.0/src/mcprojsim/simulation/risk_evaluator.py +50 -0
- mcprojsim-0.2.0/src/mcprojsim/simulation/scheduler.py +166 -0
- mcprojsim-0.2.0/src/mcprojsim/utils/__init__.py +6 -0
- mcprojsim-0.2.0/src/mcprojsim/utils/logging.py +33 -0
- mcprojsim-0.2.0/src/mcprojsim/utils/validation.py +37 -0
mcprojsim-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Johan Persson <johan162@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
mcprojsim-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcprojsim
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Monte Carlo simulation system for software development effort estimation
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: monte-carlo,simulation,project-management,estimation
|
|
8
|
+
Author: Johan Persson
|
|
9
|
+
Author-email: johan162@gmail.com
|
|
10
|
+
Requires-Python: >=3.14
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Topic :: Office/Business
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
21
|
+
Classifier: Topic :: Utilities
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Dist: click (>=8.0.0)
|
|
24
|
+
Requires-Dist: jinja2 (>=3.0.0)
|
|
25
|
+
Requires-Dist: matplotlib (>=3.5.0)
|
|
26
|
+
Requires-Dist: numpy (>=2.4.2)
|
|
27
|
+
Requires-Dist: pydantic (>=2.0.0)
|
|
28
|
+
Requires-Dist: pyyaml (>=6.0)
|
|
29
|
+
Requires-Dist: scipy (>=1.17.1)
|
|
30
|
+
Requires-Dist: tomli-w (>=1.0.0)
|
|
31
|
+
Project-URL: Documentation, https://github.com/johan162/mcprojsim/docs
|
|
32
|
+
Project-URL: Homepage, https://github.com/johan162/mcprojsim
|
|
33
|
+
Project-URL: Repository, https://github.com/johan162/mcprojsim
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# Monte Carlo Project Simulator (mcprojsim)
|
|
37
|
+
|
|
38
|
+
| Category | Link |
|
|
39
|
+
|----------|--------|
|
|
40
|
+
|**Package**|[](https://pypi.org/project/mcprojsim/) [](https://www.python.org/downloads/)|
|
|
41
|
+
|**Documentation**|[](https://johan162.github.io/mcprojsim/)|
|
|
42
|
+
|**License**|[](https://opensource.org/licenses/MIT)|
|
|
43
|
+
|**Release**|[](https://github.com/johan162/mcprojsim/releases)|
|
|
44
|
+
|**CI/CD**|[](https://github.com/johan162/mcprojsim/actions/workflows/ci.yml) [](https://github.com/johan162/mcprojsim/actions/workflows/docs.yml) [](coverage.svg)|
|
|
45
|
+
|**Code Quality**|[](https://github.com/psf/black) [](https://mypy-lang.org/) [](https://flake8.pycqa.org/)|
|
|
46
|
+
|Repo URL|[](https://github.com/johan162/mcprojsim)|
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Table of Content
|
|
50
|
+
|
|
51
|
+
- [Monte Carlo Project Simulator (mcprojsim)](#monte-carlo-project-simulator-mcprojsim)
|
|
52
|
+
- [Table of Content](#table-of-content)
|
|
53
|
+
- [Overview](#overview)
|
|
54
|
+
- [Features](#features)
|
|
55
|
+
- [Installation](#installation)
|
|
56
|
+
- [Best for end users: Install with `pipx`](#best-for-end-users-install-with-pipx)
|
|
57
|
+
- [Install with `pipx`](#install-with-pipx)
|
|
58
|
+
- [Install a pre-release from TestPyPI](#install-a-pre-release-from-testpypi)
|
|
59
|
+
- [Containers: Run with Podman or Docker](#containers-run-with-podman-or-docker)
|
|
60
|
+
- [Prerequisites](#prerequisites)
|
|
61
|
+
- [Build the container image](#build-the-container-image)
|
|
62
|
+
- [Run the CLI in the container](#run-the-cli-in-the-container)
|
|
63
|
+
- [Run Container with local files](#run-container-with-local-files)
|
|
64
|
+
- [Container Troubleshooting](#container-troubleshooting)
|
|
65
|
+
- [Local development / source install prerequisites](#local-development--source-install-prerequisites)
|
|
66
|
+
- [From Source](#from-source)
|
|
67
|
+
- [Activate the Virtual Environment](#activate-the-virtual-environment)
|
|
68
|
+
- [From PyPI (when published)](#from-pypi-when-published)
|
|
69
|
+
- [Quick Start](#quick-start)
|
|
70
|
+
- [1. Create a Project Definition File](#1-create-a-project-definition-file)
|
|
71
|
+
- [2. Run the Simulation](#2-run-the-simulation)
|
|
72
|
+
- [3. Validate Input Files](#3-validate-input-files)
|
|
73
|
+
- [Command-Line Interface](#command-line-interface)
|
|
74
|
+
- [Commands](#commands)
|
|
75
|
+
- [Options](#options)
|
|
76
|
+
- [Configuration](#configuration)
|
|
77
|
+
- [Examples](#examples)
|
|
78
|
+
- [Documentation](#documentation)
|
|
79
|
+
- [View Documentation Locally](#view-documentation-locally)
|
|
80
|
+
- [Documentation Server Options](#documentation-server-options)
|
|
81
|
+
- [Development](#development)
|
|
82
|
+
- [Setup Development Environment](#setup-development-environment)
|
|
83
|
+
- [Run Tests](#run-tests)
|
|
84
|
+
- [Code Quality](#code-quality)
|
|
85
|
+
- [Build Documentation](#build-documentation)
|
|
86
|
+
- [Project Structure](#project-structure)
|
|
87
|
+
- [Requirements](#requirements)
|
|
88
|
+
- [License](#license)
|
|
89
|
+
- [Contributing](#contributing)
|
|
90
|
+
- [Support](#support)
|
|
91
|
+
- [Citation](#citation)
|
|
92
|
+
- [Acknowledgments](#acknowledgments)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## Overview
|
|
96
|
+
|
|
97
|
+
A Monte Carlo simulation system for software development effort estimation. This tool helps you generate probabilistic estimates for project completion by modeling uncertainties in task duration, applying risk impacts, handling task dependencies, and generating confidence intervals through iterative simulation.
|
|
98
|
+
|
|
99
|
+
## Features
|
|
100
|
+
|
|
101
|
+
- **Triangular & Log-Normal Distribution Sampling** for task estimates
|
|
102
|
+
- **Project-Level and Task-Level Risk Modeling** with probabilistic impacts
|
|
103
|
+
- **Task Dependency Resolution** (precedence constraints)
|
|
104
|
+
- **Uncertainty Factor Application** (team experience, requirements maturity, etc.)
|
|
105
|
+
- **Resource Allocation and Availability Modeling**
|
|
106
|
+
- **Percentile-Based Confidence Intervals** (P25, P50, P75, P80, P85, P90, P95, P99)
|
|
107
|
+
- **Sensitivity Analysis** and critical path identification
|
|
108
|
+
- **Multiple Export Formats** (JSON, CSV, HTML reports)
|
|
109
|
+
|
|
110
|
+
## Installation
|
|
111
|
+
|
|
112
|
+
### Best for end users: Install with `pipx`
|
|
113
|
+
|
|
114
|
+
If you want to install `mcprojsim` as a normal command-line tool, `pipx` is the simplest option.
|
|
115
|
+
It installs the application in an isolated environment and makes the `mcprojsim` command directly available on your `PATH`.
|
|
116
|
+
This is however limited to official releases (either pre- or production)
|
|
117
|
+
|
|
118
|
+
#### Install with `pipx`
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Install pipx if needed
|
|
122
|
+
python3 -m pip install --user pipx
|
|
123
|
+
python3 -m pipx ensurepath
|
|
124
|
+
|
|
125
|
+
# Install mcprojsim
|
|
126
|
+
pipx install mcprojsim
|
|
127
|
+
|
|
128
|
+
# Run it directly
|
|
129
|
+
mcprojsim --help
|
|
130
|
+
mcprojsim --version
|
|
131
|
+
mcprojsim simulate examples/sample_project.yaml
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
This is the recommended non-container option for end users.
|
|
135
|
+
|
|
136
|
+
#### Install a pre-release from TestPyPI
|
|
137
|
+
|
|
138
|
+
Pre-releases are published (based on pre-release tags) to TestPyPI before a full production release reaches PyPI.
|
|
139
|
+
When installing from TestPyPI, use TestPyPI as the main index and keep PyPI as the extra index for dependencies.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Install the latest pre-release from TestPyPI
|
|
143
|
+
pipx install \
|
|
144
|
+
--pip-args="--pre --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple" \
|
|
145
|
+
mcprojsim
|
|
146
|
+
|
|
147
|
+
# Or install a specific pre-release version
|
|
148
|
+
pipx install \
|
|
149
|
+
--pip-args="--index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple" \
|
|
150
|
+
mcprojsim==0.2.0rc2
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
If `mcprojsim` is already installed with `pipx`, use `pipx upgrade` with the same `--pip-args` values.
|
|
154
|
+
|
|
155
|
+
### Containers: Run with Podman or Docker
|
|
156
|
+
|
|
157
|
+
Running `mcprojsim` as a container is the best way to run the downloaded source in a defined environment.
|
|
158
|
+
It avoids installing Poetry locally and provides an isolated runtime with the CLI preconfigured.
|
|
159
|
+
This is recommended for advanced users and/or developers who might modify the source or run development
|
|
160
|
+
versions of the project.
|
|
161
|
+
|
|
162
|
+
#### Prerequisites
|
|
163
|
+
|
|
164
|
+
- Podman or Docker
|
|
165
|
+
|
|
166
|
+
#### Build the container image
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Clone the repository
|
|
170
|
+
git clone https://github.com/johan162/mcprojsim.git
|
|
171
|
+
cd mcprojsim
|
|
172
|
+
|
|
173
|
+
# Automaticall selects available container manager (Podman or Docker)
|
|
174
|
+
make container-build
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
This will be the same as ether running
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Preferred: Podman
|
|
181
|
+
podman build -t mcprojsim .
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
or
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Alternative: Docker
|
|
188
|
+
docker build -t mcprojsim .
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Run the CLI in the container
|
|
192
|
+
|
|
193
|
+
To run the container the recommended way is to use the supplied `./bin/mcprojsim.sh` shell script. It
|
|
194
|
+
will allow you to run the program as any other CLI tool.
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
./bin/mcprojsim --help
|
|
198
|
+
./bin/mcprojsim simulate sample_project.yml
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
The container entrypoint is already set to `mcprojsim`, so you only need to pass the CLI arguments, for example as (here the cntainer is automatically removed as soon as it is finished)
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Preferred: Podman
|
|
206
|
+
podman run --rm mcprojsim --help
|
|
207
|
+
podman run --rm mcprojsim --version
|
|
208
|
+
|
|
209
|
+
# Alternative: Docker
|
|
210
|
+
docker run --rm mcprojsim --help
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Run Container with local files
|
|
214
|
+
|
|
215
|
+
Mount your working directory into the container so it can read input files and write result files.
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Preferred: Podman
|
|
219
|
+
podman run --rm -v "$PWD:/work:Z" mcprojsim validate examples/sample_project.yaml
|
|
220
|
+
podman run --rm -v "$PWD:/work:Z" mcprojsim simulate examples/sample_project.yaml --seed 42
|
|
221
|
+
|
|
222
|
+
# Alternative: Docker
|
|
223
|
+
docker run --rm -v "$PWD:/work" mcprojsim validate examples/sample_project.yaml
|
|
224
|
+
docker run --rm -v "$PWD:/work" mcprojsim simulate examples/sample_project.yaml --seed 42
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Generated JSON, CSV, and HTML reports are written back to your local working directory.
|
|
228
|
+
|
|
229
|
+
#### Container Troubleshooting
|
|
230
|
+
|
|
231
|
+
- **No proxy in your environment:** you do not need any certificate file or extra build flags. A standard `podman build -t mcprojsim .` or `docker build -t mcprojsim .` works as-is.
|
|
232
|
+
- **Corporate proxy / TLS interception:** some environments re-sign HTTPS traffic with an internal CA. In that case, pass the CA certificate as a build secret so Poetry and `pip` can trust outbound HTTPS during the image build.
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Preferred: Podman
|
|
236
|
+
podman build \
|
|
237
|
+
--build-arg USE_PROXY_CA=true \
|
|
238
|
+
--secret id=proxy_ca,src=CA_proxy_fw_all.pem \
|
|
239
|
+
-t mcprojsim .
|
|
240
|
+
|
|
241
|
+
# Alternative: Docker
|
|
242
|
+
docker build \
|
|
243
|
+
--build-arg USE_PROXY_CA=true \
|
|
244
|
+
--secret id=proxy_ca,src=CA_proxy_fw_all.pem \
|
|
245
|
+
-t mcprojsim .
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Local development / source install prerequisites
|
|
249
|
+
|
|
250
|
+
- Python 3.14 or higher
|
|
251
|
+
- [Poetry](https://python-poetry.org/) for dependency management
|
|
252
|
+
|
|
253
|
+
Install Poetry if you haven't already:
|
|
254
|
+
```bash
|
|
255
|
+
curl -sSL https://install.python-poetry.org | python3 -
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### From Source
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# Clone the repository
|
|
262
|
+
git clone https://github.com/johan162/mcprojsim.git
|
|
263
|
+
cd mcprojsim
|
|
264
|
+
|
|
265
|
+
# Install all dependencies (including dev dependencies)
|
|
266
|
+
poetry install
|
|
267
|
+
|
|
268
|
+
# Or install only production dependencies
|
|
269
|
+
poetry install --only main
|
|
270
|
+
|
|
271
|
+
# Or install with documentation dependencies
|
|
272
|
+
poetry install --with docs
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Activate the Virtual Environment
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Activate the Poetry-managed virtual environment
|
|
279
|
+
poetry shell
|
|
280
|
+
|
|
281
|
+
# Or run commands directly with poetry run
|
|
282
|
+
poetry run mcprojsim --help
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### From PyPI (when published)
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Using pipx
|
|
289
|
+
pipx install mcprojsim
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# Or using Poetry in your project
|
|
293
|
+
poetry add mcprojsim
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
If you prefer running the project from a source checkout without installing it locally, you can also use the containerized CLI wrapper:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
./bin/mcprojsim.sh --help
|
|
300
|
+
./bin/mcprojsim.sh simulate project.yaml --seed 12345
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Quick Start
|
|
304
|
+
|
|
305
|
+
### 1. Create a Project Definition File
|
|
306
|
+
|
|
307
|
+
Create a `project.yaml` file:
|
|
308
|
+
|
|
309
|
+
```yaml
|
|
310
|
+
project:
|
|
311
|
+
name: "My Project"
|
|
312
|
+
description: "Sample project for estimation"
|
|
313
|
+
start_date: "2025-11-01"
|
|
314
|
+
confidence_levels: [25, 50, 75, 80, 85, 90, 95, 99]
|
|
315
|
+
|
|
316
|
+
tasks:
|
|
317
|
+
- id: "task_001"
|
|
318
|
+
name: "Database schema design"
|
|
319
|
+
description: "Design normalized schema"
|
|
320
|
+
estimate:
|
|
321
|
+
min: 3
|
|
322
|
+
most_likely: 5
|
|
323
|
+
max: 10
|
|
324
|
+
unit: "days"
|
|
325
|
+
dependencies: []
|
|
326
|
+
uncertainty_factors:
|
|
327
|
+
team_experience: "high"
|
|
328
|
+
requirements_maturity: "medium"
|
|
329
|
+
technical_complexity: "low"
|
|
330
|
+
risks:
|
|
331
|
+
- id: "risk_001"
|
|
332
|
+
name: "Schema migration issues"
|
|
333
|
+
probability: 0.20
|
|
334
|
+
impact: 2
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### 2. Run the Simulation
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
# Run with default settings (10,000 iterations)
|
|
341
|
+
poetry run mcprojsim simulate project.yaml
|
|
342
|
+
|
|
343
|
+
# Or activate the shell first
|
|
344
|
+
poetry shell
|
|
345
|
+
mcprojsim simulate project.yaml
|
|
346
|
+
|
|
347
|
+
# Specify number of iterations
|
|
348
|
+
mcprojsim simulate project.yaml --iterations 50000
|
|
349
|
+
|
|
350
|
+
# Use custom config file
|
|
351
|
+
mcprojsim simulate project.yaml --config custom_config.yaml
|
|
352
|
+
|
|
353
|
+
# Specify random seed for reproducibility
|
|
354
|
+
mcprojsim simulate project.yaml --seed 12345
|
|
355
|
+
|
|
356
|
+
# Export to specific formats
|
|
357
|
+
mcprojsim simulate project.yaml --output-format json,html
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Container equivalent:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# Preferred: Podman
|
|
364
|
+
podman run --rm -v "$PWD:/work:Z" mcprojsim simulate project.yaml --seed 12345
|
|
365
|
+
|
|
366
|
+
# Alternative: Docker
|
|
367
|
+
docker run --rm -v "$PWD:/work" mcprojsim simulate project.yaml --seed 12345
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### 3. Validate Input Files
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
mcprojsim validate project.yaml
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Container equivalent:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Preferred: Podman
|
|
380
|
+
podman run --rm -v "$PWD:/work:Z" mcprojsim validate project.yaml
|
|
381
|
+
|
|
382
|
+
# Alternative: Docker
|
|
383
|
+
docker run --rm -v "$PWD:/work" mcprojsim validate project.yaml
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Command-Line Interface
|
|
387
|
+
|
|
388
|
+
### Commands
|
|
389
|
+
|
|
390
|
+
- `mcprojsim simulate <project-file>` - Run Monte Carlo simulation
|
|
391
|
+
- `mcprojsim validate <project-file>` - Validate input file without running
|
|
392
|
+
- `mcprojsim config show` - Show current configuration
|
|
393
|
+
|
|
394
|
+
### Options
|
|
395
|
+
|
|
396
|
+
- `--iterations, -n` - Number of simulation iterations (default: 10000)
|
|
397
|
+
- `--config, -c` - Path to configuration file
|
|
398
|
+
- `--seed, -s` - Random seed for reproducibility
|
|
399
|
+
- `--output, -o` - Output file path
|
|
400
|
+
- `--output-format, -f` - Output formats: json, csv, html (comma-separated)
|
|
401
|
+
- `--quiet, -q` - Suppress progress output
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
## Configuration
|
|
405
|
+
|
|
406
|
+
Create a `config.yaml` file to customize uncertainty factors:
|
|
407
|
+
|
|
408
|
+
```yaml
|
|
409
|
+
uncertainty_factors:
|
|
410
|
+
team_experience:
|
|
411
|
+
high: 0.90 # 10% faster
|
|
412
|
+
medium: 1.0 # Baseline
|
|
413
|
+
low: 1.30 # 30% slower
|
|
414
|
+
|
|
415
|
+
requirements_maturity:
|
|
416
|
+
high: 1.0
|
|
417
|
+
medium: 1.15
|
|
418
|
+
low: 1.40
|
|
419
|
+
|
|
420
|
+
simulation:
|
|
421
|
+
default_iterations: 10000
|
|
422
|
+
random_seed: null
|
|
423
|
+
|
|
424
|
+
output:
|
|
425
|
+
formats: ["json", "csv", "html"]
|
|
426
|
+
include_histogram: true
|
|
427
|
+
histogram_bins: 50
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
## Examples
|
|
431
|
+
|
|
432
|
+
See the `examples/` directory for:
|
|
433
|
+
- `sample_project.yaml` - Complete project definition example
|
|
434
|
+
- `sample_config.yaml` - Configuration file example
|
|
435
|
+
|
|
436
|
+
To use a custom configuration file together with a project file use this syntax (see `mcprojsim simulate --help` for supported options)
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
mcprojsim simulate --config example/sample_config.yaml examples/sample_project.yaml
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
## Documentation
|
|
444
|
+
|
|
445
|
+
The source documentation is available in the `docs/` directory. These doc sources are used to build a `mkdocs` site that can be run locally. It is also available in GitHub as a static site [mcprojsim documentation](https://johan162.github.io/mcprojsim/)
|
|
446
|
+
|
|
447
|
+
- **[Getting Started](docs/getting_started.md)** - Step-by-step guide to your first simulation
|
|
448
|
+
- **[Formal Grammar](docs/grammar.md)** - Complete EBNF specification of the input file format
|
|
449
|
+
- **[Examples](docs/examples.md)** - Working examples and use cases
|
|
450
|
+
- **[Configuration](docs/configuration.md)** - Customizing uncertainty factors
|
|
451
|
+
- **[API Reference](docs/api_reference.md)** - Python API documentation
|
|
452
|
+
|
|
453
|
+
### View Documentation Locally
|
|
454
|
+
|
|
455
|
+
Use the local MkDocs server when you are editing documentation or Python code and want fast live-reload during development.
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# Install with documentation dependencies
|
|
459
|
+
poetry install --with docs
|
|
460
|
+
|
|
461
|
+
# Serve documentation locally at http://127.0.0.1:8000
|
|
462
|
+
poetry run mkdocs serve
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Documentation Server Options
|
|
466
|
+
|
|
467
|
+
- Use `make docs-serve` for day-to-day documentation editing with the fastest feedback loop.
|
|
468
|
+
- Use `make docs-container-start` when you want to validate the containerized docs environment or run the docs server without relying on a local Poetry environment.
|
|
469
|
+
- Use `./scripts/docs-contctl.sh ...` directly when you want full container lifecycle control such as `start`, `stop`, `restart`, `status`, `logs`, or `build`.
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
# Fast local development server
|
|
473
|
+
make docs-serve
|
|
474
|
+
|
|
475
|
+
# Containerized docs server
|
|
476
|
+
make docs-container-start
|
|
477
|
+
|
|
478
|
+
# Direct container management
|
|
479
|
+
./scripts/docs-contctl.sh status
|
|
480
|
+
./scripts/docs-contctl.sh logs --follow
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
## Development
|
|
484
|
+
|
|
485
|
+
### Setup Development Environment
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# Install with all dependencies including dev dependencies
|
|
489
|
+
poetry install
|
|
490
|
+
|
|
491
|
+
# Activate the virtual environment
|
|
492
|
+
poetry shell
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### Run Tests
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
# Run all tests
|
|
500
|
+
poetry run pytest
|
|
501
|
+
|
|
502
|
+
# Run with coverage
|
|
503
|
+
poetry run pytest --cov=mcprojsim --cov-report=html
|
|
504
|
+
|
|
505
|
+
# Run tests in parallel
|
|
506
|
+
poetry run pytest -n auto
|
|
507
|
+
|
|
508
|
+
# Run specific test file
|
|
509
|
+
poetry run pytest tests/test_simulation.py
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### Code Quality
|
|
514
|
+
|
|
515
|
+
```bash
|
|
516
|
+
# Format code
|
|
517
|
+
poetry run black src/ tests/
|
|
518
|
+
|
|
519
|
+
# Type checking
|
|
520
|
+
poetry run mypy src/
|
|
521
|
+
|
|
522
|
+
# Linting
|
|
523
|
+
poetry run flake8 src/ tests/
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
or using the `Makefile`
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
# Run both Lint, formatting, and type checks
|
|
530
|
+
make check
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### Build Documentation
|
|
534
|
+
|
|
535
|
+
Choose the command based on what you are doing:
|
|
536
|
+
|
|
537
|
+
- `make docs-serve` or `poetry run mkdocs serve` for editing docs locally.
|
|
538
|
+
- `make docs-container-start` for the containerized docs server.
|
|
539
|
+
- `make docs-container-stop` and `make docs-container-logs` for container lifecycle tasks.
|
|
540
|
+
|
|
541
|
+
```bash
|
|
542
|
+
# Install with documentation dependencies
|
|
543
|
+
poetry install --with docs
|
|
544
|
+
|
|
545
|
+
# Serve documentation locally
|
|
546
|
+
poetry run mkdocs serve
|
|
547
|
+
|
|
548
|
+
# Or use the Makefile wrapper
|
|
549
|
+
make docs-serve
|
|
550
|
+
|
|
551
|
+
# Start the containerized docs server
|
|
552
|
+
make docs-container-start
|
|
553
|
+
|
|
554
|
+
# Stop the containerized docs server
|
|
555
|
+
make docs-container-stop
|
|
556
|
+
|
|
557
|
+
# Build documentation
|
|
558
|
+
poetry run mkdocs build
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
## Project Structure
|
|
562
|
+
|
|
563
|
+
```
|
|
564
|
+
mcprojsim/
|
|
565
|
+
├── bin/ # User-facing wrapper scripts
|
|
566
|
+
│ └── mcprojsim.sh # Runs the containerized CLI like a local command
|
|
567
|
+
├── src/mcprojsim/ # Source code
|
|
568
|
+
│ ├── models/ # Data models
|
|
569
|
+
│ ├── parsers/ # Input file parsers
|
|
570
|
+
│ ├── simulation/ # Simulation engine
|
|
571
|
+
│ ├── analysis/ # Statistical analysis
|
|
572
|
+
│ ├── exporters/ # Output exporters
|
|
573
|
+
│ └── utils/ # Utilities
|
|
574
|
+
├── tests/ # Test files
|
|
575
|
+
├── docs/ # Documentation
|
|
576
|
+
├── examples/ # Example files
|
|
577
|
+
└── scripts/ # Build, release, setup, and docs-control scripts
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
## Requirements
|
|
581
|
+
|
|
582
|
+
- Python 3.14+
|
|
583
|
+
- Poetry 2.0+
|
|
584
|
+
- NumPy 2.3.4+
|
|
585
|
+
- PyYAML 6.0+
|
|
586
|
+
- Pydantic 2.0+
|
|
587
|
+
- Click 8.0+
|
|
588
|
+
|
|
589
|
+
All Python dependencies are managed by Poetry and will be installed automatically.
|
|
590
|
+
|
|
591
|
+
## License
|
|
592
|
+
|
|
593
|
+
MIT License - see LICENSE file for details.
|
|
594
|
+
|
|
595
|
+
## Contributing
|
|
596
|
+
|
|
597
|
+
Contributions are welcome! Please:
|
|
598
|
+
1. Fork the repository
|
|
599
|
+
2. Create a feature branch
|
|
600
|
+
3. Make your changes with tests
|
|
601
|
+
4. Run the test suite
|
|
602
|
+
5. Submit a pull request
|
|
603
|
+
|
|
604
|
+
## Support
|
|
605
|
+
|
|
606
|
+
For issues and questions:
|
|
607
|
+
- GitHub Issues: https://github.com/johan162/mcprojsim/issues
|
|
608
|
+
- Documentation: https://github.com/johan162/mcprojsim/docs
|
|
609
|
+
|
|
610
|
+
## Citation
|
|
611
|
+
|
|
612
|
+
If you use this tool in your research or project management, please cite:
|
|
613
|
+
|
|
614
|
+
```
|
|
615
|
+
@software{mcprojsim,
|
|
616
|
+
title = {Monte Carlo Project Simulator},
|
|
617
|
+
author = {Johan Persson},
|
|
618
|
+
year = {2026},
|
|
619
|
+
url = {https://github.com/johan162/mcprojsim},
|
|
620
|
+
version = {0.2.0}
|
|
621
|
+
}
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
## Acknowledgments
|
|
625
|
+
|
|
626
|
+
Inspired by the work of:
|
|
627
|
+
- Steve McConnell - *Software Estimation: Demystifying the Black Art*
|
|
628
|
+
- Frederick Brooks - *The Mythical Man-Month*
|
|
629
|
+
- Douglas Hubbard - *How to Measure Anything in Cybersecurity Risk*
|
|
630
|
+
|