exactcis 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.
- exactcis-0.1.0/.github/workflows/ci.yml +78 -0
- exactcis-0.1.0/.gitignore +121 -0
- exactcis-0.1.0/.pre-commit-config.yaml +33 -0
- exactcis-0.1.0/CHANGELOG.md +51 -0
- exactcis-0.1.0/CITATION.txt +23 -0
- exactcis-0.1.0/CONTRIBUTING.md +196 -0
- exactcis-0.1.0/LICENSE +21 -0
- exactcis-0.1.0/Makefile +91 -0
- exactcis-0.1.0/PKG-INFO +228 -0
- exactcis-0.1.0/PR_REVIEW_README.md +55 -0
- exactcis-0.1.0/add_pr_review.sh +40 -0
- exactcis-0.1.0/cognitive_load_audit_report.md +356 -0
- exactcis-0.1.0/docs/Makefile +20 -0
- exactcis-0.1.0/docs/README.md +70 -0
- exactcis-0.1.0/docs/api/api_reference.md +405 -0
- exactcis-0.1.0/docs/development/Literature.md +23 -0
- exactcis-0.1.0/docs/development/architecture.md +143 -0
- exactcis-0.1.0/docs/development/blaker_correction_guide.md +146 -0
- exactcis-0.1.0/docs/development/comparison_analysis_summary.md +105 -0
- exactcis-0.1.0/docs/development/development_guide.md +126 -0
- exactcis-0.1.0/docs/development/implementation_comparison.md +371 -0
- exactcis-0.1.0/docs/development/method_comparison.md +195 -0
- exactcis-0.1.0/docs/development/method_comparison_analysis.md +73 -0
- exactcis-0.1.0/docs/development/methodology.md +134 -0
- exactcis-0.1.0/docs/development/performance_optimization.md +332 -0
- exactcis-0.1.0/docs/development/test_monitoring.md +159 -0
- exactcis-0.1.0/docs/development/validation_summary.md +96 -0
- exactcis-0.1.0/docs/img/ci_calculation.md +50 -0
- exactcis-0.1.0/docs/img/data_flow.md +21 -0
- exactcis-0.1.0/docs/img/method_comparison.md +204 -0
- exactcis-0.1.0/docs/img/method_comparison_diagram.md +49 -0
- exactcis-0.1.0/docs/img/method_selection.md +28 -0
- exactcis-0.1.0/docs/img/package_structure.md +24 -0
- exactcis-0.1.0/docs/img/performance_benchmarks.md +58 -0
- exactcis-0.1.0/docs/index.md +85 -0
- exactcis-0.1.0/docs/performance.md +129 -0
- exactcis-0.1.0/docs/project_description.md +143 -0
- exactcis-0.1.0/docs/references.md +138 -0
- exactcis-0.1.0/docs/source/_markdown/analysis/comparison_tables.md +10 -0
- exactcis-0.1.0/docs/source/_markdown/analysis/logical_comparison_report.md +51 -0
- exactcis-0.1.0/docs/source/_markdown/development/architecture.md +143 -0
- exactcis-0.1.0/docs/source/_markdown/development/test_monitoring.md +159 -0
- exactcis-0.1.0/docs/source/_markdown/literature/Literature.md +23 -0
- exactcis-0.1.0/docs/source/_markdown/literature/blaker_correction_guide.md +146 -0
- exactcis-0.1.0/docs/source/_markdown/literature/comparison_analysis_summary.md +105 -0
- exactcis-0.1.0/docs/source/_markdown/literature/implementation_comparison.md +371 -0
- exactcis-0.1.0/docs/source/_markdown/literature/method_comparison.md +195 -0
- exactcis-0.1.0/docs/source/_markdown/literature/method_comparison_analysis.md +73 -0
- exactcis-0.1.0/docs/source/_markdown/literature/methodology.md +134 -0
- exactcis-0.1.0/docs/source/_markdown/literature/validation_summary.md +96 -0
- exactcis-0.1.0/docs/source/api-reference.rst +91 -0
- exactcis-0.1.0/docs/source/changelog.rst +68 -0
- exactcis-0.1.0/docs/source/conf.py +56 -0
- exactcis-0.1.0/docs/source/contributing.rst +221 -0
- exactcis-0.1.0/docs/source/development/analysis/comparison_analysis_summary.rst +6 -0
- exactcis-0.1.0/docs/source/development/analysis/comparison_tables.rst +6 -0
- exactcis-0.1.0/docs/source/development/analysis/index.rst +12 -0
- exactcis-0.1.0/docs/source/development/analysis/logical_comparison_report.rst +6 -0
- exactcis-0.1.0/docs/source/development/architecture.rst +6 -0
- exactcis-0.1.0/docs/source/development/blaker_correction_guide.rst +6 -0
- exactcis-0.1.0/docs/source/development/implementation_comparison.rst +6 -0
- exactcis-0.1.0/docs/source/development/index.rst +24 -0
- exactcis-0.1.0/docs/source/development/literature/index.rst +11 -0
- exactcis-0.1.0/docs/source/development/literature/literature.rst +6 -0
- exactcis-0.1.0/docs/source/development/literature/method_comparison_analysis.rst +6 -0
- exactcis-0.1.0/docs/source/development/method_comparison.rst +6 -0
- exactcis-0.1.0/docs/source/development/methodology.rst +6 -0
- exactcis-0.1.0/docs/source/development/performance_optimization.rst +398 -0
- exactcis-0.1.0/docs/source/development/test_monitoring.rst +6 -0
- exactcis-0.1.0/docs/source/development/validation_summary.rst +6 -0
- exactcis-0.1.0/docs/source/index.rst +50 -0
- exactcis-0.1.0/docs/source/installation.rst +51 -0
- exactcis-0.1.0/docs/source/usage-guide.rst +142 -0
- exactcis-0.1.0/docs/source/user_guide/examples/basic_usage.rst +276 -0
- exactcis-0.1.0/docs/source/user_guide/examples/method_selection.rst +344 -0
- exactcis-0.1.0/docs/source/user_guide/examples/rare_events.rst +264 -0
- exactcis-0.1.0/docs/source/user_guide/index.rst +14 -0
- exactcis-0.1.0/docs/source/user_guide/quick_reference.rst +210 -0
- exactcis-0.1.0/docs/source/user_guide/troubleshooting.rst +168 -0
- exactcis-0.1.0/docs/user_guide/examples/basic_usage.md +225 -0
- exactcis-0.1.0/docs/user_guide/examples/method_selection.md +316 -0
- exactcis-0.1.0/docs/user_guide/examples/rare_events.md +213 -0
- exactcis-0.1.0/docs/user_guide/quick_reference.md +234 -0
- exactcis-0.1.0/docs/user_guide/troubleshooting.md +140 -0
- exactcis-0.1.0/docs/user_guide/user_guide.md +364 -0
- exactcis-0.1.0/examples/edge_cases.ipynb +397 -0
- exactcis-0.1.0/examples/method_comparison.ipynb +523 -0
- exactcis-0.1.0/examples/quick_start.ipynb +444 -0
- exactcis-0.1.0/examples/timeout_example.ipynb +477 -0
- exactcis-0.1.0/pr_review_feedback.md +314 -0
- exactcis-0.1.0/publication_status_report.md +114 -0
- exactcis-0.1.0/pyproject.toml +142 -0
- exactcis-0.1.0/readme.md +177 -0
- exactcis-0.1.0/scripts/README.md +79 -0
- exactcis-0.1.0/scripts/analyze_comparisons.py +486 -0
- exactcis-0.1.0/scripts/build_package.sh +35 -0
- exactcis-0.1.0/scripts/compare_methods.py +296 -0
- exactcis-0.1.0/scripts/run_tests_unified.py +362 -0
- exactcis-0.1.0/scripts/setup_dev_env.sh +27 -0
- exactcis-0.1.0/scripts/test_profiler.py +134 -0
- exactcis-0.1.0/src/exactcis/__init__.py +64 -0
- exactcis-0.1.0/src/exactcis/_version.py +3 -0
- exactcis-0.1.0/src/exactcis/cli.py +463 -0
- exactcis-0.1.0/src/exactcis/core.py +1109 -0
- exactcis-0.1.0/src/exactcis/methods/__init__.py +21 -0
- exactcis-0.1.0/src/exactcis/methods/blaker.py +301 -0
- exactcis-0.1.0/src/exactcis/methods/conditional.py +607 -0
- exactcis-0.1.0/src/exactcis/methods/midp.py +300 -0
- exactcis-0.1.0/src/exactcis/methods/unconditional.py +599 -0
- exactcis-0.1.0/src/exactcis/methods/wald.py +44 -0
- exactcis-0.1.0/src/exactcis/utils/__init__.py +7 -0
- exactcis-0.1.0/src/exactcis/utils/calculators.py +287 -0
- exactcis-0.1.0/src/exactcis/utils/data_models.py +125 -0
- exactcis-0.1.0/src/exactcis/utils/optimization.py +488 -0
- exactcis-0.1.0/src/exactcis/utils/parallel.py +289 -0
- exactcis-0.1.0/src/exactcis/utils/pmf_functions.py +290 -0
- exactcis-0.1.0/src/exactcis/utils/root_finding.py +453 -0
- exactcis-0.1.0/src/exactcis/utils/stats.py +111 -0
- exactcis-0.1.0/src/exactcis/utils/transformers.py +160 -0
- exactcis-0.1.0/src/exactcis/utils/validators.py +103 -0
- exactcis-0.1.0/tests/conftest.py +98 -0
- exactcis-0.1.0/tests/test_batch_methods.py +392 -0
- exactcis-0.1.0/tests/test_cli.py +376 -0
- exactcis-0.1.0/tests/test_core.py +409 -0
- exactcis-0.1.0/tests/test_exactcis.py +85 -0
- exactcis-0.1.0/tests/test_integration.py +467 -0
- exactcis-0.1.0/tests/test_methods/test_blaker.py +69 -0
- exactcis-0.1.0/tests/test_methods/test_conditional.py +210 -0
- exactcis-0.1.0/tests/test_methods/test_haldane_and_decimal.py +183 -0
- exactcis-0.1.0/tests/test_methods/test_midp.py +110 -0
- exactcis-0.1.0/tests/test_methods/test_timeout.py +131 -0
- exactcis-0.1.0/tests/test_methods/test_unconditional.py +358 -0
- exactcis-0.1.0/tests/test_methods/test_wald.py +72 -0
- exactcis-0.1.0/tests/test_odds_ratio_utils.py +65 -0
- exactcis-0.1.0/tests/test_r_comparison.py +292 -0
- exactcis-0.1.0/tests/test_utils/test_optimization.py +570 -0
- exactcis-0.1.0/tests/test_utils/test_parallel.py +643 -0
- exactcis-0.1.0/tests/test_utils/test_stats.py +80 -0
- exactcis-0.1.0/uv.lock +2028 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: ExactCIs CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
workflow_dispatch: # Allow manual triggering
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ['3.8', '3.9', '3.10', '3.11']
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v3
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v4
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v4
|
|
28
|
+
with:
|
|
29
|
+
version: "latest"
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: |
|
|
33
|
+
uv pip install -e ".[dev]"
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: |
|
|
37
|
+
pytest --cov=src/exactcis --cov-report=xml
|
|
38
|
+
|
|
39
|
+
- name: Upload coverage to Codecov
|
|
40
|
+
uses: codecov/codecov-action@v3
|
|
41
|
+
with:
|
|
42
|
+
file: ./coverage.xml
|
|
43
|
+
fail_ci_if_error: false
|
|
44
|
+
|
|
45
|
+
build:
|
|
46
|
+
needs: test
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v3
|
|
51
|
+
|
|
52
|
+
- name: Set up Python
|
|
53
|
+
uses: actions/setup-python@v4
|
|
54
|
+
with:
|
|
55
|
+
python-version: '3.10'
|
|
56
|
+
|
|
57
|
+
- name: Install uv
|
|
58
|
+
uses: astral-sh/setup-uv@v4
|
|
59
|
+
with:
|
|
60
|
+
version: "latest"
|
|
61
|
+
|
|
62
|
+
- name: Install dependencies
|
|
63
|
+
run: |
|
|
64
|
+
uv pip install build twine
|
|
65
|
+
|
|
66
|
+
- name: Build package
|
|
67
|
+
run: |
|
|
68
|
+
python -m build
|
|
69
|
+
|
|
70
|
+
- name: Check distribution
|
|
71
|
+
run: |
|
|
72
|
+
twine check dist/*
|
|
73
|
+
|
|
74
|
+
- name: Store build artifacts
|
|
75
|
+
uses: actions/upload-artifact@v3
|
|
76
|
+
with:
|
|
77
|
+
name: dist
|
|
78
|
+
path: dist/
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
.Python
|
|
8
|
+
build/
|
|
9
|
+
develop-eggs/
|
|
10
|
+
dist/
|
|
11
|
+
downloads/
|
|
12
|
+
eggs/
|
|
13
|
+
.eggs/
|
|
14
|
+
lib/
|
|
15
|
+
lib64/
|
|
16
|
+
parts/
|
|
17
|
+
sdist/
|
|
18
|
+
var/
|
|
19
|
+
wheels/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
.installed.cfg
|
|
22
|
+
*.egg
|
|
23
|
+
MANIFEST
|
|
24
|
+
|
|
25
|
+
# Testing and coverage
|
|
26
|
+
.pytest_cache/
|
|
27
|
+
.coverage*
|
|
28
|
+
htmlcov/
|
|
29
|
+
.tox/
|
|
30
|
+
coverage.xml
|
|
31
|
+
*.cover
|
|
32
|
+
|
|
33
|
+
# Profiling and analysis outputs
|
|
34
|
+
analysis/profiling_results/
|
|
35
|
+
optimization_results/
|
|
36
|
+
profile_results.txt
|
|
37
|
+
*.prof
|
|
38
|
+
|
|
39
|
+
# Virtual environments
|
|
40
|
+
.env
|
|
41
|
+
.venv
|
|
42
|
+
env/
|
|
43
|
+
venv/
|
|
44
|
+
ENV/
|
|
45
|
+
|
|
46
|
+
# IDEs
|
|
47
|
+
.vscode/
|
|
48
|
+
.idea/
|
|
49
|
+
*.swp
|
|
50
|
+
*.swo
|
|
51
|
+
|
|
52
|
+
# OS generated
|
|
53
|
+
.DS_Store
|
|
54
|
+
Thumbs.db
|
|
55
|
+
|
|
56
|
+
# Documentation builds
|
|
57
|
+
docs/build/
|
|
58
|
+
docs/_build/
|
|
59
|
+
|
|
60
|
+
# Temporary files
|
|
61
|
+
temp_*.py
|
|
62
|
+
|
|
63
|
+
# Jupyter Notebook
|
|
64
|
+
.ipynb_checkpoints
|
|
65
|
+
*.ipynb_checkpoints/
|
|
66
|
+
|
|
67
|
+
# Data files
|
|
68
|
+
*.csv
|
|
69
|
+
*.json
|
|
70
|
+
*.pkl
|
|
71
|
+
*.npy
|
|
72
|
+
*.npz
|
|
73
|
+
*.png # Plot files
|
|
74
|
+
_temporary/research/analysis_scripts/**/results/
|
|
75
|
+
_temporary/research/r_comparisons/results/
|
|
76
|
+
benchmarks/**/*.csv
|
|
77
|
+
benchmarks/**/*.json
|
|
78
|
+
|
|
79
|
+
# Analysis outputs
|
|
80
|
+
analysis/plots/**/*.png
|
|
81
|
+
analysis/**/*.json
|
|
82
|
+
|
|
83
|
+
# R files
|
|
84
|
+
.Rhistory
|
|
85
|
+
.RData
|
|
86
|
+
*.Rout
|
|
87
|
+
*.Rproj.user/
|
|
88
|
+
*.Rproj
|
|
89
|
+
|
|
90
|
+
# Specific project directories
|
|
91
|
+
archive/legacy_config/
|
|
92
|
+
.cadence/
|
|
93
|
+
.junie/
|
|
94
|
+
.qodo/
|
|
95
|
+
.windsurf/
|
|
96
|
+
.gemini/
|
|
97
|
+
.agent_guidelines/
|
|
98
|
+
.claude/
|
|
99
|
+
|
|
100
|
+
# Additional cache directories
|
|
101
|
+
.mypy_cache/
|
|
102
|
+
.ruff_cache/
|
|
103
|
+
.hypothesis/
|
|
104
|
+
|
|
105
|
+
# Windsurf-specific files
|
|
106
|
+
.windsurfrules
|
|
107
|
+
|
|
108
|
+
# Jupyter notebooks (except example notebooks)
|
|
109
|
+
**/*.ipynb
|
|
110
|
+
!examples/**/*.ipynb
|
|
111
|
+
!docs/user_guide/examples/**/*.ipynb
|
|
112
|
+
|
|
113
|
+
# Log files
|
|
114
|
+
*.log
|
|
115
|
+
*.out
|
|
116
|
+
results_*.txt
|
|
117
|
+
|
|
118
|
+
# Compiled extensions
|
|
119
|
+
*.so
|
|
120
|
+
*.pyd
|
|
121
|
+
*.dll
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.5.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
|
|
10
|
+
- repo: https://github.com/pycqa/isort
|
|
11
|
+
rev: 5.13.2
|
|
12
|
+
hooks:
|
|
13
|
+
- id: isort
|
|
14
|
+
name: isort (python)
|
|
15
|
+
args: ["--profile", "black"]
|
|
16
|
+
|
|
17
|
+
- repo: https://github.com/psf/black
|
|
18
|
+
rev: 24.1.1
|
|
19
|
+
hooks:
|
|
20
|
+
- id: black
|
|
21
|
+
language_version: python3
|
|
22
|
+
|
|
23
|
+
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
24
|
+
rev: 'v0.1.15'
|
|
25
|
+
hooks:
|
|
26
|
+
- id: ruff
|
|
27
|
+
args: ["--fix"]
|
|
28
|
+
|
|
29
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
30
|
+
rev: v1.8.0
|
|
31
|
+
hooks:
|
|
32
|
+
- id: mypy
|
|
33
|
+
additional_dependencies: [types-requests]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the ExactCIs project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2023-12-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of ExactCIs
|
|
12
|
+
- Five confidence interval methods for 2×2 contingency tables:
|
|
13
|
+
- Conditional (Fisher's exact)
|
|
14
|
+
- Mid-P adjusted
|
|
15
|
+
- Blaker's exact
|
|
16
|
+
- Barnard's unconditional exact
|
|
17
|
+
- Haldane-Anscombe Wald
|
|
18
|
+
- Comprehensive documentation including:
|
|
19
|
+
- User guide
|
|
20
|
+
- API reference
|
|
21
|
+
- Method comparison guide
|
|
22
|
+
- Performance documentation
|
|
23
|
+
- Validation summary
|
|
24
|
+
- Extensive test suite with unit tests, edge case tests, and performance tests
|
|
25
|
+
- Performance optimization features:
|
|
26
|
+
- Optional NumPy acceleration
|
|
27
|
+
- Timeout protection for long-running calculations
|
|
28
|
+
- Caching for repeated calculations
|
|
29
|
+
- R comparison tools for validation against established implementations
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
- Numerical stability issues in unconditional method for extreme tables
|
|
33
|
+
- Edge case handling for tables with zero cells
|
|
34
|
+
- Timeout handling in long-running calculations
|
|
35
|
+
|
|
36
|
+
## [Unreleased]
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- Validation summary document
|
|
40
|
+
- CHANGELOG.md for tracking version changes
|
|
41
|
+
- LICENSE file with MIT License
|
|
42
|
+
- CONTRIBUTING.md with guidelines for contributors
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Improved documentation for method selection
|
|
46
|
+
- Enhanced performance documentation with optimization guidance
|
|
47
|
+
- Updated package metadata for publication readiness
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
- Minor documentation inconsistencies
|
|
51
|
+
- Edge case handling improvements
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
To cite ExactCIs in publications, please use:
|
|
2
|
+
|
|
3
|
+
ExactCIs Contributors (2023). ExactCIs: A Python package for exact confidence intervals for odds ratios. https://github.com/yourusername/exactcis
|
|
4
|
+
|
|
5
|
+
BibTeX entry:
|
|
6
|
+
|
|
7
|
+
@software{exactcis2023,
|
|
8
|
+
author = {ExactCIs Contributors},
|
|
9
|
+
title = {ExactCIs: A Python package for exact confidence intervals for odds ratios},
|
|
10
|
+
year = {2023},
|
|
11
|
+
url = {https://github.com/yourusername/exactcis},
|
|
12
|
+
version = {0.1.0}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
This package implements methods described in the following publications:
|
|
16
|
+
|
|
17
|
+
Barnard, G. A. (1945). A new test for 2×2 tables. Nature, 156(3954), 177-177.
|
|
18
|
+
|
|
19
|
+
Blaker, H. (2000). Confidence curves and improved exact confidence intervals for discrete distributions. Canadian Journal of Statistics, 28(4), 783-798.
|
|
20
|
+
|
|
21
|
+
Fagerland, M. W., Lydersen, S., & Laake, P. (2015). Recommended confidence intervals for two independent binomial proportions. Statistical methods in medical research, 24(2), 224-254.
|
|
22
|
+
|
|
23
|
+
Agresti, A., & Coull, B. A. (1998). Approximate is better than "exact" for interval estimation of binomial proportions. The American Statistician, 52(2), 119-126.
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Contributing to ExactCIs
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to ExactCIs! This document provides guidelines and instructions for contributing to the project.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Code of Conduct](#code-of-conduct)
|
|
8
|
+
2. [Getting Started](#getting-started)
|
|
9
|
+
3. [Development Environment](#development-environment)
|
|
10
|
+
4. [Making Changes](#making-changes)
|
|
11
|
+
5. [Testing](#testing)
|
|
12
|
+
6. [Documentation](#documentation)
|
|
13
|
+
7. [Submitting Changes](#submitting-changes)
|
|
14
|
+
8. [Review Process](#review-process)
|
|
15
|
+
|
|
16
|
+
## Code of Conduct
|
|
17
|
+
|
|
18
|
+
By participating in this project, you agree to abide by our Code of Conduct. Please be respectful and considerate of others when contributing to the project.
|
|
19
|
+
|
|
20
|
+
## Getting Started
|
|
21
|
+
|
|
22
|
+
1. **Fork the repository** on GitHub
|
|
23
|
+
2. **Clone your fork** to your local machine
|
|
24
|
+
3. **Set up the development environment** as described below
|
|
25
|
+
|
|
26
|
+
## Development Environment
|
|
27
|
+
|
|
28
|
+
ExactCIs uses `uv` for dependency management. To set up your development environment:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Clone the repository
|
|
32
|
+
git clone https://github.com/yourusername/exactcis.git
|
|
33
|
+
cd exactcis
|
|
34
|
+
|
|
35
|
+
# Create and activate a virtual environment
|
|
36
|
+
uv venv
|
|
37
|
+
|
|
38
|
+
# Activate the environment
|
|
39
|
+
source .venv/bin/activate # Unix/macOS
|
|
40
|
+
# or
|
|
41
|
+
.venv\Scripts\activate # Windows
|
|
42
|
+
|
|
43
|
+
# Install development dependencies
|
|
44
|
+
uv pip install -e ".[dev]"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Making Changes
|
|
48
|
+
|
|
49
|
+
1. **Create a new branch** for your changes:
|
|
50
|
+
```bash
|
|
51
|
+
git checkout -b feature/your-feature-name
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
2. **Follow the coding style**:
|
|
55
|
+
- Use [Black](https://black.readthedocs.io/) for code formatting
|
|
56
|
+
- Follow [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guidelines
|
|
57
|
+
- Use type hints consistently
|
|
58
|
+
- Write docstrings for all functions, classes, and modules
|
|
59
|
+
|
|
60
|
+
3. **Keep changes focused**:
|
|
61
|
+
- Each pull request should address a single concern
|
|
62
|
+
- Break large changes into smaller, logical commits
|
|
63
|
+
|
|
64
|
+
## Testing
|
|
65
|
+
|
|
66
|
+
ExactCIs uses a unified testing strategy with a single, feature-rich test runner. All changes must include appropriate tests:
|
|
67
|
+
|
|
68
|
+
### Running Tests Locally
|
|
69
|
+
|
|
70
|
+
**Use the unified test runner** for all local test execution:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Run fast tests only (default, recommended for development)
|
|
74
|
+
python scripts/run_tests_unified.py
|
|
75
|
+
|
|
76
|
+
# Run all tests including slow tests (for comprehensive validation)
|
|
77
|
+
python scripts/run_tests_unified.py --all
|
|
78
|
+
|
|
79
|
+
# Run tests with coverage reporting
|
|
80
|
+
python scripts/run_tests_unified.py --coverage
|
|
81
|
+
|
|
82
|
+
# Run tests with progress visualization (requires rich/tqdm)
|
|
83
|
+
python scripts/run_tests_unified.py --progress
|
|
84
|
+
|
|
85
|
+
# Run tests in parallel for faster execution
|
|
86
|
+
python scripts/run_tests_unified.py --parallel
|
|
87
|
+
|
|
88
|
+
# Run a specific test module
|
|
89
|
+
python scripts/run_tests_unified.py --module=methods/blaker
|
|
90
|
+
|
|
91
|
+
# Run a specific test function
|
|
92
|
+
python scripts/run_tests_unified.py --test=test_blaker_ci
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Test Categories
|
|
96
|
+
|
|
97
|
+
- **Fast tests** (`@pytest.mark.fast`): Quick unit tests that run in under 1 second
|
|
98
|
+
- **Slow tests** (`@pytest.mark.slow`): Comprehensive tests that may take longer
|
|
99
|
+
- **Integration tests**: Tests that verify interactions between components
|
|
100
|
+
|
|
101
|
+
### Adding New Tests
|
|
102
|
+
|
|
103
|
+
1. **Add new tests** for new functionality:
|
|
104
|
+
- Unit tests for individual functions
|
|
105
|
+
- Integration tests for interactions between components
|
|
106
|
+
- Edge case tests for boundary conditions
|
|
107
|
+
|
|
108
|
+
2. **Mark your tests appropriately**:
|
|
109
|
+
```python
|
|
110
|
+
import pytest
|
|
111
|
+
|
|
112
|
+
@pytest.mark.fast
|
|
113
|
+
def test_quick_function():
|
|
114
|
+
# Fast test that runs quickly
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
@pytest.mark.slow
|
|
118
|
+
def test_comprehensive_analysis():
|
|
119
|
+
# Slower, more comprehensive test
|
|
120
|
+
pass
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Alternative Test Commands
|
|
124
|
+
|
|
125
|
+
You can also run tests directly with pytest if needed:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Basic pytest command (matches CI)
|
|
129
|
+
uv run pytest
|
|
130
|
+
|
|
131
|
+
# Run with coverage (matches CI)
|
|
132
|
+
uv run pytest --cov=src/exactcis --cov-report=xml
|
|
133
|
+
|
|
134
|
+
# Run slow tests
|
|
135
|
+
uv run pytest --run-slow
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Development Utilities
|
|
139
|
+
|
|
140
|
+
The `analysis/analysis_scripts/` directory contains development utilities that are NOT part of the formal test suite:
|
|
141
|
+
|
|
142
|
+
- `blaker_validation.py`: Manual validation tool for the Blaker method implementation
|
|
143
|
+
- Other analysis scripts for debugging and validation
|
|
144
|
+
|
|
145
|
+
These scripts can be run directly for development purposes but are not included in the standard test execution.
|
|
146
|
+
|
|
147
|
+
## Documentation
|
|
148
|
+
|
|
149
|
+
Documentation is a critical part of ExactCIs:
|
|
150
|
+
|
|
151
|
+
1. **Update docstrings** for any modified functions or classes
|
|
152
|
+
2. **Update user documentation** in the `docs/` directory
|
|
153
|
+
3. **Add examples** for new functionality
|
|
154
|
+
4. **Update the API reference** if you've added or changed public interfaces
|
|
155
|
+
|
|
156
|
+
## Submitting Changes
|
|
157
|
+
|
|
158
|
+
1. **Commit your changes** with clear, descriptive commit messages:
|
|
159
|
+
```bash
|
|
160
|
+
git commit -m "Add feature: brief description of what was added"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. **Push your branch** to your fork:
|
|
164
|
+
```bash
|
|
165
|
+
git push origin feature/your-feature-name
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
3. **Create a pull request** from your fork to the main repository
|
|
169
|
+
4. **Fill out the pull request template** with details about your changes
|
|
170
|
+
|
|
171
|
+
## Review Process
|
|
172
|
+
|
|
173
|
+
After submitting a pull request:
|
|
174
|
+
|
|
175
|
+
1. **Automated tests** will run to verify your changes
|
|
176
|
+
2. **Maintainers will review** your code
|
|
177
|
+
3. **Address any feedback** from the review
|
|
178
|
+
4. Once approved, your changes will be merged
|
|
179
|
+
|
|
180
|
+
## Statistical Validation
|
|
181
|
+
|
|
182
|
+
For changes to statistical methods:
|
|
183
|
+
|
|
184
|
+
1. **Validate against established implementations** (R, SciPy, etc.)
|
|
185
|
+
2. **Document any differences** in the validation summary
|
|
186
|
+
3. **Include benchmark results** for performance changes
|
|
187
|
+
|
|
188
|
+
## Performance Considerations
|
|
189
|
+
|
|
190
|
+
When making changes that might affect performance:
|
|
191
|
+
|
|
192
|
+
1. **Profile your changes** using the provided profiling tools
|
|
193
|
+
2. **Document performance characteristics** in the performance documentation
|
|
194
|
+
3. **Consider both speed and memory usage**
|
|
195
|
+
|
|
196
|
+
Thank you for contributing to ExactCIs!
|
exactcis-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 ExactCIs Contributors
|
|
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.
|
exactcis-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.PHONY: clean clean-test clean-pyc clean-build docs help
|
|
2
|
+
.DEFAULT_GOAL := help
|
|
3
|
+
|
|
4
|
+
define BROWSER_PYSCRIPT
|
|
5
|
+
import os, webbrowser, sys
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
from urllib import pathname2url
|
|
9
|
+
except:
|
|
10
|
+
from urllib.request import pathname2url
|
|
11
|
+
|
|
12
|
+
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
|
|
13
|
+
endef
|
|
14
|
+
export BROWSER_PYSCRIPT
|
|
15
|
+
|
|
16
|
+
define PRINT_HELP_PYSCRIPT
|
|
17
|
+
import re, sys
|
|
18
|
+
|
|
19
|
+
for line in sys.stdin:
|
|
20
|
+
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
|
|
21
|
+
if match:
|
|
22
|
+
target, help = match.groups()
|
|
23
|
+
print("%-20s %s" % (target, help))
|
|
24
|
+
endef
|
|
25
|
+
export PRINT_HELP_PYSCRIPT
|
|
26
|
+
|
|
27
|
+
BROWSER := python -c "$$BROWSER_PYSCRIPT"
|
|
28
|
+
|
|
29
|
+
help:
|
|
30
|
+
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|
|
31
|
+
|
|
32
|
+
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
|
|
33
|
+
|
|
34
|
+
clean-build: ## remove build artifacts
|
|
35
|
+
rm -fr build/
|
|
36
|
+
rm -fr dist/
|
|
37
|
+
rm -fr .eggs/
|
|
38
|
+
find . -name '*.egg-info' -exec rm -fr {} +
|
|
39
|
+
find . -name '*.egg' -exec rm -f {} +
|
|
40
|
+
|
|
41
|
+
clean-pyc: ## remove Python file artifacts
|
|
42
|
+
find . -name '*.pyc' -exec rm -f {} +
|
|
43
|
+
find . -name '*.pyo' -exec rm -f {} +
|
|
44
|
+
find . -name '*~' -exec rm -f {} +
|
|
45
|
+
find . -name '__pycache__' -exec rm -fr {} +
|
|
46
|
+
|
|
47
|
+
clean-test: ## remove test and coverage artifacts
|
|
48
|
+
rm -fr .tox/
|
|
49
|
+
rm -fr .coverage
|
|
50
|
+
rm -fr htmlcov/
|
|
51
|
+
rm -fr .pytest_cache
|
|
52
|
+
|
|
53
|
+
lint: ## check style with pre-commit
|
|
54
|
+
pre-commit run --all-files
|
|
55
|
+
|
|
56
|
+
test: ## run tests quickly with the default Python
|
|
57
|
+
pytest
|
|
58
|
+
|
|
59
|
+
test-all: ## run tests on every Python version with tox
|
|
60
|
+
tox
|
|
61
|
+
|
|
62
|
+
coverage: ## check code coverage quickly with the default Python
|
|
63
|
+
pytest --cov=src/exactcis tests/
|
|
64
|
+
coverage report -m
|
|
65
|
+
coverage html
|
|
66
|
+
$(BROWSER) htmlcov/index.html
|
|
67
|
+
|
|
68
|
+
docs: ## generate Sphinx HTML documentation
|
|
69
|
+
rm -f docs/source/exactcis.rst
|
|
70
|
+
rm -f docs/source/modules.rst
|
|
71
|
+
sphinx-apidoc -o docs/source/ src/exactcis
|
|
72
|
+
$(MAKE) -C docs clean
|
|
73
|
+
$(MAKE) -C docs html
|
|
74
|
+
$(BROWSER) docs/build/html/index.html
|
|
75
|
+
|
|
76
|
+
servedocs: docs ## compile the docs watching for changes
|
|
77
|
+
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
|
|
78
|
+
|
|
79
|
+
release: dist ## package and upload a release
|
|
80
|
+
twine check dist/*
|
|
81
|
+
twine upload dist/*
|
|
82
|
+
|
|
83
|
+
dist: clean ## builds source and wheel package
|
|
84
|
+
python -m build
|
|
85
|
+
ls -l dist
|
|
86
|
+
|
|
87
|
+
install: clean ## install the package to the active Python's site-packages
|
|
88
|
+
pip install .
|
|
89
|
+
|
|
90
|
+
dev-install: clean ## install the package in development mode
|
|
91
|
+
pip install -e ".[dev]"
|