scientific-computing-system 1.0.0 → 2.2.1
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.
- package/CHANGELOG.md +365 -0
- package/LICENSE +0 -0
- package/README.md +146 -217
- package/SECURITY.md +32 -6
- package/bin/scs.js +12 -2
- package/index.js +115 -1
- package/package.json +45 -1
- package/.binder/postBuild +0 -9
- package/.binder/requirements.txt +0 -10
- package/.gitattributes +0 -35
- package/.github/CODEOWNERS +0 -4
- package/.github/FUNDING.yml +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -50
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -28
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -29
- package/.github/dependabot.yml +0 -32
- package/.github/labeler.yml +0 -50
- package/.github/workflows/benchmarks.yml +0 -97
- package/.github/workflows/bot-reviewer.yml +0 -58
- package/.github/workflows/changelog.yml +0 -130
- package/.github/workflows/cli-package-smoke.yml +0 -45
- package/.github/workflows/codeql.yml +0 -55
- package/.github/workflows/npm-publish.yml +0 -33
- package/.github/workflows/p08-cancel-noncanonical-runs.yml +0 -41
- package/.github/workflows/pr-automation.yml +0 -78
- package/.github/workflows/public-external-validation-p08-v2-glm.yml +0 -161
- package/.github/workflows/public-external-validation-p08-v2-recovery-merge-gate.yml +0 -72
- package/.github/workflows/public-external-validation-p08-v2-recovery-merge.yml +0 -113
- package/.github/workflows/public-external-validation-p08-v2-run-recovery-anatomy-gate.yml +0 -57
- package/.github/workflows/public-external-validation-p08-v2-run-recovery-merge-gate.yml +0 -63
- package/.github/workflows/public-external-validation-p08-v2-run-recovery-merge.yml +0 -89
- package/.github/workflows/public-external-validation-p08-v2-run-recovery.yml +0 -182
- package/.github/workflows/public-external-validation-p08-v3-glm-gate.yml +0 -67
- package/.github/workflows/public-external-validation-p08-v4-recovery-glm-gate.yml +0 -78
- package/.github/workflows/public-external-validation-p08-v4-recovery-glm.yml +0 -248
- package/.github/workflows/public-external-validation-p08-v5-run-recovery-glm-gate.yml +0 -66
- package/.github/workflows/public-external-validation-p08-v5-run-recovery-glm.yml +0 -218
- package/.github/workflows/pypi-registry-smoke.yml +0 -116
- package/.github/workflows/release.yml +0 -359
- package/.github/workflows/tests.yml +0 -250
- package/.github/workflows/tmp-compassion-raw-acquire.yml +0 -63
- package/.github/workflows/wsl-science-runner-smoke.yml +0 -45
- package/.pre-commit-config.yaml +0 -48
- package/CITATION.cff +0 -29
- package/CODE_OF_CONDUCT.md +0 -25
- package/CONTRIBUTING.md +0 -275
- package/ROADMAP.md +0 -155
- package/assets/logo.svg +0 -38
- package/assets/social_preview.png +0 -0
- package/benchmarks/results.json +0 -43
- package/benchmarks/robust_runner.py +0 -118
- package/benchmarks/run_benchmarks.py +0 -394
- package/cliff.toml +0 -100
- package/dashboard/app.py +0 -224
- package/docs/ARCHITECTURE.md +0 -252
- package/docs/CASE_STUDY_HUBBLE.md +0 -78
- package/docs/CASE_STUDY_QUANTUM_ML.md +0 -79
- package/docs/api.md +0 -133
- package/docs/assets/icon.svg +0 -17
- package/docs/assets/logo.svg +0 -38
- package/docs/benchmarks.md +0 -62
- package/docs/cookbook.md +0 -930
- package/docs/getting-started.md +0 -185
- package/docs/index.md +0 -111
- package/docs/maintenance.md +0 -61
- package/docs/ml_reference.md +0 -92
- package/docs/research-workflows.md +0 -82
- package/docs/stylesheets/extra.css +0 -122
- package/docs/tour_of_numerical_methods.md +0 -330
- package/docs/tutorials/core_demo.md +0 -35
- package/docs/tutorials/data_analysis_demo.md +0 -43
- package/docs/tutorials/diffeq_demo.md +0 -48
- package/docs/tutorials/fft2_demo.md +0 -67
- package/docs/tutorials/graph_demo.md +0 -45
- package/docs/tutorials/hypothesis_demo.md +0 -44
- package/docs/tutorials/hypothesis_tests_demo.md +0 -170
- package/docs/tutorials/hypothesis_with_stats_demo.md +0 -80
- package/docs/tutorials/knowledge_demo.md +0 -114
- package/docs/tutorials/linalg_demo.md +0 -103
- package/docs/tutorials/math_utils_demo.md +0 -46
- package/docs/tutorials/ml_advanced_demo.md +0 -96
- package/docs/tutorials/ml_and_viz_demo.md +0 -93
- package/docs/tutorials/ml_demo.md +0 -70
- package/docs/tutorials/modeling_demo.md +0 -82
- package/docs/tutorials/montecarlo_demo.md +0 -42
- package/docs/tutorials/nlp_attention_demo.md +0 -107
- package/docs/tutorials/nlp_bpe_demo.md +0 -103
- package/docs/tutorials/nlp_mini_gpt_demo.md +0 -110
- package/docs/tutorials/nlp_viz.md +0 -76
- package/docs/tutorials/numerical_integration_demo.md +0 -65
- package/docs/tutorials/optimization_demo.md +0 -106
- package/docs/tutorials/pandas_io_demo.md +0 -160
- package/docs/tutorials/pca_demo.md +0 -87
- package/docs/tutorials/probability_demo.md +0 -48
- package/docs/tutorials/quantum_demo.md +0 -31
- package/docs/tutorials/quick_start.md +0 -44
- package/docs/tutorials/scientific_demo.md +0 -46
- package/docs/tutorials/signals_demo.md +0 -167
- package/docs/tutorials/stats_demo.md +0 -94
- package/docs/tutorials/stiff_ode_demo.md +0 -84
- package/docs/tutorials/time_series_demo.md +0 -145
- package/examples/core_demo.py +0 -40
- package/examples/data_analysis_demo.py +0 -60
- package/examples/diffeq_demo.py +0 -34
- package/examples/discovery_pipeline_demo.py +0 -57
- package/examples/ensemble_showcase.py +0 -81
- package/examples/fft2_demo.py +0 -32
- package/examples/graph_demo.py +0 -49
- package/examples/hypothesis_custom_generator.py +0 -121
- package/examples/hypothesis_demo.py +0 -48
- package/examples/hypothesis_tests_demo.py +0 -52
- package/examples/hypothesis_with_stats_demo.py +0 -43
- package/examples/interpolate_demo.py +0 -57
- package/examples/knowledge_demo.py +0 -100
- package/examples/linalg_demo.py +0 -61
- package/examples/math_utils_demo.py +0 -53
- package/examples/ml_and_viz_demo.py +0 -47
- package/examples/modeling_demo.py +0 -110
- package/examples/montecarlo_demo.py +0 -41
- package/examples/nlp_attention_demo.py +0 -168
- package/examples/nlp_bpe_demo.py +0 -79
- package/examples/nlp_mini_gpt_demo.py +0 -76
- package/examples/nlp_viz_demo.py +0 -98
- package/examples/numerical_integration_demo.py +0 -60
- package/examples/optimization_demo.py +0 -34
- package/examples/pca_demo.py +0 -124
- package/examples/pde_demo.py +0 -65
- package/examples/plot_demo.py +0 -84
- package/examples/plotting_notebook.ipynb +0 -87
- package/examples/probability_demo.py +0 -39
- package/examples/quantum_demo.py +0 -42
- package/examples/scientific_demo.py +0 -49
- package/examples/signals_demo.py +0 -86
- package/examples/stats_demo.py +0 -40
- package/examples/tour_of_numerical_methods.ipynb +0 -497
- package/mkdocs.yml +0 -159
- package/pyproject.toml +0 -288
- package/requirements-dev.lock +0 -427
- package/requirements-dev.txt +0 -39
- package/requirements.lock +0 -6
- package/requirements.txt +0 -13
- package/scripts/build_gif.py +0 -111
- package/scripts/build_video.py +0 -214
- package/scripts/cleanup_deployments.py +0 -173
- package/scripts/crop_readme_png.py +0 -40
- package/scripts/make_pi_dashboard.py +0 -316
- package/scripts/make_pi_gif.py +0 -138
- package/scripts/publish.py +0 -203
- package/scripts/render_promo.mjs +0 -93
- package/scripts/render_readme.py +0 -211
- package/scripts/render_readme_sections.py +0 -168
- package/scripts/verify_cli_install.py +0 -99
- package/scripts/verify_cookbook.py +0 -601
- package/scripts/verify_d1_numerics.py +0 -504
- package/scripts/verify_d2_edge_cases.py +0 -442
- package/scripts/verify_d4_hypothesis.py +0 -337
- package/scripts/verify_ml_reference.py +0 -160
- package/scripts/verify_pypi_release.py +0 -97
- package/scripts/verify_release_integrity.py +0 -194
- package/src/cds/__init__.py +0 -132
- package/src/cds/__main__.py +0 -8
- package/src/cds/_version.py +0 -11
- package/src/cds/bayes/__init__.py +0 -25
- package/src/cds/bayes/conjugate.py +0 -560
- package/src/cds/cli/__init__.py +0 -104
- package/src/cds/cli/__main__.py +0 -8
- package/src/cds/cli/_handlers.py +0 -323
- package/src/cds/cli/_parser.py +0 -155
- package/src/cds/cli/_style.py +0 -208
- package/src/cds/cli/_system_info.py +0 -71
- package/src/cds/core/__init__.py +0 -5
- package/src/cds/core/_numeric.py +0 -92
- package/src/cds/core/models.py +0 -166
- package/src/cds/data_analysis/__init__.py +0 -30
- package/src/cds/data_analysis/dataset.py +0 -122
- package/src/cds/data_analysis/loader.py +0 -75
- package/src/cds/data_analysis/pandas_io.py +0 -108
- package/src/cds/data_analysis/transform.py +0 -36
- package/src/cds/data_analysis/viz.py +0 -88
- package/src/cds/data_io/__init__.py +0 -27
- package/src/cds/data_io/streaming.py +0 -314
- package/src/cds/diffeq/__init__.py +0 -37
- package/src/cds/diffeq/_implicit.py +0 -349
- package/src/cds/diffeq/solvers.py +0 -312
- package/src/cds/diffeq/symplectic.py +0 -225
- package/src/cds/fractals/__init__.py +0 -34
- package/src/cds/fractals/sets.py +0 -356
- package/src/cds/genetics/__init__.py +0 -22
- package/src/cds/genetics/sequence.py +0 -199
- package/src/cds/graph/__init__.py +0 -31
- package/src/cds/graph/algorithms.py +0 -399
- package/src/cds/hypothesis/__init__.py +0 -51
- package/src/cds/hypothesis/evaluator.py +0 -311
- package/src/cds/hypothesis/generator.py +0 -275
- package/src/cds/hypothesis/mining.py +0 -314
- package/src/cds/infotheory/__init__.py +0 -25
- package/src/cds/infotheory/measures.py +0 -276
- package/src/cds/interpolate/__init__.py +0 -156
- package/src/cds/knowledge/__init__.py +0 -45
- package/src/cds/knowledge/graph.py +0 -489
- package/src/cds/knowledge/notes.py +0 -231
- package/src/cds/knowledge/retrieval.py +0 -339
- package/src/cds/math_utils/__init__.py +0 -46
- package/src/cds/math_utils/calculus.py +0 -40
- package/src/cds/math_utils/linalg.py +0 -496
- package/src/cds/math_utils/special.py +0 -167
- package/src/cds/math_utils/svd.py +0 -261
- package/src/cds/ml/__init__.py +0 -60
- package/src/cds/ml/boosting.py +0 -304
- package/src/cds/ml/clustering.py +0 -190
- package/src/cds/ml/decomposition.py +0 -172
- package/src/cds/ml/ensemble.py +0 -152
- package/src/cds/ml/linear_models.py +0 -225
- package/src/cds/ml/metrics.py +0 -227
- package/src/cds/ml/model_selection.py +0 -150
- package/src/cds/ml/naive_bayes.py +0 -179
- package/src/cds/ml/neighbors.py +0 -162
- package/src/cds/ml/neural.py +0 -204
- package/src/cds/ml/preprocessing.py +0 -131
- package/src/cds/ml/tree.py +0 -228
- package/src/cds/ml/voting.py +0 -175
- package/src/cds/modeling/__init__.py +0 -44
- package/src/cds/modeling/_base.py +0 -210
- package/src/cds/modeling/_nodes.py +0 -526
- package/src/cds/modeling/expression.py +0 -81
- package/src/cds/modeling/fitting.py +0 -477
- package/src/cds/modeling/model.py +0 -134
- package/src/cds/modeling/solver.py +0 -187
- package/src/cds/montecarlo/__init__.py +0 -24
- package/src/cds/montecarlo/markov.py +0 -112
- package/src/cds/montecarlo/methods.py +0 -294
- package/src/cds/nlp/__init__.py +0 -170
- package/src/cds/nlp/attention.py +0 -285
- package/src/cds/nlp/autograd/__init__.py +0 -70
- package/src/cds/nlp/autograd/_grad.py +0 -120
- package/src/cds/nlp/autograd/ops.py +0 -133
- package/src/cds/nlp/autograd/tensor.py +0 -298
- package/src/cds/nlp/bpe.py +0 -449
- package/src/cds/nlp/data.py +0 -70
- package/src/cds/nlp/embed.py +0 -190
- package/src/cds/nlp/layers.py +0 -259
- package/src/cds/nlp/model.py +0 -456
- package/src/cds/nlp/optim.py +0 -163
- package/src/cds/nlp/training.py +0 -167
- package/src/cds/nlp/viz.py +0 -254
- package/src/cds/numerical_integration/__init__.py +0 -31
- package/src/cds/numerical_integration/quadrature.py +0 -480
- package/src/cds/optimization/__init__.py +0 -26
- package/src/cds/optimization/_metaheuristics.py +0 -287
- package/src/cds/optimization/constrained.py +0 -212
- package/src/cds/optimization/minimize.py +0 -425
- package/src/cds/pde/__init__.py +0 -266
- package/src/cds/plot/__init__.py +0 -49
- package/src/cds/plot/_backend.py +0 -32
- package/src/cds/plot/charts.py +0 -462
- package/src/cds/probability/__init__.py +0 -65
- package/src/cds/probability/_advanced.py +0 -283
- package/src/cds/probability/distributions.py +0 -236
- package/src/cds/probability/extra_distributions.py +0 -199
- package/src/cds/provenance/__init__.py +0 -25
- package/src/cds/provenance/manifest.py +0 -355
- package/src/cds/py.typed +0 -0
- package/src/cds/quantum/__init__.py +0 -51
- package/src/cds/quantum/circuit.py +0 -122
- package/src/cds/quantum/multi_qubit.py +0 -310
- package/src/cds/quantum/simulator.py +0 -53
- package/src/cds/scientific/__init__.py +0 -34
- package/src/cds/scientific/constants.py +0 -35
- package/src/cds/scientific/formulas.py +0 -116
- package/src/cds/sensitivity.py +0 -204
- package/src/cds/signals/__init__.py +0 -59
- package/src/cds/signals/filters.py +0 -449
- package/src/cds/signals/processing.py +0 -224
- package/src/cds/signals/stft.py +0 -177
- package/src/cds/signals/wavelet.py +0 -146
- package/src/cds/stats/__init__.py +0 -99
- package/src/cds/stats/_distributions.py +0 -102
- package/src/cds/stats/bootstrap.py +0 -188
- package/src/cds/stats/descriptive.py +0 -172
- package/src/cds/stats/hypothesis_tests.py +0 -294
- package/src/cds/stats/nonparametric.py +0 -141
- package/src/cds/stats/power.py +0 -290
- package/src/cds/stats/regression.py +0 -51
- package/src/cds/stats/time_series.py +0 -420
- package/src/cds/tools/__init__.py +0 -29
- package/src/cds/tools/adapters.py +0 -218
- package/src/cds/tools/registry.py +0 -181
- package/src/cds/uncertainty/__init__.py +0 -17
- package/src/cds/uncertainty/propagation.py +0 -233
- package/src/cds/units/__init__.py +0 -45
- package/src/cds/units/core.py +0 -199
- package/src/cds/validation/__init__.py +0 -41
- package/src/cds/validation/adequacy.py +0 -157
- package/src/cds/validation/checks.py +0 -485
- package/src/cds/validation/report.py +0 -50
- package/src/cds/wavelets/__init__.py +0 -5
- package/src/cds/wavelets/haar.py +0 -219
- package/src/cds/workflow/__init__.py +0 -77
- package/src/cds/workflow/engine.py +0 -116
- package/src/cds/workflow/gates.py +0 -120
- package/src/cds/workflow/orchestrator.py +0 -431
- package/src/cds/workflow/selection.py +0 -454
- package/src/cds/workflow/tooling.py +0 -155
- package/src/cds/workflow/types.py +0 -107
- package/tests/__init__.py +0 -0
- package/tests/conftest.py +0 -109
- package/tests/test_advanced_fitting.py +0 -247
- package/tests/test_audit_completion_coverage.py +0 -183
- package/tests/test_audit_guard_coverage.py +0 -115
- package/tests/test_audit_hardening.py +0 -138
- package/tests/test_audit_hardening_coverage.py +0 -111
- package/tests/test_bayes_v2.py +0 -208
- package/tests/test_benchmarks.py +0 -111
- package/tests/test_bootstrap.py +0 -135
- package/tests/test_cli.py +0 -51
- package/tests/test_cli_color.py +0 -114
- package/tests/test_cli_extended.py +0 -239
- package/tests/test_cli_system_info.py +0 -36
- package/tests/test_constrained_opt.py +0 -174
- package/tests/test_core.py +0 -273
- package/tests/test_data_analysis.py +0 -146
- package/tests/test_data_analysis_lazy_bridge.py +0 -68
- package/tests/test_data_analysis_pandas_io.py +0 -119
- package/tests/test_data_io.py +0 -149
- package/tests/test_dataset.py +0 -91
- package/tests/test_diffeq.py +0 -186
- package/tests/test_diffeq_implicit.py +0 -173
- package/tests/test_domain_validation.py +0 -66
- package/tests/test_edge_misc_numerical.py +0 -666
- package/tests/test_edge_ml_quantum_linalg.py +0 -191
- package/tests/test_edge_nlp.py +0 -229
- package/tests/test_edge_quantum_evaluator_cli.py +0 -601
- package/tests/test_edge_stats_optimization_signals.py +0 -406
- package/tests/test_extra_distributions.py +0 -206
- package/tests/test_fft2.py +0 -67
- package/tests/test_fitting_bootstrap.py +0 -202
- package/tests/test_fractals.py +0 -387
- package/tests/test_genetics.py +0 -159
- package/tests/test_graph.py +0 -380
- package/tests/test_hardening_privacy_provenance.py +0 -306
- package/tests/test_hypothesis.py +0 -216
- package/tests/test_hypothesis_engine.py +0 -59
- package/tests/test_hypothesis_mining.py +0 -247
- package/tests/test_hypothesis_tests.py +0 -277
- package/tests/test_infotheory.py +0 -302
- package/tests/test_interpolate.py +0 -189
- package/tests/test_knowledge.py +0 -1149
- package/tests/test_layering.py +0 -112
- package/tests/test_linalg_extended.py +0 -179
- package/tests/test_linalg_qr_cholesky.py +0 -68
- package/tests/test_markov.py +0 -155
- package/tests/test_math_utils.py +0 -157
- package/tests/test_ml_boosting.py +0 -148
- package/tests/test_ml_clustering.py +0 -92
- package/tests/test_ml_ensemble.py +0 -103
- package/tests/test_ml_knn.py +0 -95
- package/tests/test_ml_linreg.py +0 -70
- package/tests/test_ml_logreg.py +0 -84
- package/tests/test_ml_metrics.py +0 -125
- package/tests/test_ml_model_selection.py +0 -108
- package/tests/test_ml_naive_bayes.py +0 -183
- package/tests/test_ml_pca.py +0 -98
- package/tests/test_ml_preprocessing.py +0 -104
- package/tests/test_ml_tree.py +0 -89
- package/tests/test_ml_viz.py +0 -58
- package/tests/test_ml_voting.py +0 -219
- package/tests/test_modeling.py +0 -726
- package/tests/test_modeling_fit_validation.py +0 -46
- package/tests/test_montecarlo.py +0 -245
- package/tests/test_multi_qubit.py +0 -466
- package/tests/test_nlp_attention.py +0 -335
- package/tests/test_nlp_autograd.py +0 -435
- package/tests/test_nlp_bpe.py +0 -463
- package/tests/test_nlp_embed.py +0 -240
- package/tests/test_nlp_layers.py +0 -276
- package/tests/test_nlp_model.py +0 -172
- package/tests/test_nlp_training.py +0 -262
- package/tests/test_nlp_viz.py +0 -188
- package/tests/test_numerical_integration.py +0 -374
- package/tests/test_numerical_invariants.py +0 -768
- package/tests/test_numerical_oracles.py +0 -241
- package/tests/test_optimization.py +0 -139
- package/tests/test_optimization_metaheuristics.py +0 -221
- package/tests/test_pde.py +0 -294
- package/tests/test_plot_charts.py +0 -247
- package/tests/test_plot_lazy.py +0 -48
- package/tests/test_power.py +0 -226
- package/tests/test_probability.py +0 -274
- package/tests/test_probability_advanced.py +0 -226
- package/tests/test_property_invariants.py +0 -277
- package/tests/test_provenance.py +0 -215
- package/tests/test_provenance_audit_hardening.py +0 -45
- package/tests/test_public_api.py +0 -75
- package/tests/test_quantum.py +0 -195
- package/tests/test_release_contract.py +0 -105
- package/tests/test_retrieval.py +0 -255
- package/tests/test_scientific.py +0 -185
- package/tests/test_selection_audit_hardening.py +0 -55
- package/tests/test_sensitivity.py +0 -59
- package/tests/test_sensitivity_global.py +0 -73
- package/tests/test_signals.py +0 -146
- package/tests/test_signals_filters.py +0 -460
- package/tests/test_special_invariants.py +0 -222
- package/tests/test_special_numerics.py +0 -44
- package/tests/test_statistical_audit.py +0 -75
- package/tests/test_stats.py +0 -206
- package/tests/test_stats_audit_coverage.py +0 -17
- package/tests/test_stats_nonparametric.py +0 -87
- package/tests/test_stats_time_series.py +0 -352
- package/tests/test_stft.py +0 -208
- package/tests/test_streaming_analytics.py +0 -128
- package/tests/test_svd.py +0 -170
- package/tests/test_symplectic.py +0 -200
- package/tests/test_tool_adapters.py +0 -197
- package/tests/test_tools_registry.py +0 -132
- package/tests/test_uncertainty.py +0 -171
- package/tests/test_units.py +0 -139
- package/tests/test_validation.py +0 -100
- package/tests/test_validation_adequacy.py +0 -129
- package/tests/test_validation_advanced.py +0 -110
- package/tests/test_wavelet.py +0 -170
- package/tests/test_wavelets_v2.py +0 -119
- package/tests/test_workflow.py +0 -173
- package/tests/test_workflow_gates.py +0 -144
- package/tests/test_workflow_orchestrator.py +0 -516
- package/tests/test_workflow_orchestrator_blocked_review.py +0 -95
- package/tests/test_workflow_selection.py +0 -312
- package/tests/test_workflow_selection_coverage.py +0 -114
- package/tests/test_workflow_tooling.py +0 -190
package/scripts/render_promo.mjs
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// Render assets/promo_hero.html frame-by-frame to PNG via Playwright.
|
|
2
|
-
// Each frame is set deterministically via window.CDS_PROMO.setFrame(i),
|
|
3
|
-
// then screenshotted. Pillow (scripts/build_gif.py) assembles the GIF.
|
|
4
|
-
//
|
|
5
|
-
// Usage:
|
|
6
|
-
// node scripts/render_promo.mjs
|
|
7
|
-
// node scripts/render_promo.mjs --frames 120 # override frame count
|
|
8
|
-
// node scripts/render_promo.mjs --only 0,45,89 # render specific frames
|
|
9
|
-
// node scripts/render_promo.mjs --out myframe # single-shot to myframe.png
|
|
10
|
-
//
|
|
11
|
-
// Output: assets/_promo_frames/frame_000.png ... frame_NNN.png
|
|
12
|
-
|
|
13
|
-
import { chromium } from 'playwright';
|
|
14
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
15
|
-
import { fileURLToPath } from 'node:url';
|
|
16
|
-
import { dirname, join } from 'node:path';
|
|
17
|
-
|
|
18
|
-
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
19
|
-
const HTML = join(ROOT, 'assets', 'promo_hero.html');
|
|
20
|
-
const OUTDIR = join(ROOT, 'assets', '_promo_frames');
|
|
21
|
-
|
|
22
|
-
// --- arg parsing ---
|
|
23
|
-
const args = process.argv.slice(2);
|
|
24
|
-
function arg(name) {
|
|
25
|
-
const i = args.indexOf('--' + name);
|
|
26
|
-
return i >= 0 ? args[i + 1] : null;
|
|
27
|
-
}
|
|
28
|
-
const onlyArg = arg('only');
|
|
29
|
-
const singleOut = arg('out');
|
|
30
|
-
let total = 90;
|
|
31
|
-
{
|
|
32
|
-
const f = arg('frames');
|
|
33
|
-
if (f) total = parseInt(f, 10);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const frames =
|
|
37
|
-
onlyArg
|
|
38
|
-
? onlyArg.split(',').map(n => parseInt(n, 10))
|
|
39
|
-
: Array.from({ length: total }, (_, i) => i);
|
|
40
|
-
|
|
41
|
-
async function main() {
|
|
42
|
-
if (!existsSync(OUTDIR)) mkdirSync(OUTDIR, { recursive: true });
|
|
43
|
-
|
|
44
|
-
const browser = await chromium.launch();
|
|
45
|
-
const ctx = await browser.newContext({
|
|
46
|
-
viewport: { width: 1280, height: 720 },
|
|
47
|
-
deviceScaleFactor: 2, // crisp 2x for better GIF quality
|
|
48
|
-
});
|
|
49
|
-
const page = await ctx.newPage();
|
|
50
|
-
|
|
51
|
-
page.on('console', m => {
|
|
52
|
-
if (m.type() === 'error') console.error('[page error]', m.text());
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
await page.goto('file:///' + HTML.replace(/\\/g, '/'));
|
|
56
|
-
// wait for the expose + fonts
|
|
57
|
-
await page.waitForFunction(() => window.CDS_PROMO && typeof window.CDS_PROMO.setFrame === 'function');
|
|
58
|
-
await page.waitForTimeout(300);
|
|
59
|
-
|
|
60
|
-
// read authoritative total from the page CONFIG (keep JS the source of truth)
|
|
61
|
-
const cfgTotal = await page.evaluate(() => window.CDS_PROMO.CONFIG.totalFrames);
|
|
62
|
-
if (!onlyArg && !arg('frames')) total = cfgTotal;
|
|
63
|
-
|
|
64
|
-
const list = onlyArg ? frames : Array.from({ length: total }, (_, i) => i);
|
|
65
|
-
|
|
66
|
-
const t0 = Date.now();
|
|
67
|
-
for (let k = 0; k < list.length; k++) {
|
|
68
|
-
const i = list[k];
|
|
69
|
-
await page.evaluate(n => window.CDS_PROMO.setFrame(n), i);
|
|
70
|
-
// let layout/fonts settle for this frame
|
|
71
|
-
await page.waitForTimeout(40);
|
|
72
|
-
|
|
73
|
-
let outPath;
|
|
74
|
-
if (singleOut && list.length === 1) {
|
|
75
|
-
outPath = join(OUTDIR, '..', singleOut.endsWith('.png') ? singleOut : singleOut + '.png');
|
|
76
|
-
} else {
|
|
77
|
-
outPath = join(OUTDIR, `frame_${String(i).padStart(3, '0')}.png`);
|
|
78
|
-
}
|
|
79
|
-
await page.screenshot({ path: outPath, omitBackground: false });
|
|
80
|
-
if ((k + 1) % 10 === 0 || k === list.length - 1) {
|
|
81
|
-
const dt = ((Date.now() - t0) / 1000).toFixed(1);
|
|
82
|
-
process.stdout.write(` rendered ${k + 1}/${list.length} frames (${dt}s)\n`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
await browser.close();
|
|
87
|
-
console.log(`\nDone. ${list.length} frame(s) in ${OUTDIR}`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
main().catch(e => {
|
|
91
|
-
console.error(e);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
});
|
package/scripts/render_readme.py
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"""Render README.md to a GitHub-style HTML page, then screenshot it via Playwright.
|
|
2
|
-
|
|
3
|
-
Produces:
|
|
4
|
-
- README_PREVIEW.html (self-contained, for browser review)
|
|
5
|
-
- README_PREVIEW.png (full-page screenshot, GitHub-light theme)
|
|
6
|
-
|
|
7
|
-
Run: python scripts/render_readme.py
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from __future__ import annotations
|
|
11
|
-
|
|
12
|
-
import base64
|
|
13
|
-
import sys
|
|
14
|
-
import textwrap
|
|
15
|
-
from pathlib import Path
|
|
16
|
-
|
|
17
|
-
import markdown as md
|
|
18
|
-
|
|
19
|
-
ROOT = Path(__file__).resolve().parents[1]
|
|
20
|
-
README = ROOT / "README.md"
|
|
21
|
-
OUT_HTML = ROOT / "README_PREVIEW.html"
|
|
22
|
-
OUT_PNG = ROOT / "README_PREVIEW.png"
|
|
23
|
-
|
|
24
|
-
# Embed the promo GIF as a data URI so the screenshot renders it even if the
|
|
25
|
-
# file path resolution differs. The logo.svg is small and also embedded.
|
|
26
|
-
ASSETS = ROOT / "assets"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def _data_uri(path: Path) -> str:
|
|
30
|
-
suffix = path.suffix.lower()
|
|
31
|
-
mime = {
|
|
32
|
-
".gif": "image/gif",
|
|
33
|
-
".png": "image/png",
|
|
34
|
-
".svg": "image/svg+xml",
|
|
35
|
-
".webp": "image/webp",
|
|
36
|
-
}.get(suffix, "application/octet-stream")
|
|
37
|
-
data = path.read_bytes()
|
|
38
|
-
b64 = base64.b64encode(data).decode()
|
|
39
|
-
return f"data:{mime};base64,{b64}"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def build_html() -> str:
|
|
43
|
-
md_text = README.read_text(encoding="utf-8")
|
|
44
|
-
|
|
45
|
-
# Rewrite local asset refs to data URIs so the rendered page is portable
|
|
46
|
-
# and the screenshot actually shows the images.
|
|
47
|
-
promo_uri = _data_uri(ASSETS / "cds_promo.gif")
|
|
48
|
-
logo_uri = _data_uri(ASSETS / "logo.svg")
|
|
49
|
-
md_text = md_text.replace('src="assets/logo.svg"', f'src="{logo_uri}"')
|
|
50
|
-
md_text = md_text.replace('src="assets/cds_promo.gif"', f'src="{promo_uri}"')
|
|
51
|
-
|
|
52
|
-
html_body = md.markdown(
|
|
53
|
-
md_text,
|
|
54
|
-
extensions=["extra", "sane_lists", "tables", "fenced_code", "toc"],
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
css = textwrap.dedent(
|
|
58
|
-
"""
|
|
59
|
-
:root {
|
|
60
|
-
--bg: #ffffff;
|
|
61
|
-
--fg: #1f2328;
|
|
62
|
-
--fg-muted: #656d76;
|
|
63
|
-
--border: #d0d7de;
|
|
64
|
-
--code-bg: #f6f8fa;
|
|
65
|
-
--code-fg: #1f2328;
|
|
66
|
-
--link: #0969da;
|
|
67
|
-
--quote-bg: #f6f8fa;
|
|
68
|
-
--quote-border: #d0d7de;
|
|
69
|
-
--table-head: #f6f8fa;
|
|
70
|
-
}
|
|
71
|
-
* { box-sizing: border-box; }
|
|
72
|
-
html, body { margin: 0; padding: 0; }
|
|
73
|
-
body {
|
|
74
|
-
background: var(--bg);
|
|
75
|
-
color: var(--fg);
|
|
76
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
|
|
77
|
-
Helvetica, Arial, sans-serif;
|
|
78
|
-
font-size: 16px;
|
|
79
|
-
line-height: 1.6;
|
|
80
|
-
-webkit-font-smoothing: antialiased;
|
|
81
|
-
}
|
|
82
|
-
.wrap {
|
|
83
|
-
max-width: 980px;
|
|
84
|
-
margin: 0 auto;
|
|
85
|
-
padding: 32px 48px 64px;
|
|
86
|
-
background: var(--bg);
|
|
87
|
-
border: 1px solid var(--border);
|
|
88
|
-
border-radius: 8px;
|
|
89
|
-
}
|
|
90
|
-
.markdown-body { color: var(--fg); }
|
|
91
|
-
.markdown-body h1, .markdown-body h2, .markdown-body h3,
|
|
92
|
-
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
|
|
93
|
-
margin: 24px 0 16px;
|
|
94
|
-
font-weight: 600;
|
|
95
|
-
line-height: 1.25;
|
|
96
|
-
}
|
|
97
|
-
.markdown-body h1 { font-size: 2em; padding-bottom: .3em;
|
|
98
|
-
border-bottom: 1px solid var(--border); }
|
|
99
|
-
.markdown-body h2 { font-size: 1.5em; padding-bottom: .3em;
|
|
100
|
-
border-bottom: 1px solid var(--border); }
|
|
101
|
-
.markdown-body h3 { font-size: 1.25em; }
|
|
102
|
-
.markdown-body h4 { font-size: 1em; }
|
|
103
|
-
.markdown-body p { margin: 0 0 16px; }
|
|
104
|
-
.markdown-body a { color: var(--link); text-decoration: none; }
|
|
105
|
-
.markdown-body a:hover { text-decoration: underline; }
|
|
106
|
-
.markdown-body img { max-width: 100%; vertical-align: middle;
|
|
107
|
-
background-color: var(--bg); }
|
|
108
|
-
.markdown-body hr { height: .25em; padding: 0; margin: 24px 0;
|
|
109
|
-
background-color: var(--border); border: 0; }
|
|
110
|
-
.markdown-body blockquote {
|
|
111
|
-
padding: 0 1em; color: var(--fg-muted);
|
|
112
|
-
border-left: .25em solid var(--quote-border);
|
|
113
|
-
margin: 0 0 16px;
|
|
114
|
-
}
|
|
115
|
-
.markdown-body blockquote > :first-child { margin-top: 0; }
|
|
116
|
-
.markdown-body blockquote > :last-child { margin-bottom: 0; }
|
|
117
|
-
.markdown-body code {
|
|
118
|
-
padding: .2em .4em; margin: 0; font-size: 85%;
|
|
119
|
-
background-color: var(--code-bg); border-radius: 6px;
|
|
120
|
-
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
|
|
121
|
-
"Liberation Mono", monospace;
|
|
122
|
-
}
|
|
123
|
-
.markdown-body pre {
|
|
124
|
-
padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45;
|
|
125
|
-
background-color: var(--code-bg); border-radius: 6px; margin: 0 0 16px;
|
|
126
|
-
}
|
|
127
|
-
.markdown-body pre code {
|
|
128
|
-
padding: 0; margin: 0; font-size: 100%; background: transparent;
|
|
129
|
-
}
|
|
130
|
-
.markdown-body table {
|
|
131
|
-
display: block; width: 100%; width: max-content; max-width: 100%;
|
|
132
|
-
overflow: auto; border-spacing: 0; border-collapse: collapse;
|
|
133
|
-
margin: 0 0 16px;
|
|
134
|
-
}
|
|
135
|
-
.markdown-body table th, .markdown-body table td {
|
|
136
|
-
padding: 6px 13px; border: 1px solid var(--border);
|
|
137
|
-
}
|
|
138
|
-
.markdown-body table tr { background-color: var(--bg); border-top: 1px solid var(--border); }
|
|
139
|
-
.markdown-body table tr:nth-child(2n) { background-color: var(--table-head); }
|
|
140
|
-
.markdown-body table th { font-weight: 600; }
|
|
141
|
-
.markdown-body ul, .markdown-body ol { padding-left: 2em; margin: 0 0 16px; }
|
|
142
|
-
.markdown-body li + li { margin-top: .25em; }
|
|
143
|
-
.markdown-body li > p { margin-top: 16px; }
|
|
144
|
-
/* GitHub alignment attributes from raw HTML (align="center") */
|
|
145
|
-
p[align="center"], h1[align="center"], h2[align="center"], div[align="center"] {
|
|
146
|
-
text-align: center;
|
|
147
|
-
}
|
|
148
|
-
.markdown-body hr { margin: 28px 0; }
|
|
149
|
-
"""
|
|
150
|
-
).strip()
|
|
151
|
-
|
|
152
|
-
return textwrap.dedent(
|
|
153
|
-
f"""
|
|
154
|
-
<!doctype html>
|
|
155
|
-
<html lang="en">
|
|
156
|
-
<head>
|
|
157
|
-
<meta charset="utf-8">
|
|
158
|
-
<title>CDS README Preview</title>
|
|
159
|
-
<style>{css}</style>
|
|
160
|
-
</head>
|
|
161
|
-
<body>
|
|
162
|
-
<div class="wrap">
|
|
163
|
-
<article class="markdown-body">
|
|
164
|
-
{html_body}
|
|
165
|
-
</article>
|
|
166
|
-
</div>
|
|
167
|
-
</body>
|
|
168
|
-
</html>
|
|
169
|
-
"""
|
|
170
|
-
).strip()
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
def main() -> int:
|
|
174
|
-
if not README.exists():
|
|
175
|
-
print(f"ERROR: {README} not found", file=sys.stderr)
|
|
176
|
-
return 1
|
|
177
|
-
|
|
178
|
-
html = build_html()
|
|
179
|
-
OUT_HTML.write_text(html, encoding="utf-8")
|
|
180
|
-
print(f"[ok] wrote {OUT_HTML}")
|
|
181
|
-
|
|
182
|
-
# Screenshot via Playwright (sync API)
|
|
183
|
-
try:
|
|
184
|
-
from playwright.sync_api import sync_playwright
|
|
185
|
-
except ImportError:
|
|
186
|
-
print(
|
|
187
|
-
"[warn] playwright not installed; skipping screenshot. "
|
|
188
|
-
"Install with: pip install playwright && playwright install chromium",
|
|
189
|
-
file=sys.stderr,
|
|
190
|
-
)
|
|
191
|
-
return 0
|
|
192
|
-
|
|
193
|
-
url = OUT_HTML.resolve().as_uri()
|
|
194
|
-
with sync_playwright() as p:
|
|
195
|
-
browser = p.chromium.launch()
|
|
196
|
-
ctx = browser.new_context(
|
|
197
|
-
viewport={"width": 1080, "height": 1400},
|
|
198
|
-
device_scale_factor=2,
|
|
199
|
-
)
|
|
200
|
-
page = ctx.new_page()
|
|
201
|
-
page.goto(url, wait_until="load")
|
|
202
|
-
# let the embedded GIF poster frame paint
|
|
203
|
-
page.wait_for_timeout(800)
|
|
204
|
-
page.screenshot(path=str(OUT_PNG), full_page=True)
|
|
205
|
-
browser.close()
|
|
206
|
-
print(f"[ok] wrote {OUT_PNG}")
|
|
207
|
-
return 0
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if __name__ == "__main__":
|
|
211
|
-
raise SystemExit(main())
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"""Render README.md into section-by-section screenshots for review.
|
|
2
|
-
|
|
3
|
-
Produces (in the project root):
|
|
4
|
-
- README_TOP.png : hero / first fold (≈ first viewport)
|
|
5
|
-
- README_SECTIONS/ : one PNG per <h2> section
|
|
6
|
-
- README_FULL.png : full-page (kept for completeness)
|
|
7
|
-
|
|
8
|
-
Run: python scripts/render_readme_sections.py
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
from __future__ import annotations
|
|
12
|
-
|
|
13
|
-
import base64
|
|
14
|
-
import re
|
|
15
|
-
import textwrap
|
|
16
|
-
from pathlib import Path
|
|
17
|
-
|
|
18
|
-
import markdown as md
|
|
19
|
-
from playwright.sync_api import sync_playwright
|
|
20
|
-
|
|
21
|
-
ROOT = Path(__file__).resolve().parents[1]
|
|
22
|
-
README = ROOT / "README.md"
|
|
23
|
-
ASSETS = ROOT / "assets"
|
|
24
|
-
OUT_DIR = ROOT / "README_SECTIONS"
|
|
25
|
-
OUT_TOP = ROOT / "README_TOP.png"
|
|
26
|
-
OUT_FULL = ROOT / "README_FULL.png"
|
|
27
|
-
HTML_FILE = ROOT / "README_PREVIEW_SECTIONS.html"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def _data_uri(path: Path) -> str:
|
|
31
|
-
mime = {
|
|
32
|
-
".gif": "image/gif",
|
|
33
|
-
".png": "image/png",
|
|
34
|
-
".svg": "image/svg+xml",
|
|
35
|
-
".webp": "image/webp",
|
|
36
|
-
}.get(path.suffix.lower(), "application/octet-stream")
|
|
37
|
-
return f"data:{mime};base64,{base64.b64encode(path.read_bytes()).decode()}"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def build_html() -> str:
|
|
41
|
-
md_text = README.read_text(encoding="utf-8")
|
|
42
|
-
md_text = md_text.replace('src="assets/logo.svg"', f'src="{_data_uri(ASSETS / "logo.svg")}"')
|
|
43
|
-
md_text = md_text.replace(
|
|
44
|
-
'src="assets/cds_promo.gif"', f'src="{_data_uri(ASSETS / "cds_promo.gif")}"'
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
body = md.markdown(
|
|
48
|
-
md_text,
|
|
49
|
-
extensions=["extra", "sane_lists", "tables", "fenced_code", "toc"],
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
css = textwrap.dedent(
|
|
53
|
-
"""
|
|
54
|
-
:root {
|
|
55
|
-
--bg:#ffffff; --fg:#1f2328; --fg-muted:#656d76; --border:#d0d7de;
|
|
56
|
-
--code-bg:#f6f8fa; --link:#0969da; --table-head:#f6f8fa;
|
|
57
|
-
}
|
|
58
|
-
*{box-sizing:border-box}
|
|
59
|
-
html,body{margin:0;padding:0}
|
|
60
|
-
body{background:var(--bg);color:var(--fg);
|
|
61
|
-
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif;
|
|
62
|
-
font-size:16px;line-height:1.6;-webkit-font-smoothing:antialiased}
|
|
63
|
-
.wrap{max-width:980px;margin:0 auto;padding:32px 48px 64px;
|
|
64
|
-
background:var(--bg);border:1px solid var(--border);border-radius:8px}
|
|
65
|
-
.markdown-body h1,.markdown-body h2,.markdown-body h3,
|
|
66
|
-
.markdown-body h4,.markdown-body h5,.markdown-body h6{
|
|
67
|
-
margin:24px 0 16px;font-weight:600;line-height:1.25}
|
|
68
|
-
.markdown-body h1{font-size:2em;padding-bottom:.3em;border-bottom:1px solid var(--border)}
|
|
69
|
-
.markdown-body h2{font-size:1.5em;padding-bottom:.3em;border-bottom:1px solid var(--border)}
|
|
70
|
-
.markdown-body h3{font-size:1.25em}
|
|
71
|
-
.markdown-body p{margin:0 0 16px}
|
|
72
|
-
.markdown-body a{color:var(--link);text-decoration:none}
|
|
73
|
-
.markdown-body a:hover{text-decoration:underline}
|
|
74
|
-
.markdown-body img{max-width:100%;vertical-align:middle;background:var(--bg)}
|
|
75
|
-
.markdown-body hr{height:.25em;padding:0;margin:24px 0;background-color:var(--border);border:0}
|
|
76
|
-
.markdown-body blockquote{padding:0 1em;color:var(--fg-muted);
|
|
77
|
-
border-left:.25em solid var(--border);margin:0 0 16px}
|
|
78
|
-
.markdown-body blockquote>:first-child{margin-top:0}
|
|
79
|
-
.markdown-body blockquote>:last-child{margin-bottom:0}
|
|
80
|
-
.markdown-body code{padding:.2em .4em;margin:0;font-size:85%;
|
|
81
|
-
background-color:var(--code-bg);border-radius:6px;
|
|
82
|
-
font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace}
|
|
83
|
-
.markdown-body pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;
|
|
84
|
-
background-color:var(--code-bg);border-radius:6px;margin:0 0 16px}
|
|
85
|
-
.markdown-body pre code{padding:0;margin:0;font-size:100%;background:transparent}
|
|
86
|
-
.markdown-body table{display:block;width:100%;width:max-content;max-width:100%;
|
|
87
|
-
overflow:auto;border-spacing:0;border-collapse:collapse;margin:0 0 16px}
|
|
88
|
-
.markdown-body table th,.markdown-body table td{padding:6px 13px;border:1px solid var(--border)}
|
|
89
|
-
.markdown-body table tr{background-color:var(--bg);border-top:1px solid var(--border)}
|
|
90
|
-
.markdown-body table tr:nth-child(2n){background-color:var(--table-head)}
|
|
91
|
-
.markdown-body table th{font-weight:600}
|
|
92
|
-
.markdown-body ul,.markdown-body ol{padding-left:2em;margin:0 0 16px}
|
|
93
|
-
.markdown-body li+li{margin-top:.25em}
|
|
94
|
-
.markdown-body li>p{margin-top:16px}
|
|
95
|
-
p[align="center"],h1[align="center"],h2[align="center"],div[align="center"]{text-align:center}
|
|
96
|
-
"""
|
|
97
|
-
).strip()
|
|
98
|
-
|
|
99
|
-
return textwrap.dedent(
|
|
100
|
-
f"""
|
|
101
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8">
|
|
102
|
-
<title>CDS README Sections</title><style>{css}</style></head>
|
|
103
|
-
<body><div class="wrap"><article class="markdown-body" id="root">
|
|
104
|
-
{body}
|
|
105
|
-
</article></div></body></html>
|
|
106
|
-
"""
|
|
107
|
-
).strip()
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def main() -> None:
|
|
111
|
-
OUT_DIR.mkdir(exist_ok=True)
|
|
112
|
-
html = build_html()
|
|
113
|
-
HTML_FILE.write_text(html, encoding="utf-8")
|
|
114
|
-
url = HTML_FILE.resolve().as_uri()
|
|
115
|
-
|
|
116
|
-
with sync_playwright() as p:
|
|
117
|
-
browser = p.chromium.launch()
|
|
118
|
-
ctx = browser.new_context(viewport={"width": 1080, "height": 1400}, device_scale_factor=2)
|
|
119
|
-
page = ctx.new_page()
|
|
120
|
-
page.goto(url, wait_until="load")
|
|
121
|
-
page.wait_for_timeout(800)
|
|
122
|
-
|
|
123
|
-
# --- 1. First-viewport (hero) screenshot, clipped to one screen ---
|
|
124
|
-
page.screenshot(path=str(OUT_TOP))
|
|
125
|
-
print(f"[ok] {OUT_TOP.name}")
|
|
126
|
-
|
|
127
|
-
# --- 2. Full-page, for reference ---
|
|
128
|
-
page.screenshot(path=str(OUT_FULL), full_page=True)
|
|
129
|
-
print(f"[ok] {OUT_FULL.name}")
|
|
130
|
-
|
|
131
|
-
# --- 3. Per-h2-section screenshots ---
|
|
132
|
-
# Find every H2's y position and slice the document.
|
|
133
|
-
headings = page.eval_on_selector_all(
|
|
134
|
-
"h2",
|
|
135
|
-
"els => els.map(e => ({text: e.innerText, y: e.getBoundingClientRect().top + window.scrollY, id: e.id}))",
|
|
136
|
-
)
|
|
137
|
-
page_height = page.evaluate("document.body.scrollHeight")
|
|
138
|
-
slices = []
|
|
139
|
-
for i, h in enumerate(headings):
|
|
140
|
-
top = int(h["y"])
|
|
141
|
-
# stop ~24px above the next heading so the border shows
|
|
142
|
-
bottom = int(headings[i + 1]["y"]) - 24 if i + 1 < len(headings) else page_height
|
|
143
|
-
# guard against degenerate / off-canvas clips
|
|
144
|
-
bottom = min(bottom, page_height)
|
|
145
|
-
if bottom - top < 80:
|
|
146
|
-
continue
|
|
147
|
-
slices.append((slug(h["text"]), top, bottom))
|
|
148
|
-
|
|
149
|
-
for slug_name, top, bottom in slices:
|
|
150
|
-
clip = {"x": 0, "y": top, "width": 1080, "height": bottom - top}
|
|
151
|
-
out = OUT_DIR / f"{slug_name}.png"
|
|
152
|
-
try:
|
|
153
|
-
page.screenshot(path=str(out), clip=clip)
|
|
154
|
-
print(f"[ok] sections/{slug_name}.png")
|
|
155
|
-
except Exception as e:
|
|
156
|
-
print(f"[skip] {slug_name}: {e}")
|
|
157
|
-
|
|
158
|
-
browser.close()
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def slug(text: str) -> str:
|
|
162
|
-
s = re.sub(r"[^\w\s-]", "", text.lower()).strip()
|
|
163
|
-
s = re.sub(r"[\s_-]+", "-", s)
|
|
164
|
-
return s or "section"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if __name__ == "__main__":
|
|
168
|
-
main()
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"""Smoke-test the installed ``cds`` console script and module entry point.
|
|
2
|
-
|
|
3
|
-
This script deliberately runs commands in a temporary directory so a source
|
|
4
|
-
checkout cannot shadow the installed wheel. It is used by CI and the release
|
|
5
|
-
workflow as a packaging/entry-point gate before anything is published to PyPI.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
|
|
10
|
-
import argparse
|
|
11
|
-
import os
|
|
12
|
-
import subprocess
|
|
13
|
-
import sys
|
|
14
|
-
import tempfile
|
|
15
|
-
from importlib.metadata import version
|
|
16
|
-
from pathlib import Path
|
|
17
|
-
|
|
18
|
-
DIST_NAME = "scientific-computing-system"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def _run(
|
|
22
|
-
command: list[str],
|
|
23
|
-
*,
|
|
24
|
-
cwd: Path,
|
|
25
|
-
stdin: str | None = None,
|
|
26
|
-
expected_text: str | None = None,
|
|
27
|
-
) -> None:
|
|
28
|
-
env = os.environ.copy()
|
|
29
|
-
env.pop("PYTHONPATH", None)
|
|
30
|
-
result = subprocess.run(
|
|
31
|
-
command,
|
|
32
|
-
cwd=cwd,
|
|
33
|
-
env=env,
|
|
34
|
-
input=stdin,
|
|
35
|
-
text=True,
|
|
36
|
-
capture_output=True,
|
|
37
|
-
check=False,
|
|
38
|
-
)
|
|
39
|
-
output = result.stdout + result.stderr
|
|
40
|
-
if result.returncode != 0:
|
|
41
|
-
raise RuntimeError(f"command failed ({result.returncode}): {' '.join(command)}\n{output}")
|
|
42
|
-
if expected_text is not None and expected_text not in output:
|
|
43
|
-
raise RuntimeError(
|
|
44
|
-
f"command output did not contain {expected_text!r}: {' '.join(command)}\n{output}"
|
|
45
|
-
)
|
|
46
|
-
print(f"PASS: {' '.join(command)}")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def verify_cli(expected_version: str | None = None) -> None:
|
|
50
|
-
"""Run representative commands against the installed distribution."""
|
|
51
|
-
installed_version = version(DIST_NAME)
|
|
52
|
-
if expected_version is not None and installed_version != expected_version:
|
|
53
|
-
raise RuntimeError(f"installed version is {installed_version}, expected {expected_version}")
|
|
54
|
-
|
|
55
|
-
with tempfile.TemporaryDirectory(prefix="cds-cli-smoke-") as temp_dir:
|
|
56
|
-
cwd = Path(temp_dir)
|
|
57
|
-
commands: list[tuple[list[str], str | None, str | None]] = [
|
|
58
|
-
(["cds", "--version"], None, installed_version),
|
|
59
|
-
([sys.executable, "-m", "cds", "--version"], None, installed_version),
|
|
60
|
-
(["cds", "--help"], None, "Scientific Computing System"),
|
|
61
|
-
(["cds", "version"], None, installed_version),
|
|
62
|
-
(["cds", "modules"], None, "cds."),
|
|
63
|
-
(["cds", "info"], None, "Version:"),
|
|
64
|
-
(["cds", "constants"], None, "Physical Constants"),
|
|
65
|
-
(["cds", "stats", "1,2,3,4"], None, "Descriptive stats"),
|
|
66
|
-
(["cds", "sample", "gaussian", "-n", "3", "--seed", "123"], None, None),
|
|
67
|
-
(
|
|
68
|
-
["cds", "integrate", "x2", "--a", "0", "--b", "1", "-n", "100"],
|
|
69
|
-
None,
|
|
70
|
-
"x2(x)",
|
|
71
|
-
),
|
|
72
|
-
(["cds", "plot", "1,3,2"], None, "CLI Plot"),
|
|
73
|
-
(["cds", "prompt", "Does X affect Y?", "--num", "1"], None, "Does X affect Y?"),
|
|
74
|
-
(
|
|
75
|
-
["cds", "hypothesis", "Does X affect Y?", "--num", "1", "--dry-run"],
|
|
76
|
-
None,
|
|
77
|
-
"Dry run mode",
|
|
78
|
-
),
|
|
79
|
-
(["cds", "benchmark"], None, "Benchmarking"),
|
|
80
|
-
(["cds", "calc", "ke"], "2\n3\n", "Kinetic Energy"),
|
|
81
|
-
(["cds", "dashboard", "--help"], None, "dashboard"),
|
|
82
|
-
]
|
|
83
|
-
for command, stdin, expected_text in commands:
|
|
84
|
-
_run(command, cwd=cwd, stdin=stdin, expected_text=expected_text)
|
|
85
|
-
|
|
86
|
-
print(f"Installed CLI verification passed for {DIST_NAME} {installed_version}.")
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def main() -> int:
|
|
90
|
-
"""CLI entry point for the verification script."""
|
|
91
|
-
parser = argparse.ArgumentParser(description=__doc__)
|
|
92
|
-
parser.add_argument("--expected-version", default=None)
|
|
93
|
-
args = parser.parse_args()
|
|
94
|
-
verify_cli(args.expected_version)
|
|
95
|
-
return 0
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if __name__ == "__main__":
|
|
99
|
-
raise SystemExit(main())
|