community-hierarchy 0.4.2__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.
- community_hierarchy-0.4.2/.copier-answers.yml +14 -0
- community_hierarchy-0.4.2/.git_archival.txt +3 -0
- community_hierarchy-0.4.2/.gitattributes +1 -0
- community_hierarchy-0.4.2/.github/CONTRIBUTING.md +77 -0
- community_hierarchy-0.4.2/.github/dependabot.yml +11 -0
- community_hierarchy-0.4.2/.github/release.yml +5 -0
- community_hierarchy-0.4.2/.github/workflows/release.yml +88 -0
- community_hierarchy-0.4.2/.gitignore +195 -0
- community_hierarchy-0.4.2/.pre-commit-config.yaml +104 -0
- community_hierarchy-0.4.2/.readthedocs.yaml +16 -0
- community_hierarchy-0.4.2/CMakeLists.txt +123 -0
- community_hierarchy-0.4.2/LICENSE +19 -0
- community_hierarchy-0.4.2/Makefile +111 -0
- community_hierarchy-0.4.2/PKG-INFO +217 -0
- community_hierarchy-0.4.2/README.md +185 -0
- community_hierarchy-0.4.2/TODO.md +69 -0
- community_hierarchy-0.4.2/bindings/python/bindings.cpp +628 -0
- community_hierarchy-0.4.2/bindings/wasm/CMakeLists.txt +33 -0
- community_hierarchy-0.4.2/bindings/wasm/README.md +83 -0
- community_hierarchy-0.4.2/bindings/wasm/js/index.js +180 -0
- community_hierarchy-0.4.2/bindings/wasm/js/package.json +35 -0
- community_hierarchy-0.4.2/bindings/wasm/js/runner.js +205 -0
- community_hierarchy-0.4.2/bindings/wasm/js/test/smoke.test.mjs +158 -0
- community_hierarchy-0.4.2/bindings/wasm/js/worker.js +59 -0
- community_hierarchy-0.4.2/bindings/wasm/src/ds_wasm.cpp +718 -0
- community_hierarchy-0.4.2/docs/ARCHITECTURE.md +139 -0
- community_hierarchy-0.4.2/docs/conf.py +65 -0
- community_hierarchy-0.4.2/docs/examples/prediction.md +6 -0
- community_hierarchy-0.4.2/docs/examples/speed_test.md +6 -0
- community_hierarchy-0.4.2/docs/examples/visualization.md +6 -0
- community_hierarchy-0.4.2/docs/index.md +18 -0
- community_hierarchy-0.4.2/docs/modules.md +8 -0
- community_hierarchy-0.4.2/examples/data/networks/business_depts.gml +39732 -0
- community_hierarchy-0.4.2/examples/data/networks/championship_2021.gml +6196 -0
- community_hierarchy-0.4.2/examples/data/networks/english-football.gml +59986 -0
- community_hierarchy-0.4.2/examples/data/networks/friends.gml +987 -0
- community_hierarchy-0.4.2/examples/data/networks/highschool_30.gml +11912 -0
- community_hierarchy-0.4.2/examples/data/networks/highschool_51.gml +6414 -0
- community_hierarchy-0.4.2/examples/data/networks/highschool_84.gml +15947 -0
- community_hierarchy-0.4.2/examples/paper/README.md +71 -0
- community_hierarchy-0.4.2/examples/paper/international_football/data/football_group_stage.gml +14026 -0
- community_hierarchy-0.4.2/examples/paper/international_football/figures/football_diffs.png +0 -0
- community_hierarchy-0.4.2/examples/paper/international_football/figures/football_scores.png +0 -0
- community_hierarchy-0.4.2/examples/paper/international_football/fit.py +32 -0
- community_hierarchy-0.4.2/examples/paper/international_football/plot.py +769 -0
- community_hierarchy-0.4.2/examples/paper/international_football/results/parameters_coupled.csv +12 -0
- community_hierarchy-0.4.2/examples/paper/international_football/results/parameters_independent.csv +12 -0
- community_hierarchy-0.4.2/examples/paper/international_football/results/scores_coupled.csv +216 -0
- community_hierarchy-0.4.2/examples/paper/international_football/results/scores_independent.csv +216 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/data/journal_citations.gml +31433 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/figures/journal_scores.png +0 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/fit.py +35 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/plot.py +713 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/results/parameters_coupled.csv +12 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/results/parameters_independent.csv +12 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/results/scores_coupled.csv +86 -0
- community_hierarchy-0.4.2/examples/paper/journal_citations/results/scores_independent.csv +86 -0
- community_hierarchy-0.4.2/examples/python/adjacency.png +0 -0
- community_hierarchy-0.4.2/examples/python/example.py +70 -0
- community_hierarchy-0.4.2/examples/python/node_properties.png +0 -0
- community_hierarchy-0.4.2/examples/python/q_trajectory.png +0 -0
- community_hierarchy-0.4.2/node_properties.csv +457 -0
- community_hierarchy-0.4.2/noxfile.py +121 -0
- community_hierarchy-0.4.2/pyproject.toml +198 -0
- community_hierarchy-0.4.2/python/community_hierarchy/src/community_hierarchy/MCMC_core.pyi +27 -0
- community_hierarchy-0.4.2/python/community_hierarchy/src/community_hierarchy/__init__.py +22 -0
- community_hierarchy-0.4.2/python/community_hierarchy/src/community_hierarchy/_core.pyi +4 -0
- community_hierarchy-0.4.2/python/community_hierarchy/src/community_hierarchy/_version.py +24 -0
- community_hierarchy-0.4.2/python/community_hierarchy/src/community_hierarchy/core.py +853 -0
- community_hierarchy-0.4.2/python/community_hierarchy/src/community_hierarchy/input_output.py +990 -0
- community_hierarchy-0.4.2/python/community_hierarchy/src/community_hierarchy/py.typed +0 -0
- community_hierarchy-0.4.2/src/MCMC_bookkeeping.cpp +649 -0
- community_hierarchy-0.4.2/src/MCMC_core.cpp +692 -0
- community_hierarchy-0.4.2/src/MCMC_core.h +286 -0
- community_hierarchy-0.4.2/src/MCMC_merge_split.cpp +585 -0
- community_hierarchy-0.4.2/src/MCMC_proposals.cpp +1140 -0
- community_hierarchy-0.4.2/src/fit.cpp +244 -0
- community_hierarchy-0.4.2/src/fit.h +78 -0
- community_hierarchy-0.4.2/src/fit_result.cpp +715 -0
- community_hierarchy-0.4.2/src/fit_result.h +107 -0
- community_hierarchy-0.4.2/src/globals.cpp +21 -0
- community_hierarchy-0.4.2/src/globals.h +162 -0
- community_hierarchy-0.4.2/src/helpers.cpp +497 -0
- community_hierarchy-0.4.2/src/helpers.h +96 -0
- community_hierarchy-0.4.2/src/rng.h +90 -0
- community_hierarchy-0.4.2/tests/README.md +38 -0
- community_hierarchy-0.4.2/tests/data/inputs/wins_ties_3node_point_eval.csv +12 -0
- community_hierarchy-0.4.2/tests/data/outputs/triangle_coupled_coincidence.csv +3 -0
- community_hierarchy-0.4.2/tests/data/outputs/triangle_independent_coincidence.csv +3 -0
- community_hierarchy-0.4.2/tests/data/outputs/wins_ties_3node_coincidence.csv +3 -0
- community_hierarchy-0.4.2/tests/data/outputs/wins_ties_3node_point_eval_components.csv +2 -0
- community_hierarchy-0.4.2/tests/flip_nodes_multi_test.cpp +168 -0
- community_hierarchy-0.4.2/tests/mcmc_core_test.cpp +473 -0
- community_hierarchy-0.4.2/tests/merge_split_test.cpp +210 -0
- community_hierarchy-0.4.2/tests/python/test_build_freshness.py +103 -0
- community_hierarchy-0.4.2/tests/python/test_hw_routing.py +101 -0
- community_hierarchy-0.4.2/tests/python/test_hw_sensitivity.py +125 -0
- community_hierarchy-0.4.2/tests/python/test_package.py +986 -0
- community_hierarchy-0.4.2/tests/python/test_regressions.py +306 -0
- community_hierarchy-0.4.2/tests/python/test_sampler_exactness.py +213 -0
- community_hierarchy-0.4.2/tests/python/test_weighted_sbm_model_selection.py +278 -0
- community_hierarchy-0.4.2/tests/smoke_wheel.py +15 -0
- community_hierarchy-0.4.2/tests/test_wasm_parity.py +552 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
|
2
|
+
_commit: 2025.11.21-25-gad4434f
|
|
3
|
+
_src_path: gh:scientific-python/cookie
|
|
4
|
+
backend: skbuild
|
|
5
|
+
docs: sphinx
|
|
6
|
+
email: mjerdee@santafe.edu
|
|
7
|
+
full_name: Maximilian Jerdee
|
|
8
|
+
license: MIT
|
|
9
|
+
org: maxjerdee
|
|
10
|
+
project_name: community_hierarchy
|
|
11
|
+
project_short_description: Infer communities, hierarchies, and their connection in
|
|
12
|
+
directed graphs
|
|
13
|
+
url: https://github.com/maxjerdee/community-hierarchy
|
|
14
|
+
vcs: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.git_archival.txt export-subst
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed
|
|
2
|
+
description of best practices for developing scientific packages.
|
|
3
|
+
|
|
4
|
+
[spc-dev-intro]: https://learn.scientific-python.org/development/
|
|
5
|
+
|
|
6
|
+
# Quick development
|
|
7
|
+
|
|
8
|
+
The fastest way to start with development is to use nox. If you don't have nox,
|
|
9
|
+
you can use `uvx nox` to run it without installing, or `uv tool install nox`. If
|
|
10
|
+
you don't have uv, you can
|
|
11
|
+
[install it a variety of ways](https://docs.astral.sh/uv/getting-started/installation/),
|
|
12
|
+
including with pip, pipx, brew, and just downloading the binary (single file).
|
|
13
|
+
|
|
14
|
+
To use, run `nox`. This will lint and test using every installed version of
|
|
15
|
+
Python on your system, skipping ones that are not installed. You can also run
|
|
16
|
+
specific jobs:
|
|
17
|
+
|
|
18
|
+
```console
|
|
19
|
+
$ nox -s lint # Lint only
|
|
20
|
+
$ nox -s tests # Python tests
|
|
21
|
+
$ nox -s docs # Build and serve the docs
|
|
22
|
+
$ nox -s build # Make an SDist and wheel
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Nox handles everything for you, including setting up an temporary virtual
|
|
26
|
+
environment for each run.
|
|
27
|
+
|
|
28
|
+
# Setting up a development environment manually
|
|
29
|
+
|
|
30
|
+
You can set up a development environment by running:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv sync
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
# Pre-commit
|
|
37
|
+
|
|
38
|
+
You should prepare pre-commit or prek, which will help you by checking that
|
|
39
|
+
commits pass required checks:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv tool install pre-commit # or brew install pre-commit on macOS
|
|
43
|
+
pre-commit install # Will install a pre-commit hook into the git repo
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also/alternatively run `pre-commit run` (changes only) or
|
|
47
|
+
`pre-commit run --all-files` to check even without installing the hook.
|
|
48
|
+
|
|
49
|
+
# Testing
|
|
50
|
+
|
|
51
|
+
Use pytest to run the unit checks:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
uv run pytest
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
# Coverage
|
|
58
|
+
|
|
59
|
+
Use pytest-cov to generate coverage reports:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv run pytest --cov=community_hierarchy
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
# Building docs
|
|
66
|
+
|
|
67
|
+
You can build and serve the docs using:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
nox -s docs
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
You can build the docs only with:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
nox -s docs --non-interactive
|
|
77
|
+
```
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Wheels and the sdist are built on every trigger; they are uploaded to PyPI
|
|
4
|
+
# only when a version tag (v*) is pushed.
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
push:
|
|
8
|
+
tags:
|
|
9
|
+
- "v*"
|
|
10
|
+
pull_request:
|
|
11
|
+
paths:
|
|
12
|
+
- .github/workflows/release.yml
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
FORCE_COLOR: 3
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
make_sdist:
|
|
23
|
+
name: Make SDist
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0
|
|
29
|
+
|
|
30
|
+
- name: Build SDist
|
|
31
|
+
run: pipx run build --sdist
|
|
32
|
+
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: cibw-sdist
|
|
36
|
+
path: dist/*.tar.gz
|
|
37
|
+
|
|
38
|
+
build_wheels:
|
|
39
|
+
name: Wheel on ${{ matrix.os }}
|
|
40
|
+
runs-on: ${{ matrix.os }}
|
|
41
|
+
strategy:
|
|
42
|
+
fail-fast: false
|
|
43
|
+
matrix:
|
|
44
|
+
os: [macos-15, ubuntu-latest, windows-latest]
|
|
45
|
+
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
with:
|
|
49
|
+
fetch-depth: 0
|
|
50
|
+
|
|
51
|
+
# Pin the host Python that runs cibuildwheel: the macOS runner's default
|
|
52
|
+
# (3.15) is newer than the virtualenv bundled with cibuildwheel 2.20.
|
|
53
|
+
- uses: actions/setup-python@v5
|
|
54
|
+
with:
|
|
55
|
+
python-version: "3.12"
|
|
56
|
+
|
|
57
|
+
- name: Install cibuildwheel
|
|
58
|
+
run: python -m pip install cibuildwheel==2.20
|
|
59
|
+
|
|
60
|
+
- name: Build wheels
|
|
61
|
+
env:
|
|
62
|
+
CIBW_ARCHS_LINUX: x86_64
|
|
63
|
+
CIBW_ARCHS_WINDOWS: AMD64
|
|
64
|
+
run: cibuildwheel --output-dir wheelhouse
|
|
65
|
+
|
|
66
|
+
- uses: actions/upload-artifact@v4
|
|
67
|
+
with:
|
|
68
|
+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
69
|
+
path: wheelhouse/*.whl
|
|
70
|
+
|
|
71
|
+
upload_all:
|
|
72
|
+
needs: [build_wheels, make_sdist]
|
|
73
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
74
|
+
environment: pypi
|
|
75
|
+
permissions:
|
|
76
|
+
id-token: write
|
|
77
|
+
contents: read
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/download-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
pattern: cibw-*
|
|
83
|
+
path: dist
|
|
84
|
+
merge-multiple: true
|
|
85
|
+
|
|
86
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
87
|
+
with:
|
|
88
|
+
verbose: true
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
build-wasm/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
#pdm.lock
|
|
114
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
115
|
+
# in version control.
|
|
116
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
117
|
+
.pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
122
|
+
__pypackages__/
|
|
123
|
+
|
|
124
|
+
# Celery stuff
|
|
125
|
+
celerybeat-schedule
|
|
126
|
+
celerybeat.pid
|
|
127
|
+
|
|
128
|
+
# SageMath parsed files
|
|
129
|
+
*.sage.py
|
|
130
|
+
|
|
131
|
+
# Environments
|
|
132
|
+
.env
|
|
133
|
+
.venv
|
|
134
|
+
env/
|
|
135
|
+
venv/
|
|
136
|
+
ENV/
|
|
137
|
+
env.bak/
|
|
138
|
+
venv.bak/
|
|
139
|
+
|
|
140
|
+
# Spyder project settings
|
|
141
|
+
.spyderproject
|
|
142
|
+
.spyproject
|
|
143
|
+
|
|
144
|
+
# Rope project settings
|
|
145
|
+
.ropeproject
|
|
146
|
+
|
|
147
|
+
# mkdocs documentation
|
|
148
|
+
/site
|
|
149
|
+
|
|
150
|
+
# mypy
|
|
151
|
+
.mypy_cache/
|
|
152
|
+
.dmypy.json
|
|
153
|
+
dmypy.json
|
|
154
|
+
|
|
155
|
+
# Pyre type checker
|
|
156
|
+
.pyre/
|
|
157
|
+
|
|
158
|
+
# pytype static type analyzer
|
|
159
|
+
.pytype/
|
|
160
|
+
|
|
161
|
+
# Cython debug symbols
|
|
162
|
+
cython_debug/
|
|
163
|
+
|
|
164
|
+
# PyCharm
|
|
165
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
166
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
167
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
168
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
169
|
+
#.idea/
|
|
170
|
+
|
|
171
|
+
# setuptools_scm
|
|
172
|
+
src/*/_version.py
|
|
173
|
+
python/community_hierarchy/src/community_hierarchy/_version.py
|
|
174
|
+
python/community_hierarchy/src/community_hierarchy/_version.pyi
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
# ruff
|
|
178
|
+
.ruff_cache/
|
|
179
|
+
|
|
180
|
+
# OS specific stuff
|
|
181
|
+
.DS_Store
|
|
182
|
+
.DS_Store?
|
|
183
|
+
._*
|
|
184
|
+
.Spotlight-V100
|
|
185
|
+
.Trashes
|
|
186
|
+
ehthumbs.db
|
|
187
|
+
Thumbs.db
|
|
188
|
+
|
|
189
|
+
# Common editor files
|
|
190
|
+
*~
|
|
191
|
+
*.swp
|
|
192
|
+
|
|
193
|
+
# paper examples: map downloads and PDF copies of the figures
|
|
194
|
+
examples/paper/*/.cache/
|
|
195
|
+
examples/paper/*/figures/*.pdf
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
|
|
3
|
+
autofix_commit_msg: "style: pre-commit fixes"
|
|
4
|
+
autoupdate_schedule: "monthly"
|
|
5
|
+
|
|
6
|
+
exclude: ^.cruft.json|.copier-answers.yml$
|
|
7
|
+
|
|
8
|
+
repos:
|
|
9
|
+
- repo: https://github.com/adamchainz/blacken-docs
|
|
10
|
+
rev: "1.20.0"
|
|
11
|
+
hooks:
|
|
12
|
+
- id: blacken-docs
|
|
13
|
+
additional_dependencies: [black==25.*]
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
16
|
+
rev: "v6.0.0"
|
|
17
|
+
hooks:
|
|
18
|
+
- id: check-added-large-files
|
|
19
|
+
- id: check-case-conflict
|
|
20
|
+
- id: check-merge-conflict
|
|
21
|
+
- id: check-symlinks
|
|
22
|
+
- id: check-yaml
|
|
23
|
+
- id: debug-statements
|
|
24
|
+
- id: end-of-file-fixer
|
|
25
|
+
- id: mixed-line-ending
|
|
26
|
+
- id: name-tests-test
|
|
27
|
+
args: ["--pytest-test-first"]
|
|
28
|
+
- id: requirements-txt-fixer
|
|
29
|
+
- id: trailing-whitespace
|
|
30
|
+
|
|
31
|
+
- repo: https://github.com/pre-commit/pygrep-hooks
|
|
32
|
+
rev: "v1.10.0"
|
|
33
|
+
hooks:
|
|
34
|
+
- id: rst-backticks
|
|
35
|
+
- id: rst-directive-colons
|
|
36
|
+
- id: rst-inline-touching-normal
|
|
37
|
+
|
|
38
|
+
- repo: https://github.com/rbubley/mirrors-prettier
|
|
39
|
+
rev: "v3.7.4"
|
|
40
|
+
hooks:
|
|
41
|
+
- id: prettier
|
|
42
|
+
types_or: [yaml, markdown, html, css, scss, javascript, json]
|
|
43
|
+
args: [--prose-wrap=always]
|
|
44
|
+
|
|
45
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
46
|
+
rev: "v0.14.11"
|
|
47
|
+
hooks:
|
|
48
|
+
- id: ruff-check
|
|
49
|
+
args: ["--fix", "--show-fixes"]
|
|
50
|
+
- id: ruff-format
|
|
51
|
+
|
|
52
|
+
- repo: https://github.com/pre-commit/mirrors-clang-format
|
|
53
|
+
rev: "v21.1.8"
|
|
54
|
+
hooks:
|
|
55
|
+
- id: clang-format
|
|
56
|
+
types_or: [c++, c, cuda]
|
|
57
|
+
|
|
58
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
59
|
+
rev: "v1.19.1"
|
|
60
|
+
hooks:
|
|
61
|
+
- id: mypy
|
|
62
|
+
files: src|tests|noxfile.py
|
|
63
|
+
args: []
|
|
64
|
+
additional_dependencies:
|
|
65
|
+
- nox
|
|
66
|
+
- pytest
|
|
67
|
+
|
|
68
|
+
- repo: https://github.com/codespell-project/codespell
|
|
69
|
+
rev: "v2.4.1"
|
|
70
|
+
hooks:
|
|
71
|
+
- id: codespell
|
|
72
|
+
additional_dependencies:
|
|
73
|
+
- tomli; python_version<'3.11'
|
|
74
|
+
|
|
75
|
+
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
76
|
+
rev: "v0.11.0.1"
|
|
77
|
+
hooks:
|
|
78
|
+
- id: shellcheck
|
|
79
|
+
|
|
80
|
+
- repo: local
|
|
81
|
+
hooks:
|
|
82
|
+
- id: disallow-caps
|
|
83
|
+
name: Disallow improper capitalization
|
|
84
|
+
language: pygrep
|
|
85
|
+
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
|
|
86
|
+
exclude: .pre-commit-config.yaml
|
|
87
|
+
|
|
88
|
+
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
|
89
|
+
rev: "v0.6.13"
|
|
90
|
+
hooks:
|
|
91
|
+
- id: cmake-format
|
|
92
|
+
|
|
93
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
94
|
+
rev: "v0.24.1"
|
|
95
|
+
hooks:
|
|
96
|
+
- id: validate-pyproject
|
|
97
|
+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
|
|
98
|
+
|
|
99
|
+
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
100
|
+
rev: "0.36.0"
|
|
101
|
+
hooks:
|
|
102
|
+
- id: check-dependabot
|
|
103
|
+
- id: check-github-workflows
|
|
104
|
+
- id: check-readthedocs
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Read the Docs configuration file
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
|
|
6
|
+
build:
|
|
7
|
+
os: ubuntu-24.04
|
|
8
|
+
tools:
|
|
9
|
+
python: "3.12"
|
|
10
|
+
commands:
|
|
11
|
+
- asdf plugin add uv
|
|
12
|
+
- asdf install uv latest
|
|
13
|
+
- asdf global uv latest
|
|
14
|
+
- uv sync --group docs
|
|
15
|
+
- uv run python -m sphinx -T -b html -d docs/_build/doctrees -D language=en
|
|
16
|
+
docs $READTHEDOCS_OUTPUT/html
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15...3.26)
|
|
2
|
+
# scikit-build-core passes SKBUILD_PROJECT_NAME; plain cmake / emcmake do not.
|
|
3
|
+
if(DEFINED SKBUILD_PROJECT_NAME)
|
|
4
|
+
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
|
|
5
|
+
else()
|
|
6
|
+
project(community_hierarchy LANGUAGES CXX)
|
|
7
|
+
endif()
|
|
8
|
+
|
|
9
|
+
option(BUILD_TESTING "Build Catch2-based native tests" OFF)
|
|
10
|
+
|
|
11
|
+
# Under Emscripten there is no Python: build the wasm module instead.
|
|
12
|
+
if(EMSCRIPTEN)
|
|
13
|
+
set(_ds_default_python OFF)
|
|
14
|
+
set(_ds_default_wasm ON)
|
|
15
|
+
else()
|
|
16
|
+
set(_ds_default_python ON)
|
|
17
|
+
set(_ds_default_wasm OFF)
|
|
18
|
+
endif()
|
|
19
|
+
option(DS_BUILD_PYTHON "Build the pybind11 extension module (MCMC_core)" ${_ds_default_python})
|
|
20
|
+
option(DS_NATIVE_ARCH "Optimise for the build machine's CPU (-march=native)" OFF)
|
|
21
|
+
option(DS_BUILD_WASM "Build the WebAssembly module (bindings/wasm; configure with emcmake)" ${_ds_default_wasm})
|
|
22
|
+
|
|
23
|
+
# Core sources: everything except fit.cpp (which uses std::async) so WASM can
|
|
24
|
+
# link the same library without threading. fit.cpp is added back for native builds.
|
|
25
|
+
set(DS_CORE_SOURCES
|
|
26
|
+
src/MCMC_core.cpp
|
|
27
|
+
src/MCMC_proposals.cpp
|
|
28
|
+
src/MCMC_merge_split.cpp
|
|
29
|
+
src/MCMC_bookkeeping.cpp
|
|
30
|
+
src/helpers.cpp
|
|
31
|
+
src/globals.cpp
|
|
32
|
+
src/fit_result.cpp)
|
|
33
|
+
|
|
34
|
+
# Build a reusable core library so other language bindings can link against it
|
|
35
|
+
add_library(community_hierarchy_core STATIC ${DS_CORE_SOURCES})
|
|
36
|
+
target_include_directories(community_hierarchy_core PUBLIC ${CMAKE_SOURCE_DIR}/src)
|
|
37
|
+
set_target_properties(community_hierarchy_core PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
38
|
+
target_compile_features(community_hierarchy_core PUBLIC cxx_std_17)
|
|
39
|
+
|
|
40
|
+
if(EMSCRIPTEN)
|
|
41
|
+
# C++ exceptions carry error messages to JavaScript.
|
|
42
|
+
target_compile_options(community_hierarchy_core PUBLIC -fexceptions -O3)
|
|
43
|
+
target_link_options(community_hierarchy_core PUBLIC -fexceptions)
|
|
44
|
+
else()
|
|
45
|
+
# Portable by default, so that published wheels run on any CPU of their
|
|
46
|
+
# architecture; -DDS_NATIVE_ARCH=ON tunes a local build to the build machine.
|
|
47
|
+
if(NOT MSVC)
|
|
48
|
+
target_compile_options(community_hierarchy_core PRIVATE -O3)
|
|
49
|
+
if(DS_NATIVE_ARCH)
|
|
50
|
+
target_compile_options(community_hierarchy_core PRIVATE -march=native)
|
|
51
|
+
endif()
|
|
52
|
+
endif()
|
|
53
|
+
# Native build: include fit.cpp (uses std::async)
|
|
54
|
+
target_sources(community_hierarchy_core PRIVATE src/fit.cpp)
|
|
55
|
+
endif()
|
|
56
|
+
|
|
57
|
+
if(DS_BUILD_PYTHON)
|
|
58
|
+
set(PYBIND11_FINDPYTHON ON)
|
|
59
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
60
|
+
|
|
61
|
+
# Python bindings: a small pybind11 module that links to the core library
|
|
62
|
+
pybind11_add_module(MCMC_core MODULE bindings/python/bindings.cpp)
|
|
63
|
+
target_link_libraries(MCMC_core PRIVATE community_hierarchy_core)
|
|
64
|
+
target_include_directories(MCMC_core PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
|
65
|
+
target_compile_features(MCMC_core PRIVATE cxx_std_17)
|
|
66
|
+
set_target_properties(
|
|
67
|
+
MCMC_core PROPERTIES LIBRARY_OUTPUT_DIRECTORY
|
|
68
|
+
${CMAKE_SOURCE_DIR}/python/community_hierarchy/src/community_hierarchy)
|
|
69
|
+
install(TARGETS MCMC_core LIBRARY DESTINATION community_hierarchy)
|
|
70
|
+
endif()
|
|
71
|
+
|
|
72
|
+
if(DS_BUILD_WASM)
|
|
73
|
+
add_subdirectory(bindings/wasm)
|
|
74
|
+
endif()
|
|
75
|
+
|
|
76
|
+
if(BUILD_TESTING)
|
|
77
|
+
enable_testing()
|
|
78
|
+
|
|
79
|
+
find_package(Catch2 3 QUIET)
|
|
80
|
+
if(NOT Catch2_FOUND)
|
|
81
|
+
include(FetchContent)
|
|
82
|
+
FetchContent_Declare(
|
|
83
|
+
Catch2
|
|
84
|
+
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
|
85
|
+
GIT_TAG v3.7.1
|
|
86
|
+
GIT_SHALLOW TRUE
|
|
87
|
+
)
|
|
88
|
+
FetchContent_MakeAvailable(Catch2)
|
|
89
|
+
list(APPEND CMAKE_MODULE_PATH "${catch2_SOURCE_DIR}/extras")
|
|
90
|
+
endif()
|
|
91
|
+
|
|
92
|
+
add_executable(mcmc_core_test
|
|
93
|
+
tests/mcmc_core_test.cpp
|
|
94
|
+
src/MCMC_core.cpp
|
|
95
|
+
src/MCMC_proposals.cpp
|
|
96
|
+
src/MCMC_merge_split.cpp
|
|
97
|
+
src/MCMC_bookkeeping.cpp
|
|
98
|
+
src/helpers.cpp
|
|
99
|
+
src/globals.cpp
|
|
100
|
+
src/fit_result.cpp
|
|
101
|
+
src/fit.cpp
|
|
102
|
+
)
|
|
103
|
+
target_include_directories(mcmc_core_test PRIVATE tests src)
|
|
104
|
+
target_compile_features(mcmc_core_test PRIVATE cxx_std_17)
|
|
105
|
+
target_compile_options(mcmc_core_test PRIVATE -Wall -Wextra)
|
|
106
|
+
target_link_libraries(mcmc_core_test PRIVATE Catch2::Catch2WithMain)
|
|
107
|
+
|
|
108
|
+
# Plain-main() tests of the collective moves: the multi-node flip_nodes path
|
|
109
|
+
# (two oracles) and merge/split against exact targets.
|
|
110
|
+
foreach(t flip_nodes_multi_test merge_split_test)
|
|
111
|
+
add_executable(${t} tests/${t}.cpp
|
|
112
|
+
src/MCMC_core.cpp src/MCMC_proposals.cpp src/MCMC_merge_split.cpp
|
|
113
|
+
src/MCMC_bookkeeping.cpp src/helpers.cpp src/globals.cpp)
|
|
114
|
+
target_include_directories(${t} PRIVATE src)
|
|
115
|
+
target_compile_features(${t} PRIVATE cxx_std_17)
|
|
116
|
+
endforeach()
|
|
117
|
+
|
|
118
|
+
include(CTest)
|
|
119
|
+
# mcmc_core_test reads examples/data/... relative to the repository root.
|
|
120
|
+
add_test(NAME mcmc_core_test COMMAND mcmc_core_test WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
|
121
|
+
add_test(NAME flip_nodes_multi_test COMMAND flip_nodes_multi_test)
|
|
122
|
+
add_test(NAME merge_split_test COMMAND merge_split_test)
|
|
123
|
+
endif()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2026 Maximilian Jerdee
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|