crc-framework 0.5.2__tar.gz → 0.5.3__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.
- {crc_framework-0.5.2 → crc_framework-0.5.3}/.all-contributorsrc +2 -1
- {crc_framework-0.5.2 → crc_framework-0.5.3}/.github/workflows/release.yaml +1 -2
- {crc_framework-0.5.2 → crc_framework-0.5.3}/Cargo.lock +3 -3
- {crc_framework-0.5.2 → crc_framework-0.5.3}/Cargo.toml +1 -1
- crc_framework-0.5.3/PKG-INFO +159 -0
- crc_framework-0.5.3/README.md +131 -0
- crc_framework-0.5.3/docs/README.md +35 -0
- crc_framework-0.5.3/docs/development.md +142 -0
- crc_framework-0.5.3/docs/history/wasm-quantile-consumer.md +315 -0
- crc_framework-0.5.3/docs/impact-contracts.md +55 -0
- crc_framework-0.5.2/js/README.md → crc_framework-0.5.3/docs/javascript.md +7 -58
- crc_framework-0.5.3/docs/python.md +307 -0
- crc_framework-0.5.3/docs/releases.md +72 -0
- crc_framework-0.5.3/js/README.md +76 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/build.mjs +4 -1
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/package-lock.json +2 -2
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/package.json +1 -1
- crc_framework-0.5.3/js/publish.mjs +29 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/consumer.mjs +4 -4
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/publish.test.mjs +17 -2
- crc_framework-0.5.2/PKG-INFO +0 -655
- crc_framework-0.5.2/README.md +0 -627
- crc_framework-0.5.2/js/publish.mjs +0 -16
- {crc_framework-0.5.2 → crc_framework-0.5.3}/.github/workflows/npm.yaml +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/.gitignore +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/.python-version +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/LICENSE +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/THIRD_PARTY_NOTICES.md +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/build.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/Cargo.toml +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/canonical.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/constants.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/distribution/lmoments.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/distribution.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/error.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/definition.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/error.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/expectation.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/json.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/kernel.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/mod.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/pushforward.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/quadrature.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/record.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/reference.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/registry.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/source.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/lib.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/metrics.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/ag_params.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/energy_params.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/flood_params.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/mod.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/precipitation_thresholds.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/spei_params.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/wind_params.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/curve_fitting.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/mod.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/continent_r4.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/geography_r5.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/ipcc.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/mod.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/risk.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/spatial.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/transform.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/canonical_consumer.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/censored_quantile_fit.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_contract_canonical.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_definition_conformance.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_operations.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_registry_conformance.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/quantile_fit_golden.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/quantile_fit_golden.txt +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/.nvmrc +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/src/index.d.ts +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/src/index.js +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/benchmark.mjs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/browser.html +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/browser.mjs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/parity.test.mjs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/pyproject.toml +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/__init__.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/_core.pyi +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/constants.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/__init__.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/error-codes.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/hazard-exposures.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/native-capabilities.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/registry-overrides.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/semantics-constants.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/unit-aliases.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/canonical-json.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/definitions.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/evaluation-records.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/monotonicity.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/operations.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/point-evaluations.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/registry-references.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/spatial-policies.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/spatial-records.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/manifest.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/impact-definition-1.0.schema.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/impact-evaluation-record-1.0.schema.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/registry-impact-reference-1.0.schema.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/spatial-combination-policy-1.0.schema.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/spatial-impact-evaluation-record-1.0.schema.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/__init__.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/base.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/empirical.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/fitted.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/fitting.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/hurdle.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/point_mass.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/tabulated.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/impacts/__init__.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/__init__.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/distribution.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/microscores.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/risk.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/spanning.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/models.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/py.typed +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/spatial.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/__init__.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/base.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/builtin.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/climate.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/src/impact.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/src/lib.rs +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/fixtures/canonical-quantiles.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_consumer_parity.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_impact_contracts.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_impact_expression.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_impacts.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_lmoments.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_sdk.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/typing_smoke.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/benchmark_lmoments.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/benchmarks/lmoments-audit-m2-pro.json +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/generate_consumer_fixtures.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/cases.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/generate.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/reference.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/schemas.py +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/requirements-lmoments-benchmark.txt +0 -0
- {crc_framework-0.5.2 → crc_framework-0.5.3}/uv.lock +0 -0
|
@@ -111,7 +111,6 @@ jobs:
|
|
|
111
111
|
environment: production
|
|
112
112
|
runs-on: ubuntu-latest
|
|
113
113
|
needs: [linux, macos, sdist]
|
|
114
|
-
continue-on-error: true
|
|
115
114
|
steps:
|
|
116
115
|
- uses: actions/checkout@v4
|
|
117
116
|
|
|
@@ -129,7 +128,7 @@ jobs:
|
|
|
129
128
|
generate_release_notes: true
|
|
130
129
|
fail_on_unmatched_files: true
|
|
131
130
|
draft: false
|
|
132
|
-
prerelease:
|
|
131
|
+
prerelease: ${{ contains(github.ref_name, '-') }}
|
|
133
132
|
files: ${{ steps.download.outputs.download-path }}/*
|
|
134
133
|
|
|
135
134
|
- name: Publish package distributions to PyPI
|
|
@@ -67,7 +67,7 @@ dependencies = [
|
|
|
67
67
|
|
|
68
68
|
[[package]]
|
|
69
69
|
name = "crc-framework-core"
|
|
70
|
-
version = "0.5.
|
|
70
|
+
version = "0.5.3"
|
|
71
71
|
dependencies = [
|
|
72
72
|
"h3o",
|
|
73
73
|
"phf",
|
|
@@ -79,7 +79,7 @@ dependencies = [
|
|
|
79
79
|
|
|
80
80
|
[[package]]
|
|
81
81
|
name = "crc-framework-rs"
|
|
82
|
-
version = "0.5.
|
|
82
|
+
version = "0.5.3"
|
|
83
83
|
dependencies = [
|
|
84
84
|
"crc-framework-core",
|
|
85
85
|
"h3o",
|
|
@@ -88,7 +88,7 @@ dependencies = [
|
|
|
88
88
|
|
|
89
89
|
[[package]]
|
|
90
90
|
name = "crc-framework-wasm"
|
|
91
|
-
version = "0.5.
|
|
91
|
+
version = "0.5.3"
|
|
92
92
|
dependencies = [
|
|
93
93
|
"crc-framework-core",
|
|
94
94
|
"js-sys",
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crc-framework
|
|
3
|
+
Version: 0.5.3
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
|
6
|
+
Classifier: Operating System :: OS Independent
|
|
7
|
+
Classifier: Programming Language :: Rust
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
10
|
+
Classifier: Typing :: Typed
|
|
11
|
+
Requires-Dist: numpy>=1.23
|
|
12
|
+
Requires-Dist: jsonschema>=4.18 ; extra == 'test'
|
|
13
|
+
Requires-Dist: mypy ; extra == 'test'
|
|
14
|
+
Requires-Dist: pytest ; extra == 'test'
|
|
15
|
+
Provides-Extra: test
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
18
|
+
Summary: Rust computation core and Python bindings for the Climate Risk Commons Framework
|
|
19
|
+
Keywords: climate-risk,probability-distributions,risk-metrics,rust
|
|
20
|
+
Author: Riskthinking.AI
|
|
21
|
+
License-Expression: AGPL-3.0-or-later
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
24
|
+
Project-URL: Homepage, https://github.com/RiskThinking/crc-framework-rs
|
|
25
|
+
Project-URL: Issues, https://github.com/RiskThinking/crc-framework-rs/issues
|
|
26
|
+
Project-URL: Repository, https://github.com/RiskThinking/crc-framework-rs
|
|
27
|
+
|
|
28
|
+
# Climate Risk Commons Framework
|
|
29
|
+
|
|
30
|
+
CRC Framework provides a shared Rust computation core with official Python and
|
|
31
|
+
JavaScript/WebAssembly bindings for climate-risk calculations. It turns hazard
|
|
32
|
+
distributions into comparable impact microscores, scenario branches, and
|
|
33
|
+
portfolio-level VaR/CVaR risk metrics.
|
|
34
|
+
|
|
35
|
+
| Interface | Package | Scope |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| Python | `crc-framework` on PyPI; import `crc_framework` | Distributions, fitting, impacts, microscores, risk aggregation, and geography |
|
|
38
|
+
| JavaScript / WASM | `@climateriskcommons/crc-framework` on npm | Canonical CRC curve consumption: quantile evaluation, batches, prepared handles, and TypeScript declarations |
|
|
39
|
+
| Rust | `crates/core` | Shared algorithms and reference data used by both bindings |
|
|
40
|
+
|
|
41
|
+
The JavaScript binding consumes canonical curves, including PMTiles/MVT
|
|
42
|
+
properties. Python also supports fitting, impacts, and portfolio risk.
|
|
43
|
+
Application-specific workflows belong in packages built on this framework.
|
|
44
|
+
|
|
45
|
+
[Installation](#installation) · [Quick start](#quick-start) · [Guides](#guides-and-next-steps)
|
|
46
|
+
|
|
47
|
+
## Contributors
|
|
48
|
+
|
|
49
|
+
Thanks to the people who shape this project through code, reviews, research,
|
|
50
|
+
and internal discussions and ideas.
|
|
51
|
+
|
|
52
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
53
|
+
<!-- prettier-ignore-start -->
|
|
54
|
+
<!-- markdownlint-disable -->
|
|
55
|
+
<table>
|
|
56
|
+
<tbody>
|
|
57
|
+
<tr>
|
|
58
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ChrisHampu"><img src="https://avatars.githubusercontent.com/u/6600532?s=80" width="80" alt="@ChrisHampu" /><br /><sub><b>@ChrisHampu</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=ChrisHampu" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3AChrisHampu" title="Reviewed Pull Requests">👀</a></td>
|
|
59
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/woozyking"><img src="https://avatars.githubusercontent.com/u/2837532?s=80" width="80" alt="@woozyking" /><br /><sub><b>@woozyking</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=woozyking" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Awoozyking" title="Reviewed Pull Requests">👀</a></td>
|
|
60
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/awiebe42"><img src="https://avatars.githubusercontent.com/u/65562157?s=80" width="80" alt="@awiebe42" /><br /><sub><b>@awiebe42</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=awiebe42" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Aawiebe42" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/awiebe42" title="Research">🔬</a></td>
|
|
61
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kylalangotsky"><img src="https://avatars.githubusercontent.com/u/91707255?s=80" width="80" alt="@kylalangotsky" /><br /><sub><b>@kylalangotsky</b></sub></a><br /><a href="https://github.com/kylalangotsky" title="Research">🔬</a></td>
|
|
62
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/reshmasoman"><img src="https://avatars.githubusercontent.com/u/102987481?s=80" width="80" alt="@reshmasoman" /><br /><sub><b>@reshmasoman</b></sub></a><br /><a href="https://github.com/reshmasoman" title="Research">🔬</a></td>
|
|
63
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rkodamana"><img src="https://avatars.githubusercontent.com/u/84455891?s=80" width="80" alt="@rkodamana" /><br /><sub><b>@rkodamana</b></sub></a><br /><a href="https://github.com/rkodamana" title="Research">🔬</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Arkodamana" title="Reviewed Pull Requests">👀</a></td>
|
|
64
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dilshank"><img src="https://avatars.githubusercontent.com/u/1534562?s=80" width="80" alt="@dilshank" /><br /><sub><b>@dilshank</b></sub></a><br /><a href="https://github.com/dilshank" title="Research">🔬</a></td>
|
|
65
|
+
</tr>
|
|
66
|
+
</tbody>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
<!-- markdownlint-restore -->
|
|
70
|
+
<!-- prettier-ignore-end -->
|
|
71
|
+
|
|
72
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
73
|
+
|
|
74
|
+
Contribution types: 💻 code · 👀 review · 🔬 research. We recognize contributions
|
|
75
|
+
both on and off GitHub using [All Contributors](https://allcontributors.org/).
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
### Python
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
python -m pip install crc-framework
|
|
83
|
+
# To opt into prereleases:
|
|
84
|
+
python -m pip install --upgrade --pre crc-framework
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Python 3.11 or later is required. Compatible prebuilt wheels need no Rust
|
|
88
|
+
toolchain. Building from source requires Rust 1.85 or later and a C compiler
|
|
89
|
+
suitable for Python extensions.
|
|
90
|
+
|
|
91
|
+
### JavaScript / WebAssembly
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
npm install @climateriskcommons/crc-framework
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Stable releases use npm's `latest` channel. Add `@alpha` to opt into
|
|
98
|
+
alpha prereleases. The package is ESM, requires WebAssembly, and includes TypeScript
|
|
99
|
+
declarations. See the [JavaScript guide](docs/javascript.md) for browser, bundler, Node,
|
|
100
|
+
and SSR setup, canonical input rules, and prepared collection APIs.
|
|
101
|
+
|
|
102
|
+
## Quick start
|
|
103
|
+
|
|
104
|
+
### Python: evaluate a return-period curve
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from crc_framework import TabulatedDistribution
|
|
108
|
+
|
|
109
|
+
exposure = TabulatedDistribution.from_return_periods(
|
|
110
|
+
periods=[10, 20, 50, 100, 200, 500],
|
|
111
|
+
values=[0.1, 0.2, 0.5, 0.9, 1.4, 2.0],
|
|
112
|
+
tail="upper",
|
|
113
|
+
)
|
|
114
|
+
print(exposure.ppf(0.99)) # 100-year return level: 0.9
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### JavaScript: consume a canonical curve
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
import init, { evaluateCurve } from '@climateriskcommons/crc-framework';
|
|
121
|
+
|
|
122
|
+
await init(); // initialize once at client startup
|
|
123
|
+
const properties = {
|
|
124
|
+
curve_kind: 'fitted',
|
|
125
|
+
curve_type: 'gumbel_r',
|
|
126
|
+
curve_location: 1,
|
|
127
|
+
curve_scale: 2,
|
|
128
|
+
};
|
|
129
|
+
const value = evaluateCurve(properties, 0.99);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Evaluation is synchronous after initialization. Imports are SSR-safe; initialize
|
|
133
|
+
in the client, or load WASM bytes explicitly for Node evaluation. For repeated
|
|
134
|
+
viewport or percentile queries, use `prepareCurves` to validate and transfer a
|
|
135
|
+
collection once, then call `evaluate(q)` and free the handle when finished.
|
|
136
|
+
|
|
137
|
+
## Guides and next steps
|
|
138
|
+
|
|
139
|
+
| Task | Read next |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| Use distributions, fitting, impacts, microscores, or risk metrics | [Python guide](docs/python.md) |
|
|
142
|
+
| Initialize WASM, prepare collections, or understand canonical inputs and errors | [JavaScript guide](docs/javascript.md) |
|
|
143
|
+
| Pin schemas, validate identities, or record impact provenance | [Impact contracts](docs/impact-contracts.md) |
|
|
144
|
+
| Set up the repository, run checks, or update contributor credits | [Development](docs/development.md) |
|
|
145
|
+
| Bump versions, migrate the npm scope, or publish a release | [Releases](docs/releases.md) |
|
|
146
|
+
|
|
147
|
+
Start with the [documentation index](docs/README.md) for the reading order and
|
|
148
|
+
repository boundaries. Historical implementation notes are linked there separately.
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
CRC Framework is licensed under the GNU Affero General Public License, version
|
|
153
|
+
3 or any later version (`AGPL-3.0-or-later`). See [LICENSE](LICENSE).
|
|
154
|
+
|
|
155
|
+
Parts of the numerical distribution implementation are derived from or
|
|
156
|
+
informed by SciPy and Cephes. Their applicable copyright notices and license
|
|
157
|
+
terms are preserved in
|
|
158
|
+
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
159
|
+
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Climate Risk Commons Framework
|
|
2
|
+
|
|
3
|
+
CRC Framework provides a shared Rust computation core with official Python and
|
|
4
|
+
JavaScript/WebAssembly bindings for climate-risk calculations. It turns hazard
|
|
5
|
+
distributions into comparable impact microscores, scenario branches, and
|
|
6
|
+
portfolio-level VaR/CVaR risk metrics.
|
|
7
|
+
|
|
8
|
+
| Interface | Package | Scope |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| Python | `crc-framework` on PyPI; import `crc_framework` | Distributions, fitting, impacts, microscores, risk aggregation, and geography |
|
|
11
|
+
| JavaScript / WASM | `@climateriskcommons/crc-framework` on npm | Canonical CRC curve consumption: quantile evaluation, batches, prepared handles, and TypeScript declarations |
|
|
12
|
+
| Rust | `crates/core` | Shared algorithms and reference data used by both bindings |
|
|
13
|
+
|
|
14
|
+
The JavaScript binding consumes canonical curves, including PMTiles/MVT
|
|
15
|
+
properties. Python also supports fitting, impacts, and portfolio risk.
|
|
16
|
+
Application-specific workflows belong in packages built on this framework.
|
|
17
|
+
|
|
18
|
+
[Installation](#installation) · [Quick start](#quick-start) · [Guides](#guides-and-next-steps)
|
|
19
|
+
|
|
20
|
+
## Contributors
|
|
21
|
+
|
|
22
|
+
Thanks to the people who shape this project through code, reviews, research,
|
|
23
|
+
and internal discussions and ideas.
|
|
24
|
+
|
|
25
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
26
|
+
<!-- prettier-ignore-start -->
|
|
27
|
+
<!-- markdownlint-disable -->
|
|
28
|
+
<table>
|
|
29
|
+
<tbody>
|
|
30
|
+
<tr>
|
|
31
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ChrisHampu"><img src="https://avatars.githubusercontent.com/u/6600532?s=80" width="80" alt="@ChrisHampu" /><br /><sub><b>@ChrisHampu</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=ChrisHampu" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3AChrisHampu" title="Reviewed Pull Requests">👀</a></td>
|
|
32
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/woozyking"><img src="https://avatars.githubusercontent.com/u/2837532?s=80" width="80" alt="@woozyking" /><br /><sub><b>@woozyking</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=woozyking" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Awoozyking" title="Reviewed Pull Requests">👀</a></td>
|
|
33
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/awiebe42"><img src="https://avatars.githubusercontent.com/u/65562157?s=80" width="80" alt="@awiebe42" /><br /><sub><b>@awiebe42</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=awiebe42" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Aawiebe42" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/awiebe42" title="Research">🔬</a></td>
|
|
34
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kylalangotsky"><img src="https://avatars.githubusercontent.com/u/91707255?s=80" width="80" alt="@kylalangotsky" /><br /><sub><b>@kylalangotsky</b></sub></a><br /><a href="https://github.com/kylalangotsky" title="Research">🔬</a></td>
|
|
35
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/reshmasoman"><img src="https://avatars.githubusercontent.com/u/102987481?s=80" width="80" alt="@reshmasoman" /><br /><sub><b>@reshmasoman</b></sub></a><br /><a href="https://github.com/reshmasoman" title="Research">🔬</a></td>
|
|
36
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rkodamana"><img src="https://avatars.githubusercontent.com/u/84455891?s=80" width="80" alt="@rkodamana" /><br /><sub><b>@rkodamana</b></sub></a><br /><a href="https://github.com/rkodamana" title="Research">🔬</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Arkodamana" title="Reviewed Pull Requests">👀</a></td>
|
|
37
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dilshank"><img src="https://avatars.githubusercontent.com/u/1534562?s=80" width="80" alt="@dilshank" /><br /><sub><b>@dilshank</b></sub></a><br /><a href="https://github.com/dilshank" title="Research">🔬</a></td>
|
|
38
|
+
</tr>
|
|
39
|
+
</tbody>
|
|
40
|
+
</table>
|
|
41
|
+
|
|
42
|
+
<!-- markdownlint-restore -->
|
|
43
|
+
<!-- prettier-ignore-end -->
|
|
44
|
+
|
|
45
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
46
|
+
|
|
47
|
+
Contribution types: 💻 code · 👀 review · 🔬 research. We recognize contributions
|
|
48
|
+
both on and off GitHub using [All Contributors](https://allcontributors.org/).
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
### Python
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
python -m pip install crc-framework
|
|
56
|
+
# To opt into prereleases:
|
|
57
|
+
python -m pip install --upgrade --pre crc-framework
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Python 3.11 or later is required. Compatible prebuilt wheels need no Rust
|
|
61
|
+
toolchain. Building from source requires Rust 1.85 or later and a C compiler
|
|
62
|
+
suitable for Python extensions.
|
|
63
|
+
|
|
64
|
+
### JavaScript / WebAssembly
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npm install @climateriskcommons/crc-framework
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Stable releases use npm's `latest` channel. Add `@alpha` to opt into
|
|
71
|
+
alpha prereleases. The package is ESM, requires WebAssembly, and includes TypeScript
|
|
72
|
+
declarations. See the [JavaScript guide](docs/javascript.md) for browser, bundler, Node,
|
|
73
|
+
and SSR setup, canonical input rules, and prepared collection APIs.
|
|
74
|
+
|
|
75
|
+
## Quick start
|
|
76
|
+
|
|
77
|
+
### Python: evaluate a return-period curve
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from crc_framework import TabulatedDistribution
|
|
81
|
+
|
|
82
|
+
exposure = TabulatedDistribution.from_return_periods(
|
|
83
|
+
periods=[10, 20, 50, 100, 200, 500],
|
|
84
|
+
values=[0.1, 0.2, 0.5, 0.9, 1.4, 2.0],
|
|
85
|
+
tail="upper",
|
|
86
|
+
)
|
|
87
|
+
print(exposure.ppf(0.99)) # 100-year return level: 0.9
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### JavaScript: consume a canonical curve
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import init, { evaluateCurve } from '@climateriskcommons/crc-framework';
|
|
94
|
+
|
|
95
|
+
await init(); // initialize once at client startup
|
|
96
|
+
const properties = {
|
|
97
|
+
curve_kind: 'fitted',
|
|
98
|
+
curve_type: 'gumbel_r',
|
|
99
|
+
curve_location: 1,
|
|
100
|
+
curve_scale: 2,
|
|
101
|
+
};
|
|
102
|
+
const value = evaluateCurve(properties, 0.99);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Evaluation is synchronous after initialization. Imports are SSR-safe; initialize
|
|
106
|
+
in the client, or load WASM bytes explicitly for Node evaluation. For repeated
|
|
107
|
+
viewport or percentile queries, use `prepareCurves` to validate and transfer a
|
|
108
|
+
collection once, then call `evaluate(q)` and free the handle when finished.
|
|
109
|
+
|
|
110
|
+
## Guides and next steps
|
|
111
|
+
|
|
112
|
+
| Task | Read next |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| Use distributions, fitting, impacts, microscores, or risk metrics | [Python guide](docs/python.md) |
|
|
115
|
+
| Initialize WASM, prepare collections, or understand canonical inputs and errors | [JavaScript guide](docs/javascript.md) |
|
|
116
|
+
| Pin schemas, validate identities, or record impact provenance | [Impact contracts](docs/impact-contracts.md) |
|
|
117
|
+
| Set up the repository, run checks, or update contributor credits | [Development](docs/development.md) |
|
|
118
|
+
| Bump versions, migrate the npm scope, or publish a release | [Releases](docs/releases.md) |
|
|
119
|
+
|
|
120
|
+
Start with the [documentation index](docs/README.md) for the reading order and
|
|
121
|
+
repository boundaries. Historical implementation notes are linked there separately.
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
CRC Framework is licensed under the GNU Affero General Public License, version
|
|
126
|
+
3 or any later version (`AGPL-3.0-or-later`). See [LICENSE](LICENSE).
|
|
127
|
+
|
|
128
|
+
Parts of the numerical distribution implementation are derived from or
|
|
129
|
+
informed by SciPy and Cephes. Their applicable copyright notices and license
|
|
130
|
+
terms are preserved in
|
|
131
|
+
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# CRC Framework documentation
|
|
2
|
+
|
|
3
|
+
Start at the [project README](../README.md) for package choices, installation,
|
|
4
|
+
contributors, and runnable quick starts. Then follow the guide for your task:
|
|
5
|
+
|
|
6
|
+
1. **Use the framework:** [Python](python.md) or [JavaScript / WebAssembly](javascript.md).
|
|
7
|
+
2. **Understand shared contracts:** [impact contracts and provenance](impact-contracts.md).
|
|
8
|
+
3. **Change the framework:** [development and contribution](development.md).
|
|
9
|
+
4. **Ship a version:** [versioning, scope migration, and releases](releases.md).
|
|
10
|
+
|
|
11
|
+
## Ownership and source map
|
|
12
|
+
|
|
13
|
+
| Concern | Source of truth |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| Numerical algorithms, canonical validation, reference data | `crates/core/` |
|
|
16
|
+
| Typed Python interface and native binding | `python/crc_framework/`, `src/` |
|
|
17
|
+
| WASM exports and JavaScript adapter | `crates/wasm/`, `js/src/` |
|
|
18
|
+
| Impact schemas, catalogs, fixtures, manifest | Generated `python/crc_framework/contracts/impact/`; edit `tools/impact_contracts/` |
|
|
19
|
+
| Package version | Root `Cargo.toml`, `[workspace.package].version` |
|
|
20
|
+
| Contributor roster | `.all-contributorsrc`; generate both package READMEs |
|
|
21
|
+
|
|
22
|
+
Paths above are relative to the repository root. Humans and agents should use
|
|
23
|
+
these guides before following source details. Treat generated artifacts as outputs;
|
|
24
|
+
change their documented sources and regenerate them.
|
|
25
|
+
|
|
26
|
+
This directory covers the framework only. Dataset discovery, ingestion, and
|
|
27
|
+
Parquet workflows belong to CRC-SDK; tile loading, caches, and UI behavior belong
|
|
28
|
+
to consuming applications. These boundaries keep a future shared documentation
|
|
29
|
+
structure possible without duplicating other projects' guides here.
|
|
30
|
+
|
|
31
|
+
## Historical context
|
|
32
|
+
|
|
33
|
+
[Initial WASM rollout and performance investigation](history/wasm-quantile-consumer.md)
|
|
34
|
+
records past decisions and measurements. Use the current guides above for setup
|
|
35
|
+
and publishing instructions.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Development and contribution
|
|
2
|
+
|
|
3
|
+
[Documentation index](README.md) · [Project README](../README.md)
|
|
4
|
+
|
|
5
|
+
## Repository layout
|
|
6
|
+
|
|
7
|
+
| Path | Responsibility |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `crates/core` | Shared Rust algorithms and reference data |
|
|
10
|
+
| `src/lib.rs` | PyO3 extension |
|
|
11
|
+
| `python/crc_framework` | Typed Python API shipped with the extension |
|
|
12
|
+
| `python/crc_framework/contracts/impact` | Generated impact schemas, catalogs, conformance fixtures, and digest manifest |
|
|
13
|
+
| `tools/impact_contracts` | Contract generator, schema sources, fixture cases, and independent Python reference implementation |
|
|
14
|
+
| `crates/wasm` | WASM exports backed by the Rust core |
|
|
15
|
+
| `js` | JS adapter, TypeScript declarations, build tooling, and consumer tests |
|
|
16
|
+
| `tests` | Python tests and shared parity fixtures |
|
|
17
|
+
|
|
18
|
+
Python consumers should import `crc_framework`; `crc_framework._core` is an
|
|
19
|
+
implementation detail that may change between releases.
|
|
20
|
+
|
|
21
|
+
## Python setup and checks
|
|
22
|
+
|
|
23
|
+
Run these commands from the repository root:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
python -m venv .venv
|
|
27
|
+
.venv/bin/python -m pip install --upgrade pip maturin
|
|
28
|
+
.venv/bin/python -m pip install -e ".[test]"
|
|
29
|
+
|
|
30
|
+
cargo fmt --all -- --check
|
|
31
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
32
|
+
cargo test --workspace --locked
|
|
33
|
+
.venv/bin/python -m mypy
|
|
34
|
+
.venv/bin/python -m pytest
|
|
35
|
+
.venv/bin/maturin build --release --locked
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
After changing Rust code, run `.venv/bin/maturin develop` to rebuild the Python
|
|
39
|
+
extension. Python-only edits are available directly from the editable install.
|
|
40
|
+
|
|
41
|
+
## Impact contract generation and regression checks
|
|
42
|
+
|
|
43
|
+
Edit the sources in [`tools/impact_contracts`](../tools/impact_contracts), then
|
|
44
|
+
regenerate the artifact from the repository root:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
.venv/bin/python tools/impact_contracts/generate.py
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Commit the generator sources and generated artifact together. The generator and
|
|
51
|
+
reference implementation are development tooling; Python consumers load the
|
|
52
|
+
generated resources through `crc_framework.contracts`. No separate tools package
|
|
53
|
+
is needed. When the manifest changes, update the SDK's pinned manifest digest
|
|
54
|
+
together with any required consumer changes.
|
|
55
|
+
|
|
56
|
+
After the Python setup above, run the focused checks:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
.venv/bin/python tools/impact_contracts/generate.py --check
|
|
60
|
+
.venv/bin/python -m pytest tests/test_impact_contracts.py -q
|
|
61
|
+
cargo test -p crc-framework-core --test impact_contract_canonical --locked
|
|
62
|
+
cargo test -p crc-framework-core --no-default-features --test impact_contract_canonical --locked
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The Python suite checks generation freshness, schema agreement, canonical
|
|
66
|
+
identities, validation errors, numerical reference cases, and provenance rules.
|
|
67
|
+
Numerical cases specify tolerances; canonical bytes and hashes require exact
|
|
68
|
+
agreement. Monotonicity cases allow documented weaker classifications, including
|
|
69
|
+
both monotone directions for constant functions. Rust tests consume the same
|
|
70
|
+
artifact to check canonical serialization, native integer limits, and source
|
|
71
|
+
distribution reconstruction with and without default features.
|
|
72
|
+
|
|
73
|
+
## JavaScript setup and checks
|
|
74
|
+
|
|
75
|
+
Use the Node version in [`js/.nvmrc`](../js/.nvmrc), install the
|
|
76
|
+
`wasm32-unknown-unknown` Rust target and `wasm-pack 0.15.0`, then:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
cd js
|
|
80
|
+
npm ci
|
|
81
|
+
npm run build
|
|
82
|
+
npm test
|
|
83
|
+
npx playwright install chromium
|
|
84
|
+
npm run test:browser
|
|
85
|
+
npm run test:consumer
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The consumer test packs the generated distribution and checks it with Vite,
|
|
89
|
+
TypeScript, SSR, and Chromium. See the [JavaScript build and test guide](development.md#javascript-packaging)
|
|
90
|
+
for packaging and validation commands.
|
|
91
|
+
|
|
92
|
+
Native and WASM transcendental math can differ slightly. Numerical regression
|
|
93
|
+
and parity tests use explicit tolerances; structural validation stays exact.
|
|
94
|
+
The [quantile fitting golden test](../crates/core/tests/quantile_fit_golden.rs)
|
|
95
|
+
documents the optional exact-comparison mode for refactors in a fixed environment.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## JavaScript packaging
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
Use the Node version in `.nvmrc`, install Rust's `wasm32-unknown-unknown` target
|
|
102
|
+
and `wasm-pack 0.15.0`, then run from this directory:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
npm ci
|
|
106
|
+
npm run build
|
|
107
|
+
npm test
|
|
108
|
+
npx playwright install chromium
|
|
109
|
+
npm run test:browser
|
|
110
|
+
npm run test:consumer # packed Vite + TypeScript + SSR/browser checks
|
|
111
|
+
npm run benchmark
|
|
112
|
+
npm run pack -- --dry-run
|
|
113
|
+
npm run pack
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The tracked `package.json` is a private, versionless development manifest;
|
|
117
|
+
`package-lock.json` pins its build/test dependencies. Keep both in Git. The build
|
|
118
|
+
reads Cargo metadata and writes the public package to ignored `dist/`, including
|
|
119
|
+
the derived version, JS adapter, declarations, WASM glue/asset, and licenses.
|
|
120
|
+
Development scripts, dev dependencies, and the private flag are omitted.
|
|
121
|
+
Source manifests and lockfiles are not rewritten by the build.
|
|
122
|
+
|
|
123
|
+
`npm run pack` (or `npm pack ./dist`) requires a successful build for the current
|
|
124
|
+
workspace version and creates the tarball under `dist/`. The consumer test
|
|
125
|
+
installs that artifact. The private development package itself cannot be published.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## Contributor credits
|
|
129
|
+
|
|
130
|
+
The roster in `.all-contributorsrc` generates the contributor tables in both
|
|
131
|
+
`README.md` (also the Python package README) and `js/README.md` (the npm README).
|
|
132
|
+
Run from the repository root:
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
npx --yes all-contributors-cli@6.26.1 add HANDLE code,review
|
|
136
|
+
npx --yes all-contributors-cli@6.26.1 add HANDLE research
|
|
137
|
+
npx --yes all-contributors-cli@6.26.1 generate
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Use `code,review` for code contributors and specify other types explicitly.
|
|
141
|
+
Edit the roster for corrections, then regenerate both tables; do not edit the
|
|
142
|
+
generated tables directly.
|