synthpopcan 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. synthpopcan-0.1.0/.github/workflows/ci.yml +53 -0
  2. synthpopcan-0.1.0/.github/workflows/publish.yml +39 -0
  3. synthpopcan-0.1.0/.gitignore +38 -0
  4. synthpopcan-0.1.0/.readthedocs.yaml +19 -0
  5. synthpopcan-0.1.0/.vscode/settings.json +16 -0
  6. synthpopcan-0.1.0/CONTRIBUTING.md +58 -0
  7. synthpopcan-0.1.0/LICENSE +21 -0
  8. synthpopcan-0.1.0/NOTES.md +842 -0
  9. synthpopcan-0.1.0/PKG-INFO +157 -0
  10. synthpopcan-0.1.0/PLANS.md +805 -0
  11. synthpopcan-0.1.0/README.md +112 -0
  12. synthpopcan-0.1.0/SECURITY.md +34 -0
  13. synthpopcan-0.1.0/assets/branding/README.md +33 -0
  14. synthpopcan-0.1.0/assets/branding/icon/favicon.ico +0 -0
  15. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-128.png +0 -0
  16. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-16.png +0 -0
  17. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-256.png +0 -0
  18. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-32.png +0 -0
  19. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-512.png +0 -0
  20. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-64.png +0 -0
  21. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-master.png +0 -0
  22. synthpopcan-0.1.0/assets/branding/icon/synthpopcan-icon-source.png +0 -0
  23. synthpopcan-0.1.0/assets/branding/logo/synthpopcan-logo-1024.png +0 -0
  24. synthpopcan-0.1.0/assets/branding/logo/synthpopcan-logo-256.png +0 -0
  25. synthpopcan-0.1.0/assets/branding/logo/synthpopcan-logo-512.png +0 -0
  26. synthpopcan-0.1.0/assets/branding/logo/synthpopcan-logo-master.png +0 -0
  27. synthpopcan-0.1.0/assets/branding/logo/synthpopcan-logo-source.png +0 -0
  28. synthpopcan-0.1.0/biome.json +18 -0
  29. synthpopcan-0.1.0/docs/_static/.gitkeep +1 -0
  30. synthpopcan-0.1.0/docs/_templates/.gitkeep +1 -0
  31. synthpopcan-0.1.0/docs/acknowledgments.md +27 -0
  32. synthpopcan-0.1.0/docs/api.rst +118 -0
  33. synthpopcan-0.1.0/docs/conf.py +48 -0
  34. synthpopcan-0.1.0/docs/controls.md +188 -0
  35. synthpopcan-0.1.0/docs/data.md +100 -0
  36. synthpopcan-0.1.0/docs/field-primer.md +294 -0
  37. synthpopcan-0.1.0/docs/index.rst +79 -0
  38. synthpopcan-0.1.0/docs/installation.md +191 -0
  39. synthpopcan-0.1.0/docs/introduction.md +184 -0
  40. synthpopcan-0.1.0/docs/ipf.md +481 -0
  41. synthpopcan-0.1.0/docs/library-getting-started.md +279 -0
  42. synthpopcan-0.1.0/docs/library.md +389 -0
  43. synthpopcan-0.1.0/docs/microdata.md +260 -0
  44. synthpopcan-0.1.0/docs/requirements.txt +3 -0
  45. synthpopcan-0.1.0/docs/sources.md +101 -0
  46. synthpopcan-0.1.0/docs/statcan.md +136 -0
  47. synthpopcan-0.1.0/docs/status.md +191 -0
  48. synthpopcan-0.1.0/docs/tree.md +727 -0
  49. synthpopcan-0.1.0/docs/validate.md +150 -0
  50. synthpopcan-0.1.0/docs/web-app.md +105 -0
  51. synthpopcan-0.1.0/package-lock.json +188 -0
  52. synthpopcan-0.1.0/package.json +12 -0
  53. synthpopcan-0.1.0/pyproject.toml +78 -0
  54. synthpopcan-0.1.0/scripts/benchmark_ipf.py +61 -0
  55. synthpopcan-0.1.0/scripts/benchmark_ipf_backends.py +456 -0
  56. synthpopcan-0.1.0/scripts/benchmark_tree_linked.py +253 -0
  57. synthpopcan-0.1.0/scripts/build_quebec_model_package.py +389 -0
  58. synthpopcan-0.1.0/src/synthpopcan/__init__.py +33 -0
  59. synthpopcan-0.1.0/src/synthpopcan/api.py +509 -0
  60. synthpopcan-0.1.0/src/synthpopcan/benchmarks.py +179 -0
  61. synthpopcan-0.1.0/src/synthpopcan/calibration.py +201 -0
  62. synthpopcan-0.1.0/src/synthpopcan/cli.py +1216 -0
  63. synthpopcan-0.1.0/src/synthpopcan/cli_ipf.py +351 -0
  64. synthpopcan-0.1.0/src/synthpopcan/cli_microdata.py +489 -0
  65. synthpopcan-0.1.0/src/synthpopcan/cli_output.py +657 -0
  66. synthpopcan-0.1.0/src/synthpopcan/cli_tree.py +2093 -0
  67. synthpopcan-0.1.0/src/synthpopcan/console.py +121 -0
  68. synthpopcan-0.1.0/src/synthpopcan/controls.py +803 -0
  69. synthpopcan-0.1.0/src/synthpopcan/diagnostics.py +320 -0
  70. synthpopcan-0.1.0/src/synthpopcan/ipf.py +368 -0
  71. synthpopcan-0.1.0/src/synthpopcan/localdata.py +120 -0
  72. synthpopcan-0.1.0/src/synthpopcan/microdata.py +1385 -0
  73. synthpopcan-0.1.0/src/synthpopcan/models/__init__.py +266 -0
  74. synthpopcan-0.1.0/src/synthpopcan/models/demo-linked-household-person-package.json +828 -0
  75. synthpopcan-0.1.0/src/synthpopcan/sources.py +86 -0
  76. synthpopcan-0.1.0/src/synthpopcan/statcan.py +526 -0
  77. synthpopcan-0.1.0/src/synthpopcan/tree.py +1672 -0
  78. synthpopcan-0.1.0/src/synthpopcan/tree_benchmark.py +368 -0
  79. synthpopcan-0.1.0/src/synthpopcan/validation.py +303 -0
  80. synthpopcan-0.1.0/src/synthpopcan/web/__init__.py +1 -0
  81. synthpopcan-0.1.0/src/synthpopcan/web/app.mjs +555 -0
  82. synthpopcan-0.1.0/src/synthpopcan/web/browser-job.mjs +27 -0
  83. synthpopcan-0.1.0/src/synthpopcan/web/csv.mjs +87 -0
  84. synthpopcan-0.1.0/src/synthpopcan/web/index.html +339 -0
  85. synthpopcan-0.1.0/src/synthpopcan/web/ipf.mjs +208 -0
  86. synthpopcan-0.1.0/src/synthpopcan/web/preview.mjs +79 -0
  87. synthpopcan-0.1.0/src/synthpopcan/web/result-ui.mjs +151 -0
  88. synthpopcan-0.1.0/src/synthpopcan/web/starter-files.mjs +56 -0
  89. synthpopcan-0.1.0/src/synthpopcan/web/statcan.mjs +149 -0
  90. synthpopcan-0.1.0/src/synthpopcan/web/styles.css +674 -0
  91. synthpopcan-0.1.0/src/synthpopcan/web/synthpopcan-icon-64.png +0 -0
  92. synthpopcan-0.1.0/src/synthpopcan/web/synthpopcan-logo-256.png +0 -0
  93. synthpopcan-0.1.0/src/synthpopcan/web/tree-model.mjs +495 -0
  94. synthpopcan-0.1.0/src/synthpopcan/web/wds-normalize.mjs +171 -0
  95. synthpopcan-0.1.0/src/synthpopcan/web/worker.mjs +122 -0
  96. synthpopcan-0.1.0/src/synthpopcan/web/workflow-views.mjs +127 -0
  97. synthpopcan-0.1.0/src/synthpopcan/web/zip.mjs +99 -0
  98. synthpopcan-0.1.0/src/synthpopcan/web_wds.py +217 -0
  99. synthpopcan-0.1.0/src/synthpopcan/webapp.py +140 -0
  100. synthpopcan-0.1.0/tests/fixtures/workflows/linked_tree/hierarchical.csv +4 -0
  101. synthpopcan-0.1.0/tests/fixtures/workflows/microdata_ipf/controls.csv +5 -0
  102. synthpopcan-0.1.0/tests/fixtures/workflows/microdata_ipf/expected-seed.csv +3 -0
  103. synthpopcan-0.1.0/tests/fixtures/workflows/microdata_ipf/hierarchical.csv +3 -0
  104. synthpopcan-0.1.0/tests/fixtures/workflows/microdata_tree/expected-person-training.csv +4 -0
  105. synthpopcan-0.1.0/tests/fixtures/workflows/microdata_tree/hierarchical.csv +4 -0
  106. synthpopcan-0.1.0/tests/fixtures/workflows/wds_ipf/categories-filled.json +6 -0
  107. synthpopcan-0.1.0/tests/fixtures/workflows/wds_ipf/categories-template.json +6 -0
  108. synthpopcan-0.1.0/tests/fixtures/workflows/wds_ipf/expected-controls.csv +3 -0
  109. synthpopcan-0.1.0/tests/fixtures/workflows/wds_ipf/seed.csv +3 -0
  110. synthpopcan-0.1.0/tests/fixtures/workflows/wds_ipf/wds-table.csv +3 -0
  111. synthpopcan-0.1.0/tests/test_api.py +278 -0
  112. synthpopcan-0.1.0/tests/test_benchmarks.py +94 -0
  113. synthpopcan-0.1.0/tests/test_calibration.py +73 -0
  114. synthpopcan-0.1.0/tests/test_cli.py +149 -0
  115. synthpopcan-0.1.0/tests/test_cli_output.py +360 -0
  116. synthpopcan-0.1.0/tests/test_console.py +43 -0
  117. synthpopcan-0.1.0/tests/test_controls.py +1095 -0
  118. synthpopcan-0.1.0/tests/test_docs.py +81 -0
  119. synthpopcan-0.1.0/tests/test_ipf.py +1359 -0
  120. synthpopcan-0.1.0/tests/test_localdata.py +167 -0
  121. synthpopcan-0.1.0/tests/test_microdata.py +1556 -0
  122. synthpopcan-0.1.0/tests/test_models.py +102 -0
  123. synthpopcan-0.1.0/tests/test_sources.py +116 -0
  124. synthpopcan-0.1.0/tests/test_statcan.py +734 -0
  125. synthpopcan-0.1.0/tests/test_statcan_live.py +50 -0
  126. synthpopcan-0.1.0/tests/test_tree.py +3381 -0
  127. synthpopcan-0.1.0/tests/test_tree_benchmark.py +218 -0
  128. synthpopcan-0.1.0/tests/test_validation.py +618 -0
  129. synthpopcan-0.1.0/tests/test_webapp.py +528 -0
  130. synthpopcan-0.1.0/tests/test_workflows.py +732 -0
  131. synthpopcan-0.1.0/tests/web/csv.test.mjs +16 -0
  132. synthpopcan-0.1.0/tests/web/ipf.test.mjs +55 -0
  133. synthpopcan-0.1.0/tests/web/preview.test.mjs +25 -0
  134. synthpopcan-0.1.0/tests/web/starter-files.test.mjs +34 -0
  135. synthpopcan-0.1.0/tests/web/statcan.test.mjs +81 -0
  136. synthpopcan-0.1.0/tests/web/tree-model.test.mjs +270 -0
  137. synthpopcan-0.1.0/tests/web/wds-normalize.test.mjs +184 -0
  138. synthpopcan-0.1.0/uv.lock +1228 -0
