samplesar 0.1.0__tar.gz → 0.1.1__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.
- samplesar-0.1.1/.github/workflows/ci.yml +176 -0
- samplesar-0.1.1/.github/workflows/docs.yml +57 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/.github/workflows/release.yml +5 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/.gitignore +3 -0
- samplesar-0.1.1/CHANGELOG.md +69 -0
- samplesar-0.1.1/CLAUDE.md +39 -0
- samplesar-0.1.1/CODE_OF_CONDUCT.md +85 -0
- samplesar-0.1.1/CONTRIBUTING.md +67 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/Makefile +15 -3
- {samplesar-0.1.0 → samplesar-0.1.1}/PKG-INFO +14 -6
- {samplesar-0.1.0 → samplesar-0.1.1}/README.md +4 -1
- samplesar-0.1.1/docs/api/evaluate.md +9 -0
- samplesar-0.1.1/docs/api/nest.md +29 -0
- samplesar-0.1.1/docs/api/sample.md +9 -0
- samplesar-0.1.1/docs/getting-started.md +48 -0
- samplesar-0.1.1/docs/index.md +28 -0
- samplesar-0.1.1/docs/strategies.md +97 -0
- samplesar-0.1.1/mkdocs.yml +68 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/pyproject.toml +23 -5
- samplesar-0.1.1/src/samplesar/__init__.py +33 -0
- samplesar-0.1.1/src/samplesar/_evaluate.py +117 -0
- samplesar-0.1.1/src/samplesar/_hull.py +301 -0
- samplesar-0.1.1/src/samplesar/_nest.py +152 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/src/samplesar/_sample.py +89 -11
- samplesar-0.1.1/tests/test_evaluate.py +103 -0
- samplesar-0.1.1/tests/test_hull_nests.py +352 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/tests/test_random_nest.py +6 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/uv.lock +1094 -910
- samplesar-0.1.0/.github/workflows/ci.yml +0 -48
- samplesar-0.1.0/CHANGELOG.md +0 -32
- samplesar-0.1.0/src/samplesar/__init__.py +0 -13
- samplesar-0.1.0/src/samplesar/_nest.py +0 -73
- {samplesar-0.1.0 → samplesar-0.1.1}/.github/dependabot.yml +0 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/.github/scripts/roll_changelog.py +0 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/.github/workflows/publish.yml +0 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/.python-version +0 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/CITATION.cff +0 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/LICENSE +0 -0
- {samplesar-0.1.0 → samplesar-0.1.1}/tests/test_import.py +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
# Weekly, for the newest and minimum dependency versions (see those jobs); only
|
|
10
|
+
# a push to main triggers a release.
|
|
11
|
+
schedule:
|
|
12
|
+
- cron: "23 6 * * 1"
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
# A new push to a PR cancels its older run. Every other run gets its own group,
|
|
19
|
+
# so each push to main finishes CI and can be released.
|
|
20
|
+
group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
|
21
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
lint:
|
|
25
|
+
name: lint
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v7
|
|
29
|
+
|
|
30
|
+
- name: Set up uv
|
|
31
|
+
uses: astral-sh/setup-uv@v7
|
|
32
|
+
|
|
33
|
+
# Ruff only, no project install, at the exact version in uv.lock so CI
|
|
34
|
+
# and local `uv sync` lint with the same release.
|
|
35
|
+
- name: Resolve locked ruff version
|
|
36
|
+
run: |
|
|
37
|
+
version=$(awk '/^name = "ruff"$/{f=1} f && /^version = /{gsub(/"/,"",$3); print $3; exit}' uv.lock)
|
|
38
|
+
test -n "$version" || { echo "ruff not found in uv.lock" >&2; exit 1; }
|
|
39
|
+
echo "RUFF_VERSION=$version" >> "$GITHUB_ENV"
|
|
40
|
+
|
|
41
|
+
- name: Lint
|
|
42
|
+
run: uvx "ruff@$RUFF_VERSION" check src tests
|
|
43
|
+
|
|
44
|
+
- name: Format check
|
|
45
|
+
run: uvx "ruff@$RUFF_VERSION" format --check src tests
|
|
46
|
+
|
|
47
|
+
typecheck:
|
|
48
|
+
name: typecheck
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v7
|
|
52
|
+
with:
|
|
53
|
+
fetch-depth: 0 # tags, for the hatch-vcs version
|
|
54
|
+
|
|
55
|
+
- name: Set up uv
|
|
56
|
+
uses: astral-sh/setup-uv@v7
|
|
57
|
+
|
|
58
|
+
# The locked mypy and stubs, so CI and `make typecheck` agree.
|
|
59
|
+
- name: mypy
|
|
60
|
+
run: uv run --frozen --extra dev mypy
|
|
61
|
+
|
|
62
|
+
docs:
|
|
63
|
+
name: docs
|
|
64
|
+
# The site builds with --strict, so a broken reference or docstring fails the
|
|
65
|
+
# pull request rather than the deploy after a release.
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v7
|
|
69
|
+
with:
|
|
70
|
+
fetch-depth: 0 # tags, for the hatch-vcs version
|
|
71
|
+
- name: Set up uv
|
|
72
|
+
uses: astral-sh/setup-uv@v7
|
|
73
|
+
- name: mkdocs build
|
|
74
|
+
run: uv run --frozen --extra docs mkdocs build --strict
|
|
75
|
+
|
|
76
|
+
test:
|
|
77
|
+
name: test (py${{ matrix.python-version }})
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
# 3.15 is a pre-release: a failure there is reported but doesn't fail the run,
|
|
80
|
+
# so a pre-release regression can't block a merge or a release.
|
|
81
|
+
continue-on-error: ${{ matrix.python-version == '3.15' }}
|
|
82
|
+
strategy:
|
|
83
|
+
fail-fast: false
|
|
84
|
+
matrix:
|
|
85
|
+
# Pull requests test the oldest and newest stable Pythons; pushes to main
|
|
86
|
+
# (which release) and manual runs (the top of a PR stack) test them all.
|
|
87
|
+
python-version: ${{ fromJSON(github.event_name == 'pull_request' && '["3.11", "3.14"]' || '["3.11", "3.12", "3.13", "3.14", "3.15"]') }}
|
|
88
|
+
env:
|
|
89
|
+
OMP_NUM_THREADS: "1"
|
|
90
|
+
OPENBLAS_NUM_THREADS: "1"
|
|
91
|
+
MKL_NUM_THREADS: "1"
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/checkout@v7
|
|
94
|
+
with:
|
|
95
|
+
fetch-depth: 0 # tags, for the hatch-vcs version
|
|
96
|
+
- name: Set up uv
|
|
97
|
+
uses: astral-sh/setup-uv@v7
|
|
98
|
+
with:
|
|
99
|
+
python-version: "${{ matrix.python-version }}"
|
|
100
|
+
enable-cache: true
|
|
101
|
+
# Exactly the versions in uv.lock, so a failure comes from the change under
|
|
102
|
+
# test, not from a dependency's new release (the newest job catches those).
|
|
103
|
+
- run: uv sync --frozen --extra dev
|
|
104
|
+
# Coverage (only printed) runs on 3.14, which every run tests, with
|
|
105
|
+
# coverage's sys.monitoring core, much faster than its C tracer.
|
|
106
|
+
- name: pytest
|
|
107
|
+
run: |
|
|
108
|
+
cov=
|
|
109
|
+
if [ "${{ matrix.python-version }}" = "3.14" ]; then
|
|
110
|
+
cov="--cov --cov-report=term-missing"
|
|
111
|
+
export COVERAGE_CORE=sysmon
|
|
112
|
+
fi
|
|
113
|
+
uv run --frozen --no-sync pytest $cov --durations=10
|
|
114
|
+
|
|
115
|
+
minimums:
|
|
116
|
+
name: minimum dependencies
|
|
117
|
+
# The oldest numpy, pandas, shapely and sars pyproject.toml allows, on the
|
|
118
|
+
# oldest Python: what samplesar promises to work with. Not on pull requests
|
|
119
|
+
# (the floors rarely move); on pushes to main it gates the release.
|
|
120
|
+
if: github.event_name != 'pull_request'
|
|
121
|
+
runs-on: ubuntu-latest
|
|
122
|
+
env:
|
|
123
|
+
OMP_NUM_THREADS: "1"
|
|
124
|
+
OPENBLAS_NUM_THREADS: "1"
|
|
125
|
+
MKL_NUM_THREADS: "1"
|
|
126
|
+
steps:
|
|
127
|
+
- uses: actions/checkout@v7
|
|
128
|
+
with:
|
|
129
|
+
fetch-depth: 0 # tags, for the hatch-vcs version
|
|
130
|
+
- name: Set up uv
|
|
131
|
+
uses: astral-sh/setup-uv@v7
|
|
132
|
+
with:
|
|
133
|
+
python-version: "3.11"
|
|
134
|
+
# Each runtime dependency's floor (">=") pinned exactly; the dev tools
|
|
135
|
+
# resolve around them.
|
|
136
|
+
- name: Install the minimums
|
|
137
|
+
run: |
|
|
138
|
+
uv run --no-project --with packaging python - <<'PY' > minimums.txt
|
|
139
|
+
import tomllib
|
|
140
|
+
from packaging.requirements import Requirement
|
|
141
|
+
for dep in tomllib.load(open("pyproject.toml", "rb"))["project"]["dependencies"]:
|
|
142
|
+
req = Requirement(dep)
|
|
143
|
+
floors = [s.version for s in req.specifier if s.operator == ">="]
|
|
144
|
+
if not floors:
|
|
145
|
+
raise SystemExit(f"{dep}: no >= floor to test")
|
|
146
|
+
print(f"{req.name}=={floors[0]}")
|
|
147
|
+
PY
|
|
148
|
+
cat minimums.txt
|
|
149
|
+
uv venv
|
|
150
|
+
uv pip install --constraint minimums.txt -e ".[dev]"
|
|
151
|
+
- name: pytest
|
|
152
|
+
run: uv run --no-sync pytest
|
|
153
|
+
|
|
154
|
+
newest:
|
|
155
|
+
name: newest dependencies
|
|
156
|
+
# The newest releases, ignoring uv.lock, to catch an upstream release that
|
|
157
|
+
# breaks samplesar before users do. Informational: a failure shows in the job
|
|
158
|
+
# list but doesn't fail the run or block a release.
|
|
159
|
+
if: github.event_name != 'pull_request'
|
|
160
|
+
continue-on-error: true
|
|
161
|
+
runs-on: ubuntu-latest
|
|
162
|
+
env:
|
|
163
|
+
OMP_NUM_THREADS: "1"
|
|
164
|
+
OPENBLAS_NUM_THREADS: "1"
|
|
165
|
+
MKL_NUM_THREADS: "1"
|
|
166
|
+
steps:
|
|
167
|
+
- uses: actions/checkout@v7
|
|
168
|
+
with:
|
|
169
|
+
fetch-depth: 0 # tags, for the hatch-vcs version
|
|
170
|
+
- name: Set up uv
|
|
171
|
+
uses: astral-sh/setup-uv@v7
|
|
172
|
+
with:
|
|
173
|
+
python-version: "3.14"
|
|
174
|
+
- run: uv sync --upgrade --extra dev
|
|
175
|
+
- name: pytest
|
|
176
|
+
run: uv run --no-sync pytest
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
# Builds the MkDocs site and deploys it to GitHub Pages.
|
|
4
|
+
# Enable once: repo Settings → Pages → Build and deployment → Source = "GitHub Actions",
|
|
5
|
+
# and let release tags deploy: Settings → Environments → github-pages → Deployment
|
|
6
|
+
# branches and tags → add a tag rule "v*" (the environment GitHub creates allows
|
|
7
|
+
# only main, and release.yml runs this workflow on the tag).
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
# Run by release.yml on the new tag, so the site matches the latest release
|
|
11
|
+
# (a merge to main alone doesn't redeploy it). Also by hand, on main or a
|
|
12
|
+
# release tag: the github-pages environment refuses other refs.
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
pages: write
|
|
18
|
+
id-token: write
|
|
19
|
+
|
|
20
|
+
concurrency:
|
|
21
|
+
group: pages
|
|
22
|
+
cancel-in-progress: false
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
build:
|
|
26
|
+
name: Build site
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v7
|
|
30
|
+
with:
|
|
31
|
+
fetch-depth: 0 # full history + tags for hatch-vcs versioning
|
|
32
|
+
|
|
33
|
+
- name: Set up uv
|
|
34
|
+
uses: astral-sh/setup-uv@v7
|
|
35
|
+
with:
|
|
36
|
+
enable-cache: true
|
|
37
|
+
|
|
38
|
+
# The locked versions, as the CI docs job builds on pull requests.
|
|
39
|
+
- name: Build (mkdocstrings analyzes source statically)
|
|
40
|
+
run: uv run --frozen --extra docs mkdocs build --strict
|
|
41
|
+
|
|
42
|
+
- name: Upload Pages artifact
|
|
43
|
+
uses: actions/upload-pages-artifact@v5
|
|
44
|
+
with:
|
|
45
|
+
path: site
|
|
46
|
+
|
|
47
|
+
deploy:
|
|
48
|
+
name: Deploy to GitHub Pages
|
|
49
|
+
needs: build
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
environment:
|
|
52
|
+
name: github-pages
|
|
53
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
54
|
+
steps:
|
|
55
|
+
- name: Deploy
|
|
56
|
+
id: deployment
|
|
57
|
+
uses: actions/deploy-pages@v5
|
|
@@ -254,3 +254,8 @@ jobs:
|
|
|
254
254
|
if [ -f .github/workflows/publish.yml ]; then
|
|
255
255
|
gh workflow run publish.yml --ref "$TAG"
|
|
256
256
|
fi
|
|
257
|
+
# Likewise the docs: they deploy per release (from the tag), not per
|
|
258
|
+
# merge, so the site never describes code that isn't released yet.
|
|
259
|
+
if [ -f .github/workflows/docs.yml ]; then
|
|
260
|
+
gh workflow run docs.yml --ref "$TAG"
|
|
261
|
+
fi
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.1] - 2026-11-22
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `hull_random_nest()`: nest a sample by removing a random vertex of its
|
|
14
|
+
convex hull at each step, so it shrinks from the outside in.
|
|
15
|
+
- `hull_peel_nest()`: nest a sample by peeling off its whole convex hull
|
|
16
|
+
boundary at each step (convex layers).
|
|
17
|
+
- `hull_area_nest()`: nest a sample by removing, at each step, the hull
|
|
18
|
+
vertex whose loss leaves the largest (or smallest) remaining hull.
|
|
19
|
+
- `hull_species_nest()`: nest a sample by removing, at each step, the hull
|
|
20
|
+
vertex whose loss leaves the most (or fewest) species.
|
|
21
|
+
- `hull_distance_nest()`: nest a sample by removing, at each step, the hull
|
|
22
|
+
vertex farthest from (or closest to) the centroid of the hull's vertices.
|
|
23
|
+
- `Nest.fit()` and `compare_nests()`: fit a sars model to a nest, or the same
|
|
24
|
+
model to several nests (one row each: steps, parameters, R², AICc), to
|
|
25
|
+
compare sampling strategies.
|
|
26
|
+
- `make typecheck` (mypy), part of `make check`; tests run in parallel.
|
|
27
|
+
- A documentation site: getting started, the sampling strategies and an API
|
|
28
|
+
reference (`make docs`, built on every pull request, deployed on each
|
|
29
|
+
release).
|
|
30
|
+
- CONTRIBUTING.md and CODE_OF_CONDUCT.md.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- **Python 3.11 or newer is required.** 3.10 reached end of life in October
|
|
35
|
+
2026. The dependency floors move to versions with Python 3.11 wheels:
|
|
36
|
+
numpy 1.23.2 and pandas 1.5.
|
|
37
|
+
- CI lints with the locked ruff version, type-checks with mypy, tests the
|
|
38
|
+
oldest and newest Pythons on pull requests and every supported Python on
|
|
39
|
+
`main`, and checks the minimum and newest allowed dependency versions.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- `random_nest()` rejects `min_points` below 1 with a clear message; 0 gave
|
|
44
|
+
a nest ending in an empty step and a negative value failed inside numpy.
|
|
45
|
+
|
|
46
|
+
## [0.1.0] - 2026-11-22
|
|
47
|
+
|
|
48
|
+
The first release as samplesar. Releases 0.1.0 to 0.1.3 were published as
|
|
49
|
+
nestsar, a project that no longer exists; samplesar starts its version numbers
|
|
50
|
+
again at 0.1.0.
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- `Sample`: georeferenced species observations from a DataFrame or CSV, with
|
|
55
|
+
distinct points, species count, and convex hull area.
|
|
56
|
+
- `Nest` and `random_nest()`: nest a sample by removing one point at a time
|
|
57
|
+
uniformly at random, the baseline for every other strategy, and export the
|
|
58
|
+
area and species table that `sars` fits.
|
|
59
|
+
- Tests and PyPI classifiers cover Python 3.10 to 3.15.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- **Renamed from nestsar to samplesar**, for the distribution and the import
|
|
64
|
+
name alike: `pip install samplesar` and `import samplesar` replace
|
|
65
|
+
`nestsar`. The package now covers geometric sampling designs in general,
|
|
66
|
+
with nesting as one of them. Apart from the import name the API is
|
|
67
|
+
unchanged, so `nestsar.random_nest(...)` becomes
|
|
68
|
+
`samplesar.random_nest(...)`.
|
|
69
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Guidance for working in this repo. When something here conflicts with the code, trust the
|
|
4
|
+
code and flag the drift.
|
|
5
|
+
|
|
6
|
+
## What this is
|
|
7
|
+
|
|
8
|
+
`samplesar` builds species-area relationship (SAR) datasets from georeferenced species
|
|
9
|
+
observations by geometric sampling: nested hulls, islands and other sampling designs. Each
|
|
10
|
+
design turns a `Sample` of points into an area and richness table, and
|
|
11
|
+
[sars](https://github.com/jmcmeen/sars) fits and evaluates the curves.
|
|
12
|
+
|
|
13
|
+
- Python **>= 3.11**, `src/` layout, package `samplesar`.
|
|
14
|
+
- Tooling: **uv** for environments, **ruff** for lint and format, **mypy** for types,
|
|
15
|
+
**pytest** (with xdist) for tests. Drive everything through the `Makefile`;
|
|
16
|
+
`make check` runs what CI runs.
|
|
17
|
+
|
|
18
|
+
## Design
|
|
19
|
+
|
|
20
|
+
1. **`Sample` holds the observations; a `Nest` holds index arrays into its points.** A
|
|
21
|
+
strategy only decides which point (or points) to drop next; it returns a `Nest` whose
|
|
22
|
+
`steps[i]` are row indices into `sample.points`, each step a subset of the one before.
|
|
23
|
+
Don't copy observation data per step.
|
|
24
|
+
2. **One public function per strategy family**, named for what it removes
|
|
25
|
+
(`random_nest`, `hull_*_nest`), with `min_points` and, if random, `seed`. Choices that
|
|
26
|
+
pick one candidate are deterministic: ties are broken by a stated rule, never by set
|
|
27
|
+
or dict order.
|
|
28
|
+
3. **sars is a required dependency.** Evaluating a sampling design means fitting its SAR
|
|
29
|
+
data, so `samplesar` uses sars directly rather than as an optional extra.
|
|
30
|
+
4. **Areas are convex hull areas in square degrees** until a projected area lands. Say so
|
|
31
|
+
wherever an area is reported.
|
|
32
|
+
5. **Errors are exceptions** (`ValueError`, `KeyError`) with messages that name the
|
|
33
|
+
problem; no sentinel returns.
|
|
34
|
+
|
|
35
|
+
## Tests
|
|
36
|
+
|
|
37
|
+
- Every strategy gets tests for nestedness, its own selection rule (checked by brute
|
|
38
|
+
force on small samples), reproducibility, and a hand-made sample with a known answer.
|
|
39
|
+
- No real observation data in the repo: tests build synthetic samples.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
# Contributor Covenant Code of Conduct
|
|
3
|
+
|
|
4
|
+
## Our Pledge
|
|
5
|
+
|
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
7
|
+
|
|
8
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
9
|
+
|
|
10
|
+
## Our Standards
|
|
11
|
+
|
|
12
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
13
|
+
|
|
14
|
+
* Demonstrating empathy and kindness toward other people
|
|
15
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
16
|
+
* Giving and gracefully accepting constructive feedback
|
|
17
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
18
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
19
|
+
|
|
20
|
+
Examples of unacceptable behavior include:
|
|
21
|
+
|
|
22
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
* Public or private harassment
|
|
25
|
+
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
26
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
27
|
+
|
|
28
|
+
## Enforcement Responsibilities
|
|
29
|
+
|
|
30
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
31
|
+
|
|
32
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
33
|
+
|
|
34
|
+
## Scope
|
|
35
|
+
|
|
36
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
37
|
+
|
|
38
|
+
## Enforcement
|
|
39
|
+
|
|
40
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at johnmcmeen@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
41
|
+
|
|
42
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
43
|
+
|
|
44
|
+
## Enforcement Guidelines
|
|
45
|
+
|
|
46
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
47
|
+
|
|
48
|
+
### 1. Correction
|
|
49
|
+
|
|
50
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
51
|
+
|
|
52
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
53
|
+
|
|
54
|
+
### 2. Warning
|
|
55
|
+
|
|
56
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
57
|
+
|
|
58
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
59
|
+
|
|
60
|
+
### 3. Temporary Ban
|
|
61
|
+
|
|
62
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
63
|
+
|
|
64
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
65
|
+
|
|
66
|
+
### 4. Permanent Ban
|
|
67
|
+
|
|
68
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
69
|
+
|
|
70
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
71
|
+
|
|
72
|
+
## Attribution
|
|
73
|
+
|
|
74
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
75
|
+
|
|
76
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
77
|
+
|
|
78
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
79
|
+
|
|
80
|
+
[homepage]: https://www.contributor-covenant.org
|
|
81
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
82
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
83
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
84
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
85
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Contributing to samplesar
|
|
2
|
+
|
|
3
|
+
Thanks for your interest. Bug reports, questions, documentation fixes and code
|
|
4
|
+
are all welcome. This page covers how to get set up and what a change needs
|
|
5
|
+
before it can be merged.
|
|
6
|
+
|
|
7
|
+
## Getting help and reporting problems
|
|
8
|
+
|
|
9
|
+
- **Bugs and feature requests:** open an issue at
|
|
10
|
+
<https://github.com/jmcmeen/samplesar/issues>. For a bug, include the
|
|
11
|
+
`samplesar` version, your Python version, a minimal example that reproduces
|
|
12
|
+
it, and the full traceback.
|
|
13
|
+
- **Questions:** also an issue. There is no separate mailing list or chat.
|
|
14
|
+
- **Security concerns:** email the maintainer directly rather than opening a
|
|
15
|
+
public issue.
|
|
16
|
+
|
|
17
|
+
The project has one maintainer. Expect a response to issues within a week.
|
|
18
|
+
|
|
19
|
+
## Development setup
|
|
20
|
+
|
|
21
|
+
Only the maintainer can push to this repository, so contributions come in as
|
|
22
|
+
pull requests from a fork. Fork
|
|
23
|
+
[jmcmeen/samplesar](https://github.com/jmcmeen/samplesar) on GitHub, then clone
|
|
24
|
+
your fork. The project uses [uv](https://docs.astral.sh/uv/) for environments
|
|
25
|
+
and `make` as a thin front end.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/YOUR-USERNAME/samplesar.git # your fork
|
|
29
|
+
cd samplesar
|
|
30
|
+
git remote add upstream https://github.com/jmcmeen/samplesar.git
|
|
31
|
+
make install # uv sync --extra dev
|
|
32
|
+
make check # lint, format check, type check and tests, as CI runs them
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Making a change
|
|
36
|
+
|
|
37
|
+
1. Open an issue first for anything larger than a typo, so the design can be
|
|
38
|
+
discussed before code is written.
|
|
39
|
+
2. In your fork, branch from an up-to-date `main`, naming the branch after the
|
|
40
|
+
kind of change (`feat/`, `fix/`, `docs/`, `refactor/`, `test/`, `build/`,
|
|
41
|
+
`ci/` or `chore/`):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git fetch upstream
|
|
45
|
+
git switch -c fix/short-description --no-track upstream/main
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
3. Make the change and add or update tests. New behaviour needs a test; a bug
|
|
49
|
+
fix needs a test that fails without the fix.
|
|
50
|
+
4. Add a line under `[Unreleased]` in `CHANGELOG.md` (Keep a Changelog
|
|
51
|
+
sections: Added, Changed, Deprecated, Removed, Fixed).
|
|
52
|
+
5. Run `make fmt`, then `make check`.
|
|
53
|
+
6. Push the branch to your fork (`git push -u origin fix/short-description`)
|
|
54
|
+
and open a pull request against `main` in this repository. Say what changed
|
|
55
|
+
and why, and reference the issue (`Fixes #N`).
|
|
56
|
+
|
|
57
|
+
CI runs on the pull request. The maintainer reviews and merges it. If `main`
|
|
58
|
+
moves on while your pull request is open, update your branch with
|
|
59
|
+
`git fetch upstream && git merge upstream/main`.
|
|
60
|
+
|
|
61
|
+
## Releases
|
|
62
|
+
|
|
63
|
+
Merges to `main` that pass CI are released automatically and published to
|
|
64
|
+
PyPI, normally as one patch version per merge. A minor or major release is
|
|
65
|
+
triggered by hand when the maintainer decides one is due. The `[Unreleased]`
|
|
66
|
+
changelog entries become the release notes, so you don't need to touch
|
|
67
|
+
version numbers.
|
|
@@ -9,7 +9,8 @@ TESTS := tests
|
|
|
9
9
|
|
|
10
10
|
.PHONY: help install dev sync lock upgrade shell \
|
|
11
11
|
test test-fast cov \
|
|
12
|
-
lint fmt fmt-check check \
|
|
12
|
+
lint fmt fmt-check typecheck check \
|
|
13
|
+
docs docs-serve \
|
|
13
14
|
clean
|
|
14
15
|
|
|
15
16
|
help: ## Show this help
|
|
@@ -58,10 +59,21 @@ fmt: ## Auto-format and apply lint fixes
|
|
|
58
59
|
fmt-check: ## Check formatting without modifying files
|
|
59
60
|
$(UV) run --extra dev ruff format --check $(SRC) $(TESTS)
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
typecheck: ## Type-check src with mypy (settings in pyproject.toml)
|
|
63
|
+
$(UV) run --extra dev mypy
|
|
64
|
+
|
|
65
|
+
check: lint fmt-check typecheck test docs ## Run lint, format check, type check, tests, and the docs build
|
|
66
|
+
|
|
67
|
+
## --- Documentation (mkdocs) ---
|
|
68
|
+
|
|
69
|
+
docs: ## Build the documentation site (strict)
|
|
70
|
+
$(UV) run --extra docs mkdocs build --strict
|
|
71
|
+
|
|
72
|
+
docs-serve: ## Serve the documentation with live reload
|
|
73
|
+
$(UV) run --extra docs mkdocs serve
|
|
62
74
|
|
|
63
75
|
## --- Housekeeping ---
|
|
64
76
|
|
|
65
77
|
clean: ## Remove caches and test/coverage build artifacts
|
|
66
|
-
rm -rf .pytest_cache .ruff_cache .coverage htmlcov dist
|
|
78
|
+
rm -rf .pytest_cache .ruff_cache .mypy_cache .coverage htmlcov dist site
|
|
67
79
|
find . -name .venv -prune -o -type d -name __pycache__ -prune -exec rm -rf {} +
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: samplesar
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Species-area relationship datasets from geometric sampling of point observations
|
|
5
5
|
Project-URL: Homepage, https://github.com/jmcmeen/samplesar
|
|
6
6
|
Project-URL: Source, https://github.com/jmcmeen/samplesar
|
|
@@ -14,21 +14,26 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.15
|
|
23
|
-
Requires-Python: >=3.
|
|
24
|
-
Requires-Dist: numpy>=1.
|
|
25
|
-
Requires-Dist: pandas>=1.
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: numpy>=1.23.2
|
|
24
|
+
Requires-Dist: pandas>=1.5
|
|
26
25
|
Requires-Dist: sars>=0.7.10
|
|
27
26
|
Requires-Dist: shapely>=2.0
|
|
28
27
|
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
29
|
+
Requires-Dist: pandas-stubs; extra == 'dev'
|
|
29
30
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-xdist[psutil]; extra == 'dev'
|
|
30
32
|
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
31
33
|
Requires-Dist: ruff<0.18,>=0.17; extra == 'dev'
|
|
34
|
+
Provides-Extra: docs
|
|
35
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
36
|
+
Requires-Dist: mkdocstrings[python]; extra == 'docs'
|
|
32
37
|
Description-Content-Type: text/markdown
|
|
33
38
|
|
|
34
39
|
# samplesar
|
|
@@ -46,9 +51,12 @@ nest = samplesar.random_nest(sample, seed=0)
|
|
|
46
51
|
fit = sars.sar_power(nest.sar_data())
|
|
47
52
|
```
|
|
48
53
|
|
|
54
|
+
Documentation: <https://jmcmeen.github.io/samplesar/>
|
|
55
|
+
|
|
49
56
|
## Development
|
|
50
57
|
|
|
51
58
|
```sh
|
|
52
59
|
make install # create .venv with dev tooling
|
|
53
|
-
make check # lint, format check, tests
|
|
60
|
+
make check # lint, format check, type check, tests
|
|
61
|
+
make docs # build the documentation site
|
|
54
62
|
```
|
|
@@ -13,9 +13,12 @@ nest = samplesar.random_nest(sample, seed=0)
|
|
|
13
13
|
fit = sars.sar_power(nest.sar_data())
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
Documentation: <https://jmcmeen.github.io/samplesar/>
|
|
17
|
+
|
|
16
18
|
## Development
|
|
17
19
|
|
|
18
20
|
```sh
|
|
19
21
|
make install # create .venv with dev tooling
|
|
20
|
-
make check # lint, format check, tests
|
|
22
|
+
make check # lint, format check, type check, tests
|
|
23
|
+
make docs # build the documentation site
|
|
21
24
|
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Nests API
|
|
2
|
+
|
|
3
|
+
## Nest
|
|
4
|
+
|
|
5
|
+
::: samplesar.Nest
|
|
6
|
+
|
|
7
|
+
## random_nest
|
|
8
|
+
|
|
9
|
+
::: samplesar.random_nest
|
|
10
|
+
|
|
11
|
+
## hull_random_nest
|
|
12
|
+
|
|
13
|
+
::: samplesar.hull_random_nest
|
|
14
|
+
|
|
15
|
+
## hull_peel_nest
|
|
16
|
+
|
|
17
|
+
::: samplesar.hull_peel_nest
|
|
18
|
+
|
|
19
|
+
## hull_area_nest
|
|
20
|
+
|
|
21
|
+
::: samplesar.hull_area_nest
|
|
22
|
+
|
|
23
|
+
## hull_species_nest
|
|
24
|
+
|
|
25
|
+
::: samplesar.hull_species_nest
|
|
26
|
+
|
|
27
|
+
## hull_distance_nest
|
|
28
|
+
|
|
29
|
+
::: samplesar.hull_distance_nest
|