clustering-mi 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 (51) hide show
  1. clustering_mi-0.1.0/.copier-answers.yml +13 -0
  2. clustering_mi-0.1.0/.git_archival.txt +3 -0
  3. clustering_mi-0.1.0/.gitattributes +1 -0
  4. clustering_mi-0.1.0/.github/CONTRIBUTING.md +77 -0
  5. clustering_mi-0.1.0/.github/dependabot.yml +11 -0
  6. clustering_mi-0.1.0/.github/release.yml +5 -0
  7. clustering_mi-0.1.0/.github/workflows/cd.yml +60 -0
  8. clustering_mi-0.1.0/.github/workflows/ci.yml +77 -0
  9. clustering_mi-0.1.0/.gitignore +158 -0
  10. clustering_mi-0.1.0/.pre-commit-config.yaml +96 -0
  11. clustering_mi-0.1.0/.pylintrc +569 -0
  12. clustering_mi-0.1.0/.readthedocs.yaml +16 -0
  13. clustering_mi-0.1.0/LICENSE +19 -0
  14. clustering_mi-0.1.0/PKG-INFO +184 -0
  15. clustering_mi-0.1.0/README.md +155 -0
  16. clustering_mi-0.1.0/docs/conf.py +64 -0
  17. clustering_mi-0.1.0/docs/examples/figures.md +6 -0
  18. clustering_mi-0.1.0/docs/index.md +15 -0
  19. clustering_mi-0.1.0/docs/modules.md +8 -0
  20. clustering_mi-0.1.0/examples/data/2307.01282/fig_1_1.txt +64 -0
  21. clustering_mi-0.1.0/examples/data/2307.01282/fig_1_2.txt +64 -0
  22. clustering_mi-0.1.0/examples/data/2307.01282/fig_2_1.txt +64 -0
  23. clustering_mi-0.1.0/examples/data/2307.01282/fig_2_2.txt +64 -0
  24. clustering_mi-0.1.0/examples/data/2307.01282/fig_3.txt +27 -0
  25. clustering_mi-0.1.0/examples/data/2405.05393/fig_4_1.txt +9 -0
  26. clustering_mi-0.1.0/examples/data/2405.05393/fig_4_100.txt +900 -0
  27. clustering_mi-0.1.0/examples/data/2405.05393/fig_4_3.txt +27 -0
  28. clustering_mi-0.1.0/examples/data/2405.05393/fig_6_1.txt +19 -0
  29. clustering_mi-0.1.0/examples/data/2405.05393/fig_6_2.txt +19 -0
  30. clustering_mi-0.1.0/examples/data/example.txt +8 -0
  31. clustering_mi-0.1.0/examples/data/wines.txt +178 -0
  32. clustering_mi-0.1.0/examples/example.py +75 -0
  33. clustering_mi-0.1.0/examples/figures.py +71 -0
  34. clustering_mi-0.1.0/noxfile.py +109 -0
  35. clustering_mi-0.1.0/pyproject.toml +157 -0
  36. clustering_mi-0.1.0/src/clustering_mi/__init__.py +23 -0
  37. clustering_mi-0.1.0/src/clustering_mi/_input_output.py +109 -0
  38. clustering_mi-0.1.0/src/clustering_mi/_util.py +151 -0
  39. clustering_mi-0.1.0/src/clustering_mi/_version.py +21 -0
  40. clustering_mi-0.1.0/src/clustering_mi/_version.pyi +4 -0
  41. clustering_mi-0.1.0/src/clustering_mi/mutual_information.py +426 -0
  42. clustering_mi-0.1.0/src/clustering_mi/py.typed +0 -0
  43. clustering_mi-0.1.0/tests/Tests.nb +3679 -0
  44. clustering_mi-0.1.0/tests/data/example.txt +8 -0
  45. clustering_mi-0.1.0/tests/data/example_commas.txt +8 -0
  46. clustering_mi-0.1.0/tests/data/example_missing_values.txt +8 -0
  47. clustering_mi-0.1.0/tests/data/example_tabs.txt +8 -0
  48. clustering_mi-0.1.0/tests/test__input_output.py +48 -0
  49. clustering_mi-0.1.0/tests/test__util.py +48 -0
  50. clustering_mi-0.1.0/tests/test_mutual_information.py +178 -0
  51. clustering_mi-0.1.0/tests/test_package.py +9 -0
