odr-bootstrap 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.
- odr_bootstrap-0.1.0/.github/workflows/publish.yml +38 -0
- odr_bootstrap-0.1.0/.github/workflows/tests.yml +48 -0
- odr_bootstrap-0.1.0/.gitignore +140 -0
- odr_bootstrap-0.1.0/.pre-commit-config.yaml +27 -0
- odr_bootstrap-0.1.0/.readthedocs.yml +30 -0
- odr_bootstrap-0.1.0/CHANGELOG.md +64 -0
- odr_bootstrap-0.1.0/CONTRIBUTING.md +237 -0
- odr_bootstrap-0.1.0/LICENSE +21 -0
- odr_bootstrap-0.1.0/Makefile +77 -0
- odr_bootstrap-0.1.0/PKG-INFO +290 -0
- odr_bootstrap-0.1.0/README.md +249 -0
- odr_bootstrap-0.1.0/codecov.yml +15 -0
- odr_bootstrap-0.1.0/docs/Makefile +152 -0
- odr_bootstrap-0.1.0/docs/requirements.txt +3 -0
- odr_bootstrap-0.1.0/docs/source/api.rst +60 -0
- odr_bootstrap-0.1.0/docs/source/changelog.rst +9 -0
- odr_bootstrap-0.1.0/docs/source/conf.py +88 -0
- odr_bootstrap-0.1.0/docs/source/examples.rst +152 -0
- odr_bootstrap-0.1.0/docs/source/index.rst +106 -0
- odr_bootstrap-0.1.0/docs/source/installation.rst +103 -0
- odr_bootstrap-0.1.0/docs/source/tutorial.rst +233 -0
- odr_bootstrap-0.1.0/examples/__init__.py +0 -0
- odr_bootstrap-0.1.0/examples/example.py +155 -0
- odr_bootstrap-0.1.0/odr_bootstrap/__init__.py +36 -0
- odr_bootstrap-0.1.0/odr_bootstrap/core.py +695 -0
- odr_bootstrap-0.1.0/pyproject.toml +119 -0
- odr_bootstrap-0.1.0/scripts/publish.sh +70 -0
- odr_bootstrap-0.1.0/tests/__init__.py +0 -0
- odr_bootstrap-0.1.0/tests/test_odr_bootstrap.py +315 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
# This permission is required for trusted publisher flow
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v2
|
|
20
|
+
with:
|
|
21
|
+
version: "latest"
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
cache: "uv"
|
|
28
|
+
|
|
29
|
+
- name: Sync dependencies
|
|
30
|
+
run: uv sync
|
|
31
|
+
|
|
32
|
+
- name: Build distribution
|
|
33
|
+
run: uv build
|
|
34
|
+
|
|
35
|
+
- name: Publish to PyPI
|
|
36
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
37
|
+
with:
|
|
38
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v2
|
|
21
|
+
with:
|
|
22
|
+
version: "latest"
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
cache: "uv"
|
|
29
|
+
|
|
30
|
+
- name: Sync dependencies
|
|
31
|
+
run: uv sync --all-extras
|
|
32
|
+
|
|
33
|
+
- name: Lint with ruff
|
|
34
|
+
run: uv run ruff check .
|
|
35
|
+
|
|
36
|
+
- name: Type check with mypy
|
|
37
|
+
run: uv run mypy odr_bootstrap
|
|
38
|
+
|
|
39
|
+
- name: Run tests with coverage
|
|
40
|
+
run: uv run pytest --cov=odr_bootstrap --cov-report=xml --cov-report=term-missing
|
|
41
|
+
|
|
42
|
+
- name: Upload coverage to Codecov
|
|
43
|
+
uses: codecov/codecov-action@v3
|
|
44
|
+
with:
|
|
45
|
+
files: ./coverage.xml
|
|
46
|
+
flags: unittests
|
|
47
|
+
name: codecov-umbrella
|
|
48
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
pip-wheel-metadata/
|
|
21
|
+
share/python-wheels/
|
|
22
|
+
*.egg-info/
|
|
23
|
+
.installed.cfg
|
|
24
|
+
*.egg
|
|
25
|
+
MANIFEST
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
db.sqlite3
|
|
57
|
+
db.sqlite3-journal
|
|
58
|
+
|
|
59
|
+
# Flask stuff:
|
|
60
|
+
instance/
|
|
61
|
+
.webassets-cache
|
|
62
|
+
|
|
63
|
+
# Scrapy stuff:
|
|
64
|
+
.scrapy
|
|
65
|
+
|
|
66
|
+
# Sphinx documentation
|
|
67
|
+
docs/_build/
|
|
68
|
+
|
|
69
|
+
# PyBuilder
|
|
70
|
+
target/
|
|
71
|
+
|
|
72
|
+
# Jupyter Notebook
|
|
73
|
+
.ipynb_checkpoints
|
|
74
|
+
|
|
75
|
+
# IPython
|
|
76
|
+
profile_default/
|
|
77
|
+
ipython_config.py
|
|
78
|
+
|
|
79
|
+
# pyenv
|
|
80
|
+
.python-version
|
|
81
|
+
|
|
82
|
+
# pipenv
|
|
83
|
+
Pipfile.lock
|
|
84
|
+
|
|
85
|
+
# PEP 582
|
|
86
|
+
__pypackages__/
|
|
87
|
+
|
|
88
|
+
# Celery stuff
|
|
89
|
+
celerybeat-schedule
|
|
90
|
+
celerybeat.pid
|
|
91
|
+
|
|
92
|
+
# SageMath parsed files
|
|
93
|
+
*.sage.py
|
|
94
|
+
|
|
95
|
+
# Environments
|
|
96
|
+
.env
|
|
97
|
+
.venv
|
|
98
|
+
env/
|
|
99
|
+
venv/
|
|
100
|
+
ENV/
|
|
101
|
+
env.bak/
|
|
102
|
+
venv.bak/
|
|
103
|
+
|
|
104
|
+
# Spyder project settings
|
|
105
|
+
.spyderproject
|
|
106
|
+
.spyproject
|
|
107
|
+
|
|
108
|
+
# Rope project settings
|
|
109
|
+
.ropeproject
|
|
110
|
+
|
|
111
|
+
# mkdocs documentation
|
|
112
|
+
/site
|
|
113
|
+
|
|
114
|
+
# mypy
|
|
115
|
+
.mypy_cache/
|
|
116
|
+
.dmypy.json
|
|
117
|
+
dmypy.json
|
|
118
|
+
|
|
119
|
+
# Pyre type checker
|
|
120
|
+
.pyre/
|
|
121
|
+
|
|
122
|
+
# UV lock file
|
|
123
|
+
uv.lock
|
|
124
|
+
|
|
125
|
+
# IDE
|
|
126
|
+
.vscode/
|
|
127
|
+
.idea/
|
|
128
|
+
*.swp
|
|
129
|
+
*.swo
|
|
130
|
+
*~
|
|
131
|
+
|
|
132
|
+
# OS
|
|
133
|
+
.DS_Store
|
|
134
|
+
Thumbs.db
|
|
135
|
+
|
|
136
|
+
# Project outputs
|
|
137
|
+
*.png
|
|
138
|
+
*.pdf
|
|
139
|
+
calibration_curve.png
|
|
140
|
+
calibration_estimates.png
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.8.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
10
|
+
rev: v4.5.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: trailing-whitespace
|
|
13
|
+
- id: end-of-file-fixer
|
|
14
|
+
- id: check-yaml
|
|
15
|
+
- id: check-added-large-files
|
|
16
|
+
args: ["--maxkb=1000"]
|
|
17
|
+
|
|
18
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
19
|
+
rev: v1.10.0
|
|
20
|
+
hooks:
|
|
21
|
+
- id: mypy
|
|
22
|
+
additional_dependencies:
|
|
23
|
+
- "numpy"
|
|
24
|
+
- "scipy"
|
|
25
|
+
- "matplotlib"
|
|
26
|
+
- "pandas"
|
|
27
|
+
args: [--strict, --ignore-missing-imports]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
build:
|
|
4
|
+
os: ubuntu-22.04
|
|
5
|
+
tools:
|
|
6
|
+
python: "3.12"
|
|
7
|
+
uv: "latest"
|
|
8
|
+
|
|
9
|
+
python:
|
|
10
|
+
version: 3.12
|
|
11
|
+
install:
|
|
12
|
+
- requirements: docs/requirements.txt
|
|
13
|
+
|
|
14
|
+
sphinx:
|
|
15
|
+
configuration: docs/source/conf.py
|
|
16
|
+
fail_on_warning: false
|
|
17
|
+
|
|
18
|
+
formats:
|
|
19
|
+
- pdf
|
|
20
|
+
- epub
|
|
21
|
+
|
|
22
|
+
# Exclude certain files from builds
|
|
23
|
+
exclude_patterns:
|
|
24
|
+
- docs/build
|
|
25
|
+
|
|
26
|
+
# Index page configuration
|
|
27
|
+
redirect_www: false
|
|
28
|
+
|
|
29
|
+
# Versioning
|
|
30
|
+
version: latest
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this 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
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Pre-commit configuration for automated code quality checks
|
|
12
|
+
- GitHub Actions CI/CD workflows for testing and PyPI publishing
|
|
13
|
+
- Comprehensive type hints (PEP 484) for all public functions
|
|
14
|
+
- Coverage reporting with `pytest-cov` (85% threshold)
|
|
15
|
+
- Sphinx documentation setup with Read the Docs integration
|
|
16
|
+
- Makefile for development workflows (test, lint, build, publish)
|
|
17
|
+
- `CONTRIBUTING.md` guidelines for contributors
|
|
18
|
+
- Enhanced README with badges, expanded examples, and API reference
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Updated `pyproject.toml` with enhanced tool configurations (ruff, mypy, coverage)
|
|
22
|
+
- Improved documentation with complete API reference and tutorial
|
|
23
|
+
- Split development dependencies (`dev`, `test`, `docs` groups)
|
|
24
|
+
- Updated documentation URLs to point to Read the Docs
|
|
25
|
+
|
|
26
|
+
## [0.1.0] - 2025-04-21
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- Initial release of `odr-bootstrap` package
|
|
30
|
+
- **Core Functions**:
|
|
31
|
+
- `ODR_Linear()`: Single ODR fit with optional intercept
|
|
32
|
+
- `ODR_Linear_Test()`: ODR fit with full diagnostics output
|
|
33
|
+
- `Bootstrap_fit()`: Bootstrap resampling with ODR refitting
|
|
34
|
+
- `Eval_Conf()`: Confidence interval evaluation from bootstrap samples
|
|
35
|
+
- `ODR_Bootstrap()`: Convenience wrapper combining Bootstrap_fit + Eval_Conf
|
|
36
|
+
|
|
37
|
+
- **Statistics Functions**:
|
|
38
|
+
- `gauss_agv_err()`: Aggregate Gaussian distributions into KDE
|
|
39
|
+
- Helper functions: `yint_func()`, `slope_func()`, `plot_datapoints()`
|
|
40
|
+
|
|
41
|
+
- **Plotting Functions**:
|
|
42
|
+
- `plot_regression()`: Best-fit line with confidence band
|
|
43
|
+
- `plot_Calibration_Estimates()`: Side-by-side slope/intercept distributions
|
|
44
|
+
|
|
45
|
+
- **Testing**: 22 comprehensive unit tests with 100% pass rate
|
|
46
|
+
- **Documentation**: NumPy-style docstrings for all functions
|
|
47
|
+
- **Examples**: Complete workflow example in `examples/example.py`
|
|
48
|
+
- **Packaging**: Proper Python package structure with pyproject.toml (hatchling backend)
|
|
49
|
+
- **License**: MIT License
|
|
50
|
+
|
|
51
|
+
### Technical Details
|
|
52
|
+
- **Python Version**: 3.12+ required
|
|
53
|
+
- **Dependencies**:
|
|
54
|
+
- numpy >= 2.2.4
|
|
55
|
+
- scipy >= 1.15.2 (includes fix for deprecated `scipy.odr`)
|
|
56
|
+
- pandas >= 2.2.3
|
|
57
|
+
- matplotlib >= 3.10.1
|
|
58
|
+
- **Compatibility**: Fixed zero-intercept ODR initialization for scipy.odr
|
|
59
|
+
- **Deprecation Handling**: Updated `np.trapz` → `np.trapezoid` for scipy 1.15+ compatibility
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
[Unreleased]: https://github.com/whtowbin/odr-bootstrap/compare/v0.1.0...HEAD
|
|
64
|
+
[0.1.0]: https://github.com/whtowbin/odr-bootstrap/releases/tag/v0.1.0
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Contributing to ODR Bootstrap
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to `odr-bootstrap`! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### 1. Fork and Clone
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/<your-username>/odr-bootstrap.git
|
|
11
|
+
cd odr-bootstrap
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### 2. Set Up Development Environment
|
|
15
|
+
|
|
16
|
+
We use `uv` for fast, reliable dependency management.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install all dependencies (including dev, test, and docs)
|
|
20
|
+
uv sync --all-extras
|
|
21
|
+
|
|
22
|
+
# Install pre-commit hooks for automatic code quality checks
|
|
23
|
+
uv run pre-commit install
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 3. Run Tests Locally
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Run all tests
|
|
30
|
+
uv run pytest
|
|
31
|
+
|
|
32
|
+
# Run with coverage report
|
|
33
|
+
uv run pytest --cov=odr_bootstrap --cov-report=html
|
|
34
|
+
|
|
35
|
+
# Run specific test file
|
|
36
|
+
uv run pytest tests/test_odr_bootstrap.py -v
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Code Quality Standards
|
|
40
|
+
|
|
41
|
+
All contributions must meet these standards:
|
|
42
|
+
|
|
43
|
+
### Type Hints
|
|
44
|
+
|
|
45
|
+
Every function must have complete type hints:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from typing import Tuple
|
|
49
|
+
import numpy as np
|
|
50
|
+
|
|
51
|
+
def my_function(x: np.ndarray, y: float) -> Tuple[np.ndarray, float]:
|
|
52
|
+
"""Descriptive docstring."""
|
|
53
|
+
pass
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Verification**: `uv run mypy odr_bootstrap` (strict mode enabled)
|
|
57
|
+
|
|
58
|
+
### Formatting and Linting
|
|
59
|
+
|
|
60
|
+
Code is formatted with `ruff`:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv run ruff format . # Format all files
|
|
64
|
+
uv run ruff check . --fix # Auto-fix linting issues
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Docstring Style
|
|
68
|
+
|
|
69
|
+
Use NumPy-style docstrings for all public functions:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
def function(x, y):
|
|
73
|
+
"""
|
|
74
|
+
Brief one-line summary.
|
|
75
|
+
|
|
76
|
+
Longer description spanning multiple lines if needed.
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
x : array-like
|
|
81
|
+
Description of x parameter.
|
|
82
|
+
y : float
|
|
83
|
+
Description of y parameter.
|
|
84
|
+
|
|
85
|
+
Returns
|
|
86
|
+
-------
|
|
87
|
+
tuple
|
|
88
|
+
Description of return value.
|
|
89
|
+
|
|
90
|
+
Examples
|
|
91
|
+
--------
|
|
92
|
+
>>> result = function([1, 2, 3], 1.0)
|
|
93
|
+
"""
|
|
94
|
+
pass
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Test Coverage
|
|
98
|
+
|
|
99
|
+
- All new code must be accompanied by tests
|
|
100
|
+
- Target minimum coverage of **85%** (enforce in CI/CD)
|
|
101
|
+
- Run `make test-cov` to generate coverage report
|
|
102
|
+
|
|
103
|
+
## Submitting Changes
|
|
104
|
+
|
|
105
|
+
### 1. Create a Feature Branch
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git checkout -b feature/my-feature-name
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 2. Make Changes
|
|
112
|
+
|
|
113
|
+
- Implement feature or bug fix
|
|
114
|
+
- Write tests for new functionality
|
|
115
|
+
- Update docstrings and type hints
|
|
116
|
+
- Run `make lint` to auto-format
|
|
117
|
+
|
|
118
|
+
### 3. Commit with Clear Messages
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Stage changes
|
|
122
|
+
git add .
|
|
123
|
+
|
|
124
|
+
# Commit with conventional commit format
|
|
125
|
+
git commit -m "feat: add bootstrap confidence intervals"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Commit Format**:
|
|
129
|
+
- `feat:` new feature
|
|
130
|
+
- `fix:` bug fix
|
|
131
|
+
- `docs:` documentation changes
|
|
132
|
+
- `test:` test additions/updates
|
|
133
|
+
- `refactor:` code refactoring without behavior change
|
|
134
|
+
- `chore:` dependency updates, CI/CD config, etc.
|
|
135
|
+
|
|
136
|
+
### 4. Push and Create a Pull Request
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
git push origin feature/my-feature-name
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Then open a PR on GitHub with:
|
|
143
|
+
- Clear title describing the change
|
|
144
|
+
- Description of what changes and why
|
|
145
|
+
- Link to related issues (e.g., "Fixes #123")
|
|
146
|
+
|
|
147
|
+
## Pull Request Checklist
|
|
148
|
+
|
|
149
|
+
Before submitting your PR, verify:
|
|
150
|
+
|
|
151
|
+
- [ ] Tests pass locally: `make test`
|
|
152
|
+
- [ ] Coverage is adequate: `make test-cov`
|
|
153
|
+
- [ ] Code is formatted: `make format`
|
|
154
|
+
- [ ] No linting errors: `make lint`
|
|
155
|
+
- [ ] Type hints are complete: `uv run mypy odr_bootstrap`
|
|
156
|
+
- [ ] Docstrings are updated
|
|
157
|
+
- [ ] CHANGELOG.md is updated if user-facing changes
|
|
158
|
+
|
|
159
|
+
## Development Commands
|
|
160
|
+
|
|
161
|
+
Helpful commands defined in `Makefile`:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
make help # Show all available commands
|
|
165
|
+
make sync # Sync dependencies
|
|
166
|
+
make test # Run tests
|
|
167
|
+
make test-cov # Run tests with coverage report
|
|
168
|
+
make lint # Check code style
|
|
169
|
+
make type-check # Run mypy type checking
|
|
170
|
+
make format # Auto-format code
|
|
171
|
+
make build # Build distribution package
|
|
172
|
+
make docs # Build Sphinx documentation
|
|
173
|
+
make clean # Remove build artifacts
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Documentation
|
|
177
|
+
|
|
178
|
+
If you're adding or modifying functionality:
|
|
179
|
+
|
|
180
|
+
1. Update or write docstrings in NumPy style
|
|
181
|
+
2. Add examples to docstrings if appropriate
|
|
182
|
+
3. Update README.md if user-facing
|
|
183
|
+
4. Update CHANGELOG.md under [Unreleased] section
|
|
184
|
+
|
|
185
|
+
To build and preview documentation locally:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
make docs
|
|
189
|
+
open docs/build/html/index.html # or use your browser
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Reporting Issues
|
|
193
|
+
|
|
194
|
+
When reporting bugs, include:
|
|
195
|
+
|
|
196
|
+
1. **Description**: What's the issue?
|
|
197
|
+
2. **Reproduction Steps**: How to reproduce it
|
|
198
|
+
3. **Expected Behavior**: What should happen
|
|
199
|
+
4. **Actual Behavior**: What actually happens
|
|
200
|
+
5. **Environment**:
|
|
201
|
+
- Python version: `python --version`
|
|
202
|
+
- Package version: `pip show odr-bootstrap`
|
|
203
|
+
- OS: macOS / Linux / Windows
|
|
204
|
+
|
|
205
|
+
Example:
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
## Bug Report: ODR_Bootstrap fails with NaN values
|
|
209
|
+
|
|
210
|
+
### Reproduction
|
|
211
|
+
```python
|
|
212
|
+
import numpy as np
|
|
213
|
+
from odr_bootstrap import ODR_Bootstrap
|
|
214
|
+
|
|
215
|
+
x = np.array([1.0, 2.0, np.nan, 4.0])
|
|
216
|
+
result = ODR_Bootstrap(x, y, x_err, y_err)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Expected
|
|
220
|
+
Function should handle NaN gracefully by dropping those values
|
|
221
|
+
|
|
222
|
+
### Actual
|
|
223
|
+
TypeError: cannot perform reduce with flexible type
|
|
224
|
+
|
|
225
|
+
### Environment
|
|
226
|
+
- Python 3.12.0
|
|
227
|
+
- odr-bootstrap 0.1.0
|
|
228
|
+
- numpy 2.2.4
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Questions?
|
|
232
|
+
|
|
233
|
+
Open a discussion or issue on [GitHub Issues](https://github.com/whtowbin/odr-bootstrap/issues).
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
**Thank you for contributing!** Your efforts make this package better for everyone. 🙌
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Henry Towbin
|
|
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.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.PHONY: help install sync test test-cov lint type-check format clean build publish publish-test docs
|
|
2
|
+
|
|
3
|
+
help:
|
|
4
|
+
@echo "ODR Bootstrap Package Management"
|
|
5
|
+
@echo ""
|
|
6
|
+
@echo "Setup:"
|
|
7
|
+
@echo " make sync Sync dependencies with uv"
|
|
8
|
+
@echo " make install Install package in development mode"
|
|
9
|
+
@echo ""
|
|
10
|
+
@echo "Development:"
|
|
11
|
+
@echo " make test Run tests"
|
|
12
|
+
@echo " make test-cov Run tests with coverage report"
|
|
13
|
+
@echo " make lint Check code style with ruff"
|
|
14
|
+
@echo " make type-check Check types with mypy"
|
|
15
|
+
@echo " make format Format code with ruff (in-place)"
|
|
16
|
+
@echo ""
|
|
17
|
+
@echo "Building & Publishing:"
|
|
18
|
+
@echo " make build Build distribution (wheel + sdist)"
|
|
19
|
+
@echo " make publish-test Publish to TestPyPI"
|
|
20
|
+
@echo " make publish Publish to PyPI (requires GitHub release)"
|
|
21
|
+
@echo ""
|
|
22
|
+
@echo "Documentation:"
|
|
23
|
+
@echo " make docs Build Sphinx documentation"
|
|
24
|
+
@echo ""
|
|
25
|
+
@echo "Maintenance:"
|
|
26
|
+
@echo " make clean Remove build artifacts"
|
|
27
|
+
|
|
28
|
+
sync:
|
|
29
|
+
uv sync --all-extras
|
|
30
|
+
|
|
31
|
+
install:
|
|
32
|
+
uv sync --all-extras
|
|
33
|
+
uv pip install -e ".[dev,docs,test]"
|
|
34
|
+
|
|
35
|
+
test:
|
|
36
|
+
uv run pytest
|
|
37
|
+
|
|
38
|
+
test-cov:
|
|
39
|
+
uv run pytest --cov=odr_bootstrap --cov-report=term-missing --cov-report=html
|
|
40
|
+
@echo "Coverage report generated: htmlcov/index.html"
|
|
41
|
+
|
|
42
|
+
lint:
|
|
43
|
+
uv run ruff check .
|
|
44
|
+
|
|
45
|
+
type-check:
|
|
46
|
+
uv run mypy odr_bootstrap
|
|
47
|
+
|
|
48
|
+
format:
|
|
49
|
+
uv run ruff format .
|
|
50
|
+
|
|
51
|
+
clean:
|
|
52
|
+
rm -rf build dist *.egg-info
|
|
53
|
+
rm -rf htmlcov .coverage .mypy_cache
|
|
54
|
+
rm -rf .pytest_cache
|
|
55
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
56
|
+
find . -type f -name "*.pyc" -delete
|
|
57
|
+
|
|
58
|
+
build: clean
|
|
59
|
+
uv build
|
|
60
|
+
|
|
61
|
+
publish-test: build
|
|
62
|
+
@echo "Publishing to TestPyPI..."
|
|
63
|
+
@echo "Note: This requires twine. Install with: pip install twine"
|
|
64
|
+
twine upload --repository testpypi dist/*
|
|
65
|
+
@echo "Verify at: https://test.pypi.org/project/odr-bootstrap/"
|
|
66
|
+
|
|
67
|
+
publish: build
|
|
68
|
+
@echo "Publishing to PyPI..."
|
|
69
|
+
@echo "Note: This should be done via GitHub Actions on release"
|
|
70
|
+
@echo "Manual publish requires: pip install twine"
|
|
71
|
+
twine upload dist/*
|
|
72
|
+
|
|
73
|
+
docs:
|
|
74
|
+
cd docs && make html
|
|
75
|
+
@echo "Documentation built: docs/build/html/index.html"
|
|
76
|
+
|
|
77
|
+
.DEFAULT_GOAL := help
|