curgen 0.4.0rc1__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.
- curgen-0.4.0rc1/.gitignore +61 -0
- curgen-0.4.0rc1/CONTRIBUTING.md +324 -0
- curgen-0.4.0rc1/LICENSE +91 -0
- curgen-0.4.0rc1/PKG-INFO +112 -0
- curgen-0.4.0rc1/README.md +89 -0
- curgen-0.4.0rc1/pricing/.gitkeep +0 -0
- curgen-0.4.0rc1/pricing/README.md +78 -0
- curgen-0.4.0rc1/pricing/aws_pricing.json +203714 -0
- curgen-0.4.0rc1/pricing/aws_pricing.schema.json +442 -0
- curgen-0.4.0rc1/pyproject.toml +125 -0
- curgen-0.4.0rc1/scenarios/.gitkeep +0 -0
- curgen-0.4.0rc1/scenarios/archetypes/mid_size_saas.yaml +382 -0
- curgen-0.4.0rc1/scenarios/archetypes/saas_startup.yaml +309 -0
- curgen-0.4.0rc1/scenarios/presets/ai-app.yaml +64 -0
- curgen-0.4.0rc1/scenarios/presets/catalog.yaml +96 -0
- curgen-0.4.0rc1/scenarios/presets/cost-spike.yaml +197 -0
- curgen-0.4.0rc1/scenarios/presets/data-platform.yaml +116 -0
- curgen-0.4.0rc1/scenarios/presets/enterprise.yaml +951 -0
- curgen-0.4.0rc1/scenarios/presets/kubernetes.yaml +101 -0
- curgen-0.4.0rc1/scenarios/presets/large.yaml +503 -0
- curgen-0.4.0rc1/scenarios/presets/medium.yaml +246 -0
- curgen-0.4.0rc1/scenarios/presets/serverless.yaml +94 -0
- curgen-0.4.0rc1/scenarios/presets/small.yaml +163 -0
- curgen-0.4.0rc1/scenarios/presets/solo.yaml +99 -0
- curgen-0.4.0rc1/scenarios/presets/startup.yaml +136 -0
- curgen-0.4.0rc1/scenarios/production_realistic_full.yaml +626 -0
- curgen-0.4.0rc1/scenarios/scale/100k_resources.yaml +100 -0
- curgen-0.4.0rc1/scenarios/scale/10k_resources.yaml +74 -0
- curgen-0.4.0rc1/scenarios/scale/1k_resources.yaml +68 -0
- curgen-0.4.0rc1/scenarios/scale/50k_resources.yaml +87 -0
- curgen-0.4.0rc1/scenarios/scale/large_multi_service.yaml +661 -0
- curgen-0.4.0rc1/scenarios/teaching/.gitkeep +0 -0
- curgen-0.4.0rc1/scenarios/teaching/attribution_shift.yaml +97 -0
- curgen-0.4.0rc1/scenarios/teaching/baseline_example.yaml +226 -0
- curgen-0.4.0rc1/scenarios/teaching/consolidated_billing.yaml +101 -0
- curgen-0.4.0rc1/scenarios/teaching/cost_change_detection.yaml +63 -0
- curgen-0.4.0rc1/scenarios/teaching/cost_spike_scenarios.yaml +78 -0
- curgen-0.4.0rc1/scenarios/teaching/ec2_ebs_lifecycle.yaml +224 -0
- curgen-0.4.0rc1/scenarios/teaching/full_lifecycle_test.yaml +418 -0
- curgen-0.4.0rc1/scenarios/teaching/multi_account_simple.yaml +174 -0
- curgen-0.4.0rc1/scenarios/teaching/multi_region.yaml +68 -0
- curgen-0.4.0rc1/scenarios/teaching/short_lived_resources.yaml +152 -0
- curgen-0.4.0rc1/scenarios/teaching/simple_lifecycle.yaml +35 -0
- curgen-0.4.0rc1/scenarios/teaching/stochastic_ec2.yaml +53 -0
- curgen-0.4.0rc1/scenarios/teaching/stochastic_simple.yaml +46 -0
- curgen-0.4.0rc1/schemas/cur2_columns.json +1050 -0
- curgen-0.4.0rc1/schemas/focus_v1_4_columns.json +522 -0
- curgen-0.4.0rc1/scripts/compare_pricing.py +317 -0
- curgen-0.4.0rc1/scripts/gen_docs.py +848 -0
- curgen-0.4.0rc1/scripts/import_pricing.py +452 -0
- curgen-0.4.0rc1/scripts/rollback_pricing.py +205 -0
- curgen-0.4.0rc1/scripts/update_pricing.py +536 -0
- curgen-0.4.0rc1/src/curgen/__init__.py +3 -0
- curgen-0.4.0rc1/src/curgen/billing_interval.py +994 -0
- curgen-0.4.0rc1/src/curgen/cli.py +959 -0
- curgen-0.4.0rc1/src/curgen/console.py +232 -0
- curgen-0.4.0rc1/src/curgen/cur2_files.py +65 -0
- curgen-0.4.0rc1/src/curgen/data.py +91 -0
- curgen-0.4.0rc1/src/curgen/director/__init__.py +9 -0
- curgen-0.4.0rc1/src/curgen/director/core.py +2246 -0
- curgen-0.4.0rc1/src/curgen/director/services/__init__.py +0 -0
- curgen-0.4.0rc1/src/curgen/director/services/api_gateway.py +322 -0
- curgen-0.4.0rc1/src/curgen/director/services/bedrock.py +313 -0
- curgen-0.4.0rc1/src/curgen/director/services/cloudfront.py +335 -0
- curgen-0.4.0rc1/src/curgen/director/services/cloudwatch_logs.py +275 -0
- curgen-0.4.0rc1/src/curgen/director/services/dynamodb.py +384 -0
- curgen-0.4.0rc1/src/curgen/director/services/ebs.py +433 -0
- curgen-0.4.0rc1/src/curgen/director/services/ec2.py +349 -0
- curgen-0.4.0rc1/src/curgen/director/services/ecs.py +600 -0
- curgen-0.4.0rc1/src/curgen/director/services/eks.py +499 -0
- curgen-0.4.0rc1/src/curgen/director/services/elasticache.py +331 -0
- curgen-0.4.0rc1/src/curgen/director/services/elb.py +299 -0
- curgen-0.4.0rc1/src/curgen/director/services/kms.py +367 -0
- curgen-0.4.0rc1/src/curgen/director/services/lambda_function.py +219 -0
- curgen-0.4.0rc1/src/curgen/director/services/nat_gateway.py +307 -0
- curgen-0.4.0rc1/src/curgen/director/services/opensearch.py +349 -0
- curgen-0.4.0rc1/src/curgen/director/services/rds.py +377 -0
- curgen-0.4.0rc1/src/curgen/director/services/redshift.py +383 -0
- curgen-0.4.0rc1/src/curgen/director/services/s3.py +301 -0
- curgen-0.4.0rc1/src/curgen/director/services/secrets_manager.py +279 -0
- curgen-0.4.0rc1/src/curgen/director/services/sns.py +285 -0
- curgen-0.4.0rc1/src/curgen/director/services/sqs.py +300 -0
- curgen-0.4.0rc1/src/curgen/director/targets.py +120 -0
- curgen-0.4.0rc1/src/curgen/expansion.py +1413 -0
- curgen-0.4.0rc1/src/curgen/models.py +1846 -0
- curgen-0.4.0rc1/src/curgen/observers/__init__.py +11 -0
- curgen-0.4.0rc1/src/curgen/observers/base.py +107 -0
- curgen-0.4.0rc1/src/curgen/observers/cur2.py +1435 -0
- curgen-0.4.0rc1/src/curgen/observers/focus.py +511 -0
- curgen-0.4.0rc1/src/curgen/observers/ground_truth.py +671 -0
- curgen-0.4.0rc1/src/curgen/parquet_writer.py +372 -0
- curgen-0.4.0rc1/src/curgen/patterns.py +356 -0
- curgen-0.4.0rc1/src/curgen/presets.py +125 -0
- curgen-0.4.0rc1/src/curgen/pricing.py +4200 -0
- curgen-0.4.0rc1/src/curgen/py.typed +0 -0
- curgen-0.4.0rc1/src/curgen/scenario.py +1628 -0
- curgen-0.4.0rc1/src/curgen/schemas.py +244 -0
- curgen-0.4.0rc1/src/curgen/selector.py +727 -0
- curgen-0.4.0rc1/src/curgen/stochastic.py +510 -0
- curgen-0.4.0rc1/src/curgen/usage_types.py +230 -0
- curgen-0.4.0rc1/src/curgen/world.py +149 -0
- curgen-0.4.0rc1/tests/__init__.py +1 -0
- curgen-0.4.0rc1/tests/_hypothesis_profiles.py +48 -0
- curgen-0.4.0rc1/tests/conftest.py +281 -0
- curgen-0.4.0rc1/tests/golden/expected/README.md +31 -0
- curgen-0.4.0rc1/tests/golden/expected/cur2/cur2_summary.json +320 -0
- curgen-0.4.0rc1/tests/golden/expected/cur2/data/BILLING_PERIOD=2024-01/curgen-cur2-00001.zstd.parquet +0 -0
- curgen-0.4.0rc1/tests/golden/expected/cur2/metadata/BILLING_PERIOD=2024-01/curgen-cur2-Manifest.json +537 -0
- curgen-0.4.0rc1/tests/golden/expected/ground_truth/ground_truth_2024-01-01.jsonl +54 -0
- curgen-0.4.0rc1/tests/golden/expected/ground_truth/ground_truth_2024-01-02.jsonl +38 -0
- curgen-0.4.0rc1/tests/golden/expected/ground_truth/ground_truth_2024-01-03.jsonl +34 -0
- curgen-0.4.0rc1/tests/golden/expected/manifest.json +42 -0
- curgen-0.4.0rc1/tests/golden_summary.py +273 -0
- curgen-0.4.0rc1/tests/test_all_scenarios_load.py +36 -0
- curgen-0.4.0rc1/tests/test_anomaly_metadata.py +409 -0
- curgen-0.4.0rc1/tests/test_anomaly_verification.py +725 -0
- curgen-0.4.0rc1/tests/test_apigateway.py +857 -0
- curgen-0.4.0rc1/tests/test_baseline_integration.py +291 -0
- curgen-0.4.0rc1/tests/test_baseline_schema.py +211 -0
- curgen-0.4.0rc1/tests/test_baseline_unsupported_dispatch.py +81 -0
- curgen-0.4.0rc1/tests/test_bedrock.py +375 -0
- curgen-0.4.0rc1/tests/test_billing_chokepoint.py +411 -0
- curgen-0.4.0rc1/tests/test_billing_interval.py +1804 -0
- curgen-0.4.0rc1/tests/test_billing_interval_cross_service_agreement.py +523 -0
- curgen-0.4.0rc1/tests/test_billing_interval_properties.py +251 -0
- curgen-0.4.0rc1/tests/test_bundled_scenario_paths.py +52 -0
- curgen-0.4.0rc1/tests/test_cli.py +397 -0
- curgen-0.4.0rc1/tests/test_cli_diagnostics.py +237 -0
- curgen-0.4.0rc1/tests/test_cli_easy_mode.py +289 -0
- curgen-0.4.0rc1/tests/test_cli_focus.py +184 -0
- curgen-0.4.0rc1/tests/test_cli_query.py +118 -0
- curgen-0.4.0rc1/tests/test_cloudfront.py +1656 -0
- curgen-0.4.0rc1/tests/test_cloudwatchlogs.py +1362 -0
- curgen-0.4.0rc1/tests/test_cross_observer_consistency.py +425 -0
- curgen-0.4.0rc1/tests/test_cur2_archetype_smoke.py +64 -0
- curgen-0.4.0rc1/tests/test_cur2_billing_periods.py +219 -0
- curgen-0.4.0rc1/tests/test_cur2_daily_aggregation.py +258 -0
- curgen-0.4.0rc1/tests/test_cur2_files.py +56 -0
- curgen-0.4.0rc1/tests/test_cur2_observer.py +535 -0
- curgen-0.4.0rc1/tests/test_cur2_windowed_expansion.py +139 -0
- curgen-0.4.0rc1/tests/test_director_unit.py +1342 -0
- curgen-0.4.0rc1/tests/test_duckdb_reconciliation.py +219 -0
- curgen-0.4.0rc1/tests/test_dynamodb.py +570 -0
- curgen-0.4.0rc1/tests/test_ebs.py +599 -0
- curgen-0.4.0rc1/tests/test_ec2_pricing.py +452 -0
- curgen-0.4.0rc1/tests/test_ecs.py +715 -0
- curgen-0.4.0rc1/tests/test_eks.py +506 -0
- curgen-0.4.0rc1/tests/test_elasticache.py +385 -0
- curgen-0.4.0rc1/tests/test_elb.py +595 -0
- curgen-0.4.0rc1/tests/test_error_handling.py +1320 -0
- curgen-0.4.0rc1/tests/test_expansion.py +592 -0
- curgen-0.4.0rc1/tests/test_expansion_bench.py +142 -0
- curgen-0.4.0rc1/tests/test_focus_observer.py +390 -0
- curgen-0.4.0rc1/tests/test_generated_docs.py +148 -0
- curgen-0.4.0rc1/tests/test_golden.py +646 -0
- curgen-0.4.0rc1/tests/test_ground_truth_billability.py +239 -0
- curgen-0.4.0rc1/tests/test_ground_truth_reconciliation.py +236 -0
- curgen-0.4.0rc1/tests/test_hash_seed_independence.py +62 -0
- curgen-0.4.0rc1/tests/test_integration.py +414 -0
- curgen-0.4.0rc1/tests/test_kms.py +885 -0
- curgen-0.4.0rc1/tests/test_lambda.py +652 -0
- curgen-0.4.0rc1/tests/test_multi_account.py +191 -0
- curgen-0.4.0rc1/tests/test_multi_region_pricing.py +118 -0
- curgen-0.4.0rc1/tests/test_multi_service_stochastic.py +668 -0
- curgen-0.4.0rc1/tests/test_natgateway.py +1344 -0
- curgen-0.4.0rc1/tests/test_opensearch.py +574 -0
- curgen-0.4.0rc1/tests/test_packaging.py +122 -0
- curgen-0.4.0rc1/tests/test_parquet_writer.py +406 -0
- curgen-0.4.0rc1/tests/test_patterns.py +586 -0
- curgen-0.4.0rc1/tests/test_patterns_properties.py +278 -0
- curgen-0.4.0rc1/tests/test_payer_accounts.py +253 -0
- curgen-0.4.0rc1/tests/test_preset_catalog.py +138 -0
- curgen-0.4.0rc1/tests/test_pricing_accuracy.py +840 -0
- curgen-0.4.0rc1/tests/test_pricing_fallback_detection.py +395 -0
- curgen-0.4.0rc1/tests/test_pricing_fallback_warnings.py +196 -0
- curgen-0.4.0rc1/tests/test_pricing_lineitem.py +259 -0
- curgen-0.4.0rc1/tests/test_pricing_new_services.py +98 -0
- curgen-0.4.0rc1/tests/test_pricing_properties.py +245 -0
- curgen-0.4.0rc1/tests/test_pricing_region_coverage.py +132 -0
- curgen-0.4.0rc1/tests/test_pricing_schema.py +309 -0
- curgen-0.4.0rc1/tests/test_rds.py +1056 -0
- curgen-0.4.0rc1/tests/test_redshift.py +607 -0
- curgen-0.4.0rc1/tests/test_s3.py +716 -0
- curgen-0.4.0rc1/tests/test_scale.py +307 -0
- curgen-0.4.0rc1/tests/test_scenario_action_coverage.py +106 -0
- curgen-0.4.0rc1/tests/test_scenario_determinism.py +221 -0
- curgen-0.4.0rc1/tests/test_scenario_output_config.py +141 -0
- curgen-0.4.0rc1/tests/test_scenario_selector_and_bounds_validation.py +211 -0
- curgen-0.4.0rc1/tests/test_scenario_smoke.py +227 -0
- curgen-0.4.0rc1/tests/test_schema_conformance.py +147 -0
- curgen-0.4.0rc1/tests/test_secretsmanager.py +876 -0
- curgen-0.4.0rc1/tests/test_selector.py +1887 -0
- curgen-0.4.0rc1/tests/test_selector_type_scoping.py +160 -0
- curgen-0.4.0rc1/tests/test_service_lifecycles.py +207 -0
- curgen-0.4.0rc1/tests/test_simulation_properties.py +235 -0
- curgen-0.4.0rc1/tests/test_sns.py +667 -0
- curgen-0.4.0rc1/tests/test_sqs.py +516 -0
- curgen-0.4.0rc1/tests/test_usage_types.py +266 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
ENV/
|
|
10
|
+
env/
|
|
11
|
+
|
|
12
|
+
# IDE
|
|
13
|
+
.vscode/
|
|
14
|
+
.idea/
|
|
15
|
+
*.swp
|
|
16
|
+
*.swo
|
|
17
|
+
*~
|
|
18
|
+
|
|
19
|
+
# Testing
|
|
20
|
+
.pytest_cache/
|
|
21
|
+
.coverage
|
|
22
|
+
htmlcov/
|
|
23
|
+
*.cover
|
|
24
|
+
.hypothesis/
|
|
25
|
+
|
|
26
|
+
# Project specific
|
|
27
|
+
output/
|
|
28
|
+
*.log
|
|
29
|
+
|
|
30
|
+
# Deferred features (ignore for now)
|
|
31
|
+
CHAOS_SCENARIOS_DEFERRED.md
|
|
32
|
+
old/*
|
|
33
|
+
.DS_Store
|
|
34
|
+
|
|
35
|
+
# Accidentally extracted system directories (should never be in project)
|
|
36
|
+
/Library/
|
|
37
|
+
/bin/
|
|
38
|
+
/etc
|
|
39
|
+
/home
|
|
40
|
+
/sbin/
|
|
41
|
+
/usr/
|
|
42
|
+
/var
|
|
43
|
+
# Local agent tooling (not part of the project)
|
|
44
|
+
.claude/
|
|
45
|
+
|
|
46
|
+
# Build artifacts from `uv build`
|
|
47
|
+
dist/
|
|
48
|
+
build/
|
|
49
|
+
*.egg-info/
|
|
50
|
+
|
|
51
|
+
# Local working notes and private configuration. Planning documents, status
|
|
52
|
+
# reports and the pricing-import denylist are never committed.
|
|
53
|
+
.private-denylist
|
|
54
|
+
docs/plans/
|
|
55
|
+
docs/PRICING_*.md
|
|
56
|
+
EXECUTIVE_STATUS_REPORT.md
|
|
57
|
+
tasks/
|
|
58
|
+
|
|
59
|
+
# Docs site build output
|
|
60
|
+
site/
|
|
61
|
+
.cache/
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Contributing to CURGen
|
|
2
|
+
|
|
3
|
+
CURGen is a single-maintainer project. Contributions are welcome, particularly bug reports,
|
|
4
|
+
real-world scenario YAMLs, and service coverage — see [What would help
|
|
5
|
+
most](#what-would-help-most).
|
|
6
|
+
|
|
7
|
+
## Building and installing
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uv build # dist/*.whl and dist/*.tar.gz
|
|
11
|
+
uv pip install dist/curgen-*.whl
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The wheel bundles its data (pricing snapshot, pinned schemas, example scenarios) under
|
|
15
|
+
`curgen/_data/`, so an installed `curgen` runs without a checkout. `curgen.data` resolves the
|
|
16
|
+
packaged copy first and falls back to the repository root, which is why the same code works in
|
|
17
|
+
both layouts. `tests/test_packaging.py` guards that configuration — if you add a data file,
|
|
18
|
+
add it to the `force-include` table in `pyproject.toml` too.
|
|
19
|
+
|
|
20
|
+
To find a shipped example scenario from Python:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from curgen.data import example_scenario
|
|
24
|
+
path = example_scenario("teaching", "cost_change_detection.yaml")
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Setup
|
|
28
|
+
|
|
29
|
+
Requires **Python 3.14+** and [uv](https://docs.astral.sh/uv/).
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv sync # or: make install
|
|
33
|
+
uv run curgen run --scenario=scenarios/teaching/cost_change_detection.yaml --dry-run
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Everything runs through uv. There is no virtualenv to activate and no global install.
|
|
37
|
+
|
|
38
|
+
## Before you open a pull request
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
make all # lint + typecheck + test
|
|
42
|
+
make ci # what CI runs, including a random-PYTHONHASHSEED pass
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
GitHub Actions checks pull requests (`.github/workflows/ci.yml`): lint and typecheck, the
|
|
46
|
+
fast suite under `PYTHONHASHSEED=0`, and a check that the built wheel installs and runs outside
|
|
47
|
+
the checkout. A strict docs build (`.github/workflows/docs.yml`) runs when the site's sources
|
|
48
|
+
change. To save Actions minutes, CI is selective:
|
|
49
|
+
|
|
50
|
+
- It runs only for changes to code, tests, data, the build or the reference docs, and skips
|
|
51
|
+
draft pull requests. A change to hand-written docs runs only the docs build.
|
|
52
|
+
- Tests marked `pricing_snapshot`, which check the bundled pricing data, run only when the
|
|
53
|
+
pricing inputs change (the list is in `ci.yml`).
|
|
54
|
+
- Merging to `main` runs nothing. A weekly job runs the fast suite on `main` under a random
|
|
55
|
+
hash seed when `main` has changed, and the scale tests run monthly.
|
|
56
|
+
|
|
57
|
+
So `make ci`, which runs both hash seeds and every marker, is the thorough check. Run it before
|
|
58
|
+
you push.
|
|
59
|
+
|
|
60
|
+
Or individually:
|
|
61
|
+
|
|
62
|
+
| Command | What it does |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `make help` | List every target |
|
|
65
|
+
| `make lint` | `ruff check` + `ruff format --check` over `src/`, `tests/`, `scripts/` |
|
|
66
|
+
| `make format` | `ruff format` — run this rather than editing formatting by hand |
|
|
67
|
+
| `make typecheck` | `mypy` in strict mode over `src/curgen/` **and `scripts/`** |
|
|
68
|
+
| `make test` | Full suite, serial and deterministic |
|
|
69
|
+
| `make test-fast` | Skips `slow`-marked scale tests — use this while iterating |
|
|
70
|
+
| `make test-parallel` | Full suite with xdist |
|
|
71
|
+
| `make ci` | Lint, typecheck, then the fast suite under `PYTHONHASHSEED=0` and `random`, as the CI jobs do |
|
|
72
|
+
| `make clean` | Remove caches |
|
|
73
|
+
|
|
74
|
+
Scale tests are marked `slow`. `make test` runs everything and takes several minutes;
|
|
75
|
+
`make test-fast` is a few seconds.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Architecture
|
|
80
|
+
|
|
81
|
+
CURGen is a **Director-Observer** discrete-event simulation.
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
┌──────────────────────────┐
|
|
85
|
+
│ FluxDirector │
|
|
86
|
+
│ SimPy clock + world │
|
|
87
|
+
│ state + billing ledger │
|
|
88
|
+
└────────────┬─────────────┘
|
|
89
|
+
│ notifies
|
|
90
|
+
┌────────────▼─────────────┐
|
|
91
|
+
│ Observers │
|
|
92
|
+
│ on_state_change │
|
|
93
|
+
│ on_hour_boundary │
|
|
94
|
+
│ on_tag_change │
|
|
95
|
+
│ finalize │
|
|
96
|
+
└────────────┬─────────────┘
|
|
97
|
+
│ renders at finalize
|
|
98
|
+
┌──────────────────┴──────────────────┐
|
|
99
|
+
▼ ▼
|
|
100
|
+
ground_truth/*.jsonl cur2/data/BILLING_PERIOD=*/
|
|
101
|
+
(the answer key) (the CUR 2.0 bill)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### `director/` is a package
|
|
105
|
+
|
|
106
|
+
`FluxDirector` (`src/curgen/director/`, imported as `from curgen.director import FluxDirector`)
|
|
107
|
+
owns the SimPy clock and the world state. It is assembled from:
|
|
108
|
+
|
|
109
|
+
- `director/core.py` — `DirectorCoreMixin` (shared SimPy wiring, ID/ARN helpers, and the
|
|
110
|
+
billing-change and notification chokepoints every mutation routes through) plus the assembled
|
|
111
|
+
`FluxDirector` class itself (dispatcher, baseline init, run loop).
|
|
112
|
+
- `director/services/<service>.py` — one mixin per service with its `create_*` / `delete_*` /
|
|
113
|
+
`modify_*` methods and `_transition_*` callbacks.
|
|
114
|
+
|
|
115
|
+
**To find how a service works, read that service's file** rather than `core.py`. It was a single
|
|
116
|
+
8.4K-line `director.py` until 2026-09-21.
|
|
117
|
+
|
|
118
|
+
### Observers
|
|
119
|
+
|
|
120
|
+
Observers are read-only subscribers with four callbacks: `on_state_change`, `on_hour_boundary`,
|
|
121
|
+
`on_tag_change`, `finalize` (`observers/base.py`).
|
|
122
|
+
|
|
123
|
+
| Observer | File | Writes |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `CUR2Observer` | `observers/cur2.py` | `cur2/data/BILLING_PERIOD=YYYY-MM/` (one file per month) |
|
|
126
|
+
| `GroundTruthObserver` | `observers/ground_truth.py` | `ground_truth/*.jsonl`, `anomalies.json` |
|
|
127
|
+
| `FocusObserver` | `observers/focus.py` | `focus/curgen-focus-v1_4.parquet` — **the CLI never constructs it**, so a `curgen run` produces no `focus/` directory. Only direct `FluxDirector` use does. |
|
|
128
|
+
|
|
129
|
+
### World state
|
|
130
|
+
|
|
131
|
+
`WorldState` (`world.py`) is a plain dict of resources, iterated in insertion order. **State
|
|
132
|
+
changes go through `world.update_resource_state(...)`**, which also records EC2 state
|
|
133
|
+
transitions; assigning `resource.state` directly skips that. `tests/test_service_lifecycles.py`
|
|
134
|
+
drives every service's real create, transition and delete path through the director.
|
|
135
|
+
|
|
136
|
+
### Rendering is ledger-driven, not event-driven
|
|
137
|
+
|
|
138
|
+
`CUR2Observer.on_state_change` and friends are **no-ops**. Every priced mutation instead goes
|
|
139
|
+
through `_record_billing_change`, which opens or closes an entry in the `IntervalLedger`
|
|
140
|
+
(`billing_interval.py`). At `finalize()`, the director closes all open intervals and the
|
|
141
|
+
observer expands the whole closed-interval ledger into hourly rows in one pass.
|
|
142
|
+
|
|
143
|
+
This is the central optimization: polling every resource every hour is O(resources × hours),
|
|
144
|
+
whereas intervals are O(changes). `_record_billing_change` is the single chokepoint — if you
|
|
145
|
+
add a priced attribute, route it through there.
|
|
146
|
+
|
|
147
|
+
### Known-false behaviour
|
|
148
|
+
|
|
149
|
+
Do not "fix" these by assuming they work, and do not build on them:
|
|
150
|
+
|
|
151
|
+
- **`manifest.json` does not carry per-event expected costs, by design.** It lists each scripted
|
|
152
|
+
event's `hour` and `action` plus an `expected_delta_source` pointer. The authoritative deltas
|
|
153
|
+
are timestamped per resource in `ground_truth/*.jsonl`. See the README's Known Limitations for
|
|
154
|
+
why a per-event figure is not exactly computable.
|
|
155
|
+
- **A silently degraded run still exits 0** unless you pass `--strict`.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Determinism
|
|
160
|
+
|
|
161
|
+
This is a hard requirement, enforced by the golden and determinism test suites. Treat any change
|
|
162
|
+
that threatens it as a bug, not a trade-off.
|
|
163
|
+
|
|
164
|
+
- `world.random = Random(scenario.seed)`. The stochastic planner gets its **own**
|
|
165
|
+
`Random(seed + 1)`, so adding stochastic configuration does not shift scripted-event randomness.
|
|
166
|
+
- The hour-tick SimPy process **must be registered before the stochastic process** in
|
|
167
|
+
`director.run()`. Reordering them changes event interleaving and breaks reproducibility.
|
|
168
|
+
- New randomness must draw from those generators — never `random.*` at module level, never
|
|
169
|
+
`datetime.now()`.
|
|
170
|
+
- **Observers must not draw from `world.random`.** Doing so shifts every later draw in the
|
|
171
|
+
simulation, resource IDs included, so attaching or removing an observer changes CUR output.
|
|
172
|
+
The removed CloudTrail and Inventory observers did exactly this. If an observer needs
|
|
173
|
+
randomness, give it its own seeded `Random`.
|
|
174
|
+
- **Never iterate a `set`/`frozenset` of resource IDs to build output or to pair elements
|
|
175
|
+
positionally.** Set iteration order for strings is derived from their hashes, so it changes
|
|
176
|
+
with `PYTHONHASHSEED` even at a fixed scenario seed. Sort by resource ID instead.
|
|
177
|
+
`tests/test_hash_seed_independence.py` checks that a full run's output is byte-identical
|
|
178
|
+
across hash seeds.
|
|
179
|
+
|
|
180
|
+
One caveat before you regenerate the golden fixture: **byte-identical output holds within an
|
|
181
|
+
environment, not across pyarrow versions.** pyarrow writes its own version into the Parquet
|
|
182
|
+
footer (`created_by`), so identical row content can still produce a differing file. If a
|
|
183
|
+
regeneration shows a diff that `duckdb` reports as zero differing rows in both directions, it
|
|
184
|
+
is the writer version stamp rather than a real change.
|
|
185
|
+
|
|
186
|
+
## Invariants
|
|
187
|
+
|
|
188
|
+
- **Baseline resources are silent.** `_initialize_baseline()` runs under `_suppress_notifications`,
|
|
189
|
+
so baseline resources bill in CUR but produce no ground-truth creation record. Intentional —
|
|
190
|
+
they predate the simulation window. Don't "fix" it.
|
|
191
|
+
- **Temporal consistency:** CUR usage hours and ground-truth timestamps align.
|
|
192
|
+
- **Offline:** pricing comes only from `pricing/aws_pricing.json`. Refreshing it is a manual,
|
|
193
|
+
out-of-band step that is never run in tests (see [Pricing data](#pricing-data)).
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Adding a new AWS service
|
|
198
|
+
|
|
199
|
+
A service touches these places, in order:
|
|
200
|
+
|
|
201
|
+
1. **`models.py`** — a `<Svc>Resource` pydantic model plus its state enum.
|
|
202
|
+
2. **`pricing.py`** — `price_<svc>()` on `PricingLoader` returning decomposed `LineItem`s
|
|
203
|
+
(not a single blended float), plus its keys in `pricing/aws_pricing.schema.json` and entries
|
|
204
|
+
under `services` in `pricing/aws_pricing.json`. `tests/test_pricing_schema.py` fails if the
|
|
205
|
+
loader reads a key the schema does not declare, or the schema declares one nothing reads.
|
|
206
|
+
3. **`director/services/<svc>.py`** — `create_*` / `delete_*` / `modify_*` methods plus
|
|
207
|
+
`_transition_*` SimPy callbacks on a new `<Svc>DirectorMixin(DirectorCoreMixin)`; mirror an
|
|
208
|
+
existing service. Then add the mixin to `FluxDirector`'s base classes and add a dispatch
|
|
209
|
+
branch in `_execute_scripted_event`.
|
|
210
|
+
4. **`scenario.py`** — add the action names to `VALID_ACTIONS`, and any new per-service fields.
|
|
211
|
+
Note `ScriptedEvent` is `extra="allow"`, so an unlisted field is accepted silently: the
|
|
212
|
+
`VALID_ACTIONS` membership is the real gate. Add the service to `BaselineResource`'s
|
|
213
|
+
validator only if it can be a baseline resource.
|
|
214
|
+
5. **`selector.py`** — import the resource class and add its selector keys to
|
|
215
|
+
`VALID_SELECTOR_KEYS`.
|
|
216
|
+
6. **Observers** — CUR line items (`observers/cur2.py`, and `observers/focus.py`) and
|
|
217
|
+
ground-truth cost rows.
|
|
218
|
+
7. **Tests** — `tests/test_<svc>.py`, plus an entry in a scenario YAML.
|
|
219
|
+
|
|
220
|
+
Then run `uv run python scripts/gen_docs.py`. The action and selector references are generated
|
|
221
|
+
from `VALID_ACTIONS` and `VALID_SELECTOR_KEYS`, so they update themselves; `make test` fails if
|
|
222
|
+
you forget.
|
|
223
|
+
|
|
224
|
+
`tests/test_scenario_action_coverage.py` asserts that `VALID_ACTIONS` and the dispatcher agree
|
|
225
|
+
in both directions, so a new action must appear in both or the suite fails.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Pricing data
|
|
230
|
+
|
|
231
|
+
`pricing/aws_pricing.json` is produced outside this repository, from the public AWS Price List
|
|
232
|
+
offer files, in the layout `pricing/aws_pricing.schema.json` defines
|
|
233
|
+
([docs/reference/pricing-schema.md](docs/reference/pricing-schema.md)). CURGen owns the schema;
|
|
234
|
+
the exporter builds against it and hands over the artifact plus a `manifest.json`.
|
|
235
|
+
|
|
236
|
+
To take a new snapshot:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
make import-pricing SRC=/path/to/handoff # or set CURGEN_PRICING_HANDOFF
|
|
240
|
+
uv run python scripts/gen_docs.py
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`scripts/import_pricing.py` refuses the artifact, leaving `pricing/` untouched, if:
|
|
244
|
+
- its sha256 doesn't match the manifest;
|
|
245
|
+
- it fails the schema (types, key names, price bounds);
|
|
246
|
+
- a region block is missing a required key that `provenance.omitted` doesn't list;
|
|
247
|
+
- its provenance doesn't account for every service;
|
|
248
|
+
- it contains local paths, internal file names, or a pattern from `.private-denylist`;
|
|
249
|
+
- it drops a service or region the current file has;
|
|
250
|
+
- an exported service still falls back to a default price in the bundled scenarios.
|
|
251
|
+
|
|
252
|
+
It prints the per-service fallback counts before and after. New prices move golden output, so
|
|
253
|
+
regenerate the fixtures in their own commit and say so in the pull request. An exporter can run
|
|
254
|
+
the same checks without importing: `uv run python scripts/import_pricing.py SRC --check-only`.
|
|
255
|
+
|
|
256
|
+
`scripts/update_pricing.py` (boto3, 5 services) predates this flow and is kept for one-off spot
|
|
257
|
+
checks; don't use it to replace the bundled file.
|
|
258
|
+
|
|
259
|
+
## Testing
|
|
260
|
+
|
|
261
|
+
- **`tests/test_golden.py`** compares output against the committed dataset in
|
|
262
|
+
`tests/golden/expected/`. Any intentional output change requires regenerating it — and the
|
|
263
|
+
authoritative procedure is the module docstring of that file. **Do not regenerate with
|
|
264
|
+
`curgen run`**: the CLI nests output under `<scenario>_<timestamp>/`, which produces a
|
|
265
|
+
fixture tree that looks right and is broken. Regeneration also rewrites
|
|
266
|
+
`cur2/cur2_summary.json`, a text sidecar of per-service/per-date row counts, cost and
|
|
267
|
+
distinct resource IDs; the Parquet diff is binary and unreadable, so the sidecar diff *is*
|
|
268
|
+
the review, and the commit message should quote it. Construct `FluxDirector` directly in Python.
|
|
269
|
+
- **`tests/test_scenario_determinism.py`** re-runs scenarios and diffs the output.
|
|
270
|
+
- **`tests/test_generated_docs.py`** fails if anything under `docs/reference/` is stale.
|
|
271
|
+
- **`tests/test_service_lifecycles.py`** drives every service's lifecycle through the director.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Documentation
|
|
276
|
+
|
|
277
|
+
Two rules, both learned the hard way:
|
|
278
|
+
|
|
279
|
+
1. **No `file:line` references in documentation.** Cite symbols and files
|
|
280
|
+
(`PricingLoader.fallbacks`, `director/core.py:_execute_scripted_event`), never line numbers.
|
|
281
|
+
Nine line-number citations had already gone stale; the `director.py` → `director/` split
|
|
282
|
+
invalidated every one of them at once. Line numbers belong in code comments.
|
|
283
|
+
|
|
284
|
+
2. **Never hand-copy a machine-readable fact into prose.** CLI flags, the action list, the
|
|
285
|
+
selector keys, the price tables and the schema columns are all generated by
|
|
286
|
+
`scripts/gen_docs.py` into `docs/reference/`. The hand-written copies that preceded them had
|
|
287
|
+
already drifted — the README listed 71 of 73 actions, 60 of 72 selector keys and 9 of 12
|
|
288
|
+
flags. If a number can be read from code, generate it.
|
|
289
|
+
|
|
290
|
+
So: hand-written docs *link* to `docs/reference/` and explain intent, ordering and gotchas.
|
|
291
|
+
They do not restate contents. Regenerate with `uv run python scripts/gen_docs.py`; the guard
|
|
292
|
+
test fails on drift and, deliberately, on hand-edits too.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Releasing
|
|
297
|
+
|
|
298
|
+
Maintainers only. Releases are published by `.github/workflows/release.yml` through PyPI
|
|
299
|
+
trusted publishing, so no token is stored anywhere.
|
|
300
|
+
|
|
301
|
+
1. Set the version in `pyproject.toml` and `src/curgen/__init__.py`, run `uv lock`, and update
|
|
302
|
+
the version in `tests/golden/expected/manifest.json`. Use a pre-release version
|
|
303
|
+
(`0.5.0rc1`) for a release candidate.
|
|
304
|
+
2. Optionally, run the Release workflow by hand to publish `main` to TestPyPI first.
|
|
305
|
+
3. Tag the commit `v<version>` and push the tag. The workflow checks the tag matches the
|
|
306
|
+
version, publishes to PyPI and creates the GitHub release, marked as a pre-release for
|
|
307
|
+
`a`, `b` and `rc` versions.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## What would help most
|
|
312
|
+
|
|
313
|
+
In rough priority order, since this is a one-person project:
|
|
314
|
+
|
|
315
|
+
1. **Bug reports against real CUR data** — especially pricing or schema mismatches.
|
|
316
|
+
2. **Service coverage.** All 20 services have create/delete and some lifecycle, but depth varies
|
|
317
|
+
a lot. The [actions reference](docs/reference/actions.md) shows where.
|
|
318
|
+
3. **Realistic scenario YAMLs.** Different topologies, regions and account structures are more
|
|
319
|
+
valuable than more features.
|
|
320
|
+
4. **Pricing coverage for omitted keys.** All 20 services cover the 36 standard regions, but a
|
|
321
|
+
few individual keys have no AWS source (listed in `provenance.omitted`). Closing one needs a
|
|
322
|
+
published price and an exporter row, not engineering effort; until then the fallback is
|
|
323
|
+
recorded rather than silently guessed.
|
|
324
|
+
5. **Fixes to the known-false behaviour above.**
|
curgen-0.4.0rc1/LICENSE
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Apache License
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
### TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
#### 1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
13
|
+
|
|
14
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
15
|
+
|
|
16
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
17
|
+
|
|
18
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
19
|
+
|
|
20
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
21
|
+
|
|
22
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
23
|
+
|
|
24
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
25
|
+
|
|
26
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on the copyright owner's behalf. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
27
|
+
|
|
28
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
29
|
+
|
|
30
|
+
#### 2. Grant of Copyright License.
|
|
31
|
+
|
|
32
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
33
|
+
|
|
34
|
+
#### 3. Grant of Patent License.
|
|
35
|
+
|
|
36
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
37
|
+
|
|
38
|
+
#### 4. Redistribution.
|
|
39
|
+
|
|
40
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
41
|
+
|
|
42
|
+
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
43
|
+
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
44
|
+
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
45
|
+
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
46
|
+
|
|
47
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
48
|
+
|
|
49
|
+
#### 5. Submission of Contributions.
|
|
50
|
+
|
|
51
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
52
|
+
|
|
53
|
+
#### 6. Trademarks.
|
|
54
|
+
|
|
55
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
56
|
+
|
|
57
|
+
#### 7. Disclaimer of Warranty.
|
|
58
|
+
|
|
59
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
60
|
+
|
|
61
|
+
#### 8. Limitation of Liability.
|
|
62
|
+
|
|
63
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
64
|
+
|
|
65
|
+
#### 9. Accepting Warranty or Additional Liability.
|
|
66
|
+
|
|
67
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
68
|
+
|
|
69
|
+
### END OF TERMS AND CONDITIONS
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### APPENDIX: How to apply the Apache License to your work
|
|
74
|
+
|
|
75
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Copyright 2026 Dan J
|
|
79
|
+
|
|
80
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
81
|
+
you may not use this file except in compliance with the License.
|
|
82
|
+
You may obtain a copy of the License at
|
|
83
|
+
|
|
84
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
85
|
+
|
|
86
|
+
Unless required by applicable law or agreed to in writing, software
|
|
87
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
88
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
|
+
See the License for the specific language governing permissions and
|
|
90
|
+
limitations under the License.
|
|
91
|
+
```
|
curgen-0.4.0rc1/PKG-INFO
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: curgen
|
|
3
|
+
Version: 0.4.0rc1
|
|
4
|
+
Summary: Synthetic AWS Cost and Usage Report generator for FinOps/cost-tooling development and testing
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Topic :: Software Development :: Testing
|
|
13
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.14
|
|
16
|
+
Requires-Dist: duckdb>=1.0.0
|
|
17
|
+
Requires-Dist: polars>=1.0.0
|
|
18
|
+
Requires-Dist: pyarrow>=15.0.0
|
|
19
|
+
Requires-Dist: pydantic>=2.10.0
|
|
20
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
21
|
+
Requires-Dist: simpy>=4.1.1
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<a href="https://github.com/AOTCLabs/curgen">
|
|
26
|
+
<picture>
|
|
27
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/AOTCLabs/curgen/raw/main/docs/assets/curgen-logo-dark.svg">
|
|
28
|
+
<source media="(prefers-color-scheme: light)" srcset="https://github.com/AOTCLabs/curgen/raw/main/docs/assets/curgen-logo-light.svg">
|
|
29
|
+
<img src="https://github.com/AOTCLabs/curgen/raw/main/docs/assets/curgen-logo-light.svg" alt="CURGen" width="420">
|
|
30
|
+
</picture>
|
|
31
|
+
</a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
# CURGen
|
|
35
|
+
|
|
36
|
+
CURGen generates synthetic AWS Cost and Usage Report (CUR) data, along with an answer key saying
|
|
37
|
+
exactly what caused every cost change. Use it to build and test FinOps, DevOps and cost-monitoring
|
|
38
|
+
tools without an AWS account or weeks of real billing data.
|
|
39
|
+
|
|
40
|
+
It simulates infrastructure over time: resources are created, scaled and torn down, and cost
|
|
41
|
+
follows from that. Runs are deterministic and work offline.
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
CURGen needs Python 3.14 or newer. It is in pre-release, so pip needs `--pre`:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install --pre curgen
|
|
49
|
+
curgen run --preset startup
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or run it without installing, using [uv](https://docs.astral.sh/uv/):
|
|
53
|
+
`uvx curgen run --preset startup`.
|
|
54
|
+
|
|
55
|
+
You get live progress, then a summary with timing, spend, top services, output size and the run
|
|
56
|
+
directory. Query that directory with SQL:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
curgen query <run_dir> \
|
|
60
|
+
"SELECT line_item_product_code, ROUND(SUM(line_item_unblended_cost), 2) AS cost
|
|
61
|
+
FROM cur2 GROUP BY 1 ORDER BY 2 DESC LIMIT 5"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`curgen presets` lists the other presets, from `solo` to `enterprise`, plus workload presets such
|
|
65
|
+
as `serverless`, `kubernetes` and `cost-spike`.
|
|
66
|
+
|
|
67
|
+
## What you get
|
|
68
|
+
|
|
69
|
+
| Output | What it is |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `cur2/` | CUR 2.0 Parquet in the AWS export layout, one file per calendar month |
|
|
72
|
+
| `ground_truth/` | The answer key: every cost change, plus labelled anomalies when the scenario defines them |
|
|
73
|
+
| `manifest.json` | Run metadata and diagnostics |
|
|
74
|
+
| `focus/` | FOCUS v1.4 Parquet, only with `--focus` |
|
|
75
|
+
|
|
76
|
+
## Limitations
|
|
77
|
+
|
|
78
|
+
Every row is on-demand usage: there are no Savings Plans, Reserved Instances, credits or tax.
|
|
79
|
+
Prices are a dated snapshot, not live. FOCUS output uses much more memory than CUR, so it has
|
|
80
|
+
scale limits. See [Limitations](https://github.com/AOTCLabs/curgen/blob/main/docs/limitations.md)
|
|
81
|
+
for the full list and the 21 services covered.
|
|
82
|
+
|
|
83
|
+
## Documentation
|
|
84
|
+
|
|
85
|
+
| Page | For |
|
|
86
|
+
|---|---|
|
|
87
|
+
| [Get started](https://github.com/AOTCLabs/curgen/blob/main/docs/get-started.md) | Install, first run, look at the output, query it |
|
|
88
|
+
| [Presets](https://github.com/AOTCLabs/curgen/blob/main/docs/presets.md) | Choosing a size or workload |
|
|
89
|
+
| [Use the data with your tool](https://github.com/AOTCLabs/curgen/blob/main/docs/guides/using-the-data.md) | DuckDB, Polars, pyarrow and Athena-style flows |
|
|
90
|
+
| [Test anomaly detection](https://github.com/AOTCLabs/curgen/blob/main/docs/guides/anomaly-detection.md) | Scoring a detector against ground truth |
|
|
91
|
+
| [CUR-only and FOCUS output](https://github.com/AOTCLabs/curgen/blob/main/docs/guides/output-options.md) | Output options and their costs |
|
|
92
|
+
| [Simulate a longer period](https://github.com/AOTCLabs/curgen/blob/main/docs/guides/longer-periods.md) | `--days`, `--start` and row counts |
|
|
93
|
+
| [Write your own scenarios](https://github.com/AOTCLabs/curgen/blob/main/docs/scenarios.md) | Scenario YAML and the shipped scenarios |
|
|
94
|
+
| [Output format spec](https://github.com/AOTCLabs/curgen/blob/main/docs/OUTPUT_FORMAT_SPEC.md) | The output contract |
|
|
95
|
+
| [Architecture](https://github.com/AOTCLabs/curgen/blob/main/docs/architecture.md) | How a run works |
|
|
96
|
+
| [CLI reference](https://github.com/AOTCLabs/curgen/blob/main/docs/reference/cli.md) | Every flag, default and exit code |
|
|
97
|
+
| [Generated reference](https://github.com/AOTCLabs/curgen/blob/main/docs/reference/schema.md) | Schema, actions, selectors and pricing |
|
|
98
|
+
|
|
99
|
+
## Contributing
|
|
100
|
+
|
|
101
|
+
See [CONTRIBUTING.md](https://github.com/AOTCLabs/curgen/blob/main/CONTRIBUTING.md), the
|
|
102
|
+
[roadmap](https://github.com/AOTCLabs/curgen/blob/main/docs/roadmap.md),
|
|
103
|
+
[SECURITY.md](https://github.com/AOTCLabs/curgen/blob/main/SECURITY.md) and the
|
|
104
|
+
[Code of Conduct](https://github.com/AOTCLabs/curgen/blob/main/CODE_OF_CONDUCT.md).
|
|
105
|
+
|
|
106
|
+
## License and trademarks
|
|
107
|
+
|
|
108
|
+
Apache-2.0. See [LICENSE](https://github.com/AOTCLabs/curgen/blob/main/LICENSE).
|
|
109
|
+
|
|
110
|
+
CURGen is an independent project and is not affiliated with, endorsed by or sponsored by Amazon
|
|
111
|
+
Web Services. AWS and the AWS service names used here are trademarks of Amazon.com, Inc. or its
|
|
112
|
+
affiliates. Prices come from the public AWS Price List.
|