@@ -0,0 +1,13 @@
1
+ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
+ _commit: 2025.05.02-22-g4f8141f
3
+ _src_path: gh:scientific-python/cookie
4
+ backend: hatch
5
+ email: mjerdee@umich.edu
6
+ full_name: Max Jerdee
7
+ license: MIT
8
+ org: maxjerdee
9
+ project_name: clustering-mi
10
+ project_short_description: Compute the mutual information between two clusterings
11
+ of the same objects
12
+ url: https://github.com/maxjerdee/clustering-mi
13
+ vcs: true
@@ -0,0 +1,3 @@
1
+ node: $Format:%H$
2
+ node-date: $Format:%cI$
3
+ describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
@@ -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, which will help you by checking that commits pass
39
+ 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=clustering-mi
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,11 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ groups:
9
+ actions:
10
+ patterns:
11
+ - "*"
@@ -0,0 +1,5 @@
1
+ changelog:
2
+ exclude:
3
+ authors:
4
+ - dependabot
5
+ - pre-commit-ci
@@ -0,0 +1,60 @@
1
+ name: CD
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - main
9
+ release:
10
+ types:
11
+ - published
12
+
13
+ concurrency:
14
+ group: ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ env:
18
+ # Many color libraries just need this to be set to any value, but at least
19
+ # one distinguishes color depth, where "3" -> "256-bit color".
20
+ FORCE_COLOR: 3
21
+
22
+ jobs:
23
+ dist:
24
+ name: Distribution build
25
+ runs-on: ubuntu-latest
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ with:
30
+ fetch-depth: 0
31
+
32
+ - uses: hynek/build-and-inspect-python-package@v2
33
+
34
+ publish:
35
+ needs: [dist]
36
+ name: Publish to PyPI
37
+ environment: pypi
38
+ permissions:
39
+ id-token: write
40
+ attestations: write
41
+ contents: read
42
+ runs-on: ubuntu-latest
43
+ if: github.event_name == 'release' && github.event.action == 'published'
44
+
45
+ steps:
46
+ - uses: actions/download-artifact@v4
47
+ with:
48
+ name: Packages
49
+ path: dist
50
+
51
+ - name: Generate artifact attestation for sdist and wheel
52
+ uses: actions/attest-build-provenance@v2
53
+ with:
54
+ subject-path: "dist/*"
55
+
56
+ - uses: pypa/gh-action-pypi-publish@release/v1
57
+ with:
58
+ # Remember to tell (test-)pypi about this repo before publishing
59
+ # Remove this line to publish to PyPI
60
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,77 @@
1
+ name: CI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - main
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ env:
15
+ # Many color libraries just need this variable to be set to any value.
16
+ # Set it to 3 to support 8-bit color graphics (256 colors per channel)
17
+ # for libraries that care about the value set.
18
+ FORCE_COLOR: 3
19
+
20
+ jobs:
21
+ pre-commit:
22
+ name: Format
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ with:
27
+ fetch-depth: 0
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.x"
31
+
32
+ - uses: astral-sh/setup-uv@v6
33
+
34
+ - uses: pre-commit/action@v3.0.1
35
+ with:
36
+ extra_args: --hook-stage manual --all-files
37
+ - name: Run Pylint
38
+ run: uvx nox -s pylint -- --output-format=github
39
+
40
+ checks:
41
+ name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
42
+ runs-on: ${{ matrix.runs-on }}
43
+ needs: [pre-commit]
44
+ strategy:
45
+ fail-fast: false
46
+ matrix:
47
+ python-version: ["3.9", "3.13"]
48
+ runs-on: [ubuntu-latest, windows-latest, macos-14]
49
+
50
+ include:
51
+ - python-version: "pypy-3.10"
52
+ runs-on: ubuntu-latest
53
+
54
+ steps:
55
+ - uses: actions/checkout@v4
56
+ with:
57
+ fetch-depth: 0
58
+
59
+ - uses: actions/setup-python@v5
60
+ with:
61
+ python-version: ${{ matrix.python-version }}
62
+ allow-prereleases: true
63
+
64
+ - uses: astral-sh/setup-uv@v6
65
+
66
+ - name: Install package
67
+ run: uv sync
68
+
69
+ - name: Test package
70
+ run: >-
71
+ uv run pytest -ra --cov --cov-report=xml --cov-report=term
72
+ --durations=20
73
+
74
+ - name: Upload coverage report
75
+ uses: codecov/codecov-action@v5
76
+ with:
77
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,158 @@
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
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+
116
+ # Spyder project settings
117
+ .spyderproject
118
+ .spyproject
119
+
120
+ # Rope project settings
121
+ .ropeproject
122
+
123
+ # mkdocs documentation
124
+ /site
125
+
126
+ # mypy
127
+ .mypy_cache/
128
+ .dmypy.json
129
+ dmypy.json
130
+
131
+ # Pyre type checker
132
+ .pyre/
133
+
134
+ # pytype static type analyzer
135
+ .pytype/
136
+
137
+ # Cython debug symbols
138
+ cython_debug/
139
+
140
+ # setuptools_scm
141
+ src/*/_version.py
142
+
143
+
144
+ # ruff
145
+ .ruff_cache/
146
+
147
+ # OS specific stuff
148
+ .DS_Store
149
+ .DS_Store?
150
+ ._*
151
+ .Spotlight-V100
152
+ .Trashes
153
+ ehthumbs.db
154
+ Thumbs.db
155
+
156
+ # Common editor files
157
+ *~
158
+ *.swp
@@ -0,0 +1,96 @@
1
+ ci:
2
+ autoupdate_commit_msg: "chore: update pre-commit hooks"
3
+ autofix_commit_msg: "style: pre-commit fixes"
4
+
5
+ exclude: ^.cruft.json|.copier-answers.yml$
6
+
7
+ files: ^src/
8
+
9
+ repos:
10
+ - repo: https://github.com/adamchainz/blacken-docs
11
+ rev: "1.19.1"
12
+ hooks:
13
+ - id: blacken-docs
14
+ additional_dependencies: [black==24.*]
15
+
16
+ - repo: https://github.com/pre-commit/pre-commit-hooks
17
+ rev: "v5.0.0"
18
+ hooks:
19
+ - id: check-added-large-files
20
+ - id: check-case-conflict
21
+ - id: check-merge-conflict
22
+ - id: check-symlinks
23
+ - id: check-yaml
24
+ - id: debug-statements
25
+ - id: end-of-file-fixer
26
+ - id: mixed-line-ending
27
+ - id: name-tests-test
28
+ args: ["--pytest-test-first"]
29
+ - id: requirements-txt-fixer
30
+ - id: trailing-whitespace
31
+
32
+ - repo: https://github.com/pre-commit/pygrep-hooks
33
+ rev: "v1.10.0"
34
+ hooks:
35
+ - id: rst-backticks
36
+ - id: rst-directive-colons
37
+ - id: rst-inline-touching-normal
38
+
39
+ - repo: https://github.com/rbubley/mirrors-prettier
40
+ rev: "v3.6.2"
41
+ hooks:
42
+ - id: prettier
43
+ types_or: [yaml, markdown, html, css, scss, javascript, json]
44
+ args: [--prose-wrap=always]
45
+ language_version: system # tells to use the system's Node.js, WSL can make trouble
46
+
47
+ - repo: https://github.com/astral-sh/ruff-pre-commit
48
+ rev: "v0.12.3"
49
+ hooks:
50
+ - id: ruff-check
51
+ args: ["--fix", "--show-fixes", "--ignore=EM101,EM102"]
52
+ - id: ruff-format
53
+
54
+ - repo: https://github.com/pre-commit/mirrors-mypy
55
+ rev: "v1.16.1"
56
+ hooks:
57
+ - id: mypy
58
+ files: src|tests
59
+ args: []
60
+ additional_dependencies:
61
+ - pytest
62
+ - numpy
63
+ - types-tqdm
64
+
65
+ - repo: https://github.com/codespell-project/codespell
66
+ rev: "v2.4.1"
67
+ hooks:
68
+ - id: codespell
69
+ additional_dependencies:
70
+ - tomli; python_version<'3.11'
71
+
72
+ - repo: https://github.com/shellcheck-py/shellcheck-py
73
+ rev: "v0.10.0.1"
74
+ hooks:
75
+ - id: shellcheck
76
+
77
+ - repo: local
78
+ hooks:
79
+ - id: disallow-caps
80
+ name: Disallow improper capitalization
81
+ language: pygrep
82
+ entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
83
+ exclude: .pre-commit-config.yaml
84
+
85
+ - repo: https://github.com/abravalheri/validate-pyproject
86
+ rev: "v0.24.1"
87
+ hooks:
88
+ - id: validate-pyproject
89
+ additional_dependencies: ["validate-pyproject-schema-store[all]"]
90
+
91
+ - repo: https://github.com/python-jsonschema/check-jsonschema
92
+ rev: "0.33.2"
93
+ hooks:
94
+ - id: check-dependabot
95
+ - id: check-github-workflows
96
+ - id: check-readthedocs