@@ -0,0 +1,53 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ python:
10
+ name: Python
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check out repository
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Set up uv
17
+ uses: astral-sh/setup-uv@v5
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+
24
+ - name: Install dependencies
25
+ run: uv sync --group dev --group docs
26
+
27
+ - name: Lint Python
28
+ run: uv run ruff check src tests scripts
29
+
30
+ - name: Run tests
31
+ run: uv run pytest
32
+
33
+ - name: Build documentation
34
+ run: uv run sphinx-build -W -b html docs docs/_build/html
35
+
36
+ web:
37
+ name: Web assets
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - name: Check out repository
41
+ uses: actions/checkout@v4
42
+
43
+ - name: Set up Node
44
+ uses: actions/setup-node@v4
45
+ with:
46
+ node-version: "24"
47
+ cache: npm
48
+
49
+ - name: Install dependencies
50
+ run: npm ci
51
+
52
+ - name: Check web assets
53
+ run: npm run check:web
@@ -0,0 +1,39 @@
1
+ name: Publish Python package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ build:
11
+ name: Build distributions
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v5
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+ - run: uv build
20
+ - uses: actions/upload-artifact@v4
21
+ with:
22
+ name: python-package-distributions
23
+ path: dist/*
24
+
25
+ publish-to-pypi:
26
+ name: Publish to PyPI
27
+ needs: build
28
+ runs-on: ubuntu-latest
29
+ environment:
30
+ name: pypi
31
+ url: https://pypi.org/p/synthpopcan
32
+ permissions:
33
+ id-token: write
34
+ steps:
35
+ - uses: actions/download-artifact@v4
36
+ with:
37
+ name: python-package-distributions
38
+ path: dist/
39
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,38 @@
1
+ # Local data and reference corpora copied from Downloads.
2
+ /data/
3
+ /references/
4
+
5
+ # Python/cache/build artifacts.
6
+ __pycache__/
7
+ *.py[cod]
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .coverage
12
+ htmlcov/
13
+ dist/
14
+ build/
15
+ *.egg-info/
16
+ /docs/_build/
17
+
18
+ # JavaScript dev tooling artifacts.
19
+ node_modules/
20
+ .npm/
21
+
22
+ # Virtual environments and local environment files.
23
+ .venv/
24
+ venv/
25
+ .env
26
+ .env.*
27
+
28
+ # OS/editor noise.
29
+ .DS_Store
30
+ .idea/
31
+ .vscode/*
32
+ !.vscode/
33
+ !.vscode/settings.json
34
+
35
+ # Future run outputs and notebooks checkpoints.
36
+ /runs/
37
+ /outputs/
38
+ .ipynb_checkpoints/
@@ -0,0 +1,19 @@
1
+ # Read the Docs configuration file for SynthPopCan.
2
+ # See https://docs.readthedocs.com/platform/stable/config-file/v2.html
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-24.04
8
+ tools:
9
+ python: "3.12"
10
+
11
+ sphinx:
12
+ configuration: docs/conf.py
13
+ fail_on_warning: true
14
+
15
+ python:
16
+ install:
17
+ - requirements: docs/requirements.txt
18
+ - method: pip
19
+ path: .
@@ -0,0 +1,16 @@
1
+ {
2
+ "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
3
+ "python.analysis.extraPaths": ["${workspaceFolder}/src"],
4
+ "python.analysis.diagnosticMode": "workspace",
5
+ "python.analysis.typeCheckingMode": "off",
6
+ "python.analysis.exclude": [
7
+ "**/.venv",
8
+ "**/__pycache__",
9
+ "**/.pytest_cache",
10
+ "**/.ruff_cache",
11
+ "docs/_build",
12
+ "node_modules",
13
+ "dist"
14
+ ],
15
+ "python.terminal.activateEnvironment": true
16
+ }
@@ -0,0 +1,58 @@
1
+ # Contributing
2
+
3
+ SynthPopCan is early-stage research software. Keep changes small, reviewable,
4
+ and grounded in the existing code and documentation structure.
5
+
6
+ ## Development Setup
7
+
8
+ Install the Python and documentation dependencies:
9
+
10
+ ```bash
11
+ uv sync --group dev --group docs
12
+ ```
13
+
14
+ Install web tooling:
15
+
16
+ ```bash
17
+ npm ci
18
+ ```
19
+
20
+ Run the normal checks before opening a pull request:
21
+
22
+ ```bash
23
+ uv run ruff check src tests scripts
24
+ uv run pytest
25
+ uv run sphinx-build -W -b html docs docs/_build/html
26
+ npm run check:web
27
+ ```
28
+
29
+ ## Data And Model Safety
30
+
31
+ Do not commit raw Census microdata, downloaded bulk data caches, generated CSV
32
+ outputs, private research datasets, or local reference corpora. Keep those files
33
+ under ignored paths such as `data/raw`, `data/private`, `references`, `runs`, or
34
+ `outputs`.
35
+
36
+ Reviewed model packages may be published only when they are explicitly intended
37
+ for distribution and carry provenance and disclosure-risk metadata. Large
38
+ packages should be uploaded as GitHub Release assets and listed in the model
39
+ registry, not bundled into the normal Python package.
40
+
41
+ Before contributing a model artifact:
42
+
43
+ - verify it contains no raw source rows or source identifiers;
44
+ - inspect its provenance and redistribution notes;
45
+ - run the relevant SynthPopCan audit/release workflow;
46
+ - confirm large files are distributed as release assets with checksums and
47
+ fetched on demand by `synthpopcan models fetch`.
48
+
49
+ ## Documentation
50
+
51
+ User-facing behavior should be documented where readers will look for it:
52
+
53
+ - `README.md` for project orientation and public-repo expectations;
54
+ - `docs/` for workflow and API documentation;
55
+ - `PLANS.md` for open roadmap items;
56
+ - `NOTES.md` for research notes.
57
+
58
+ Avoid putting long walkthroughs in the README when they belong in Sphinx docs.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Darcy Quesnel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.