bovidaeta 0.2.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.
- bovidaeta-0.2.0/.github/dependabot.yml +9 -0
- bovidaeta-0.2.0/.github/scripts/smoke_test.py +53 -0
- bovidaeta-0.2.0/.github/workflows/ci.yml +76 -0
- bovidaeta-0.2.0/.github/workflows/pr-title.yml +22 -0
- bovidaeta-0.2.0/.github/workflows/release.yml +161 -0
- bovidaeta-0.2.0/.gitignore +14 -0
- bovidaeta-0.2.0/CITATION.cff +68 -0
- bovidaeta-0.2.0/CONTRIBUTING.md +91 -0
- bovidaeta-0.2.0/LICENSE +202 -0
- bovidaeta-0.2.0/NOTICE +8 -0
- bovidaeta-0.2.0/PKG-INFO +227 -0
- bovidaeta-0.2.0/README.md +189 -0
- bovidaeta-0.2.0/assets/badge.svg +139 -0
- bovidaeta-0.2.0/examples/README.md +20 -0
- bovidaeta-0.2.0/examples/delta_quickstart.py +153 -0
- bovidaeta-0.2.0/examples/sqlite_quickstart.py +140 -0
- bovidaeta-0.2.0/pipelines/README.md +17 -0
- bovidaeta-0.2.0/pipelines/sqlite_to_delta.py +196 -0
- bovidaeta-0.2.0/pyproject.toml +120 -0
- bovidaeta-0.2.0/setup.cfg +4 -0
- bovidaeta-0.2.0/src/bovidaeta/__init__.py +138 -0
- bovidaeta-0.2.0/src/bovidaeta/cow.py +165 -0
- bovidaeta-0.2.0/src/bovidaeta/enums.py +601 -0
- bovidaeta-0.2.0/src/bovidaeta/event.py +40 -0
- bovidaeta-0.2.0/src/bovidaeta/event_metadata.py +789 -0
- bovidaeta-0.2.0/src/bovidaeta/herd.py +110 -0
- bovidaeta-0.2.0/src/bovidaeta/io/README.md +106 -0
- bovidaeta-0.2.0/src/bovidaeta/io/__init__.py +31 -0
- bovidaeta-0.2.0/src/bovidaeta/io/base.py +167 -0
- bovidaeta-0.2.0/src/bovidaeta/io/dairy_data.py +188 -0
- bovidaeta-0.2.0/src/bovidaeta/io/delta.py +190 -0
- bovidaeta-0.2.0/src/bovidaeta/io/sqlite.py +210 -0
- bovidaeta-0.2.0/src/bovidaeta/lactation.py +553 -0
- bovidaeta-0.2.0/src/bovidaeta/py.typed +0 -0
- bovidaeta-0.2.0/src/bovidaeta/schemas/__init__.py +22 -0
- bovidaeta-0.2.0/src/bovidaeta/schemas/delta.sql +96 -0
- bovidaeta-0.2.0/src/bovidaeta/schemas/sqlite.sql +52 -0
- bovidaeta-0.2.0/src/bovidaeta/simulation/README.md +28 -0
- bovidaeta-0.2.0/src/bovidaeta/simulation/__init__.py +11 -0
- bovidaeta-0.2.0/src/bovidaeta/simulation/__main__.py +60 -0
- bovidaeta-0.2.0/src/bovidaeta/simulation/main.py +948 -0
- bovidaeta-0.2.0/src/bovidaeta.egg-info/PKG-INFO +227 -0
- bovidaeta-0.2.0/src/bovidaeta.egg-info/SOURCES.txt +46 -0
- bovidaeta-0.2.0/src/bovidaeta.egg-info/dependency_links.txt +1 -0
- bovidaeta-0.2.0/src/bovidaeta.egg-info/requires.txt +7 -0
- bovidaeta-0.2.0/src/bovidaeta.egg-info/scm_file_list.json +44 -0
- bovidaeta-0.2.0/src/bovidaeta.egg-info/top_level.txt +1 -0
- bovidaeta-0.2.0/uv.lock +505 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Smoke test run by CI on every supported Python version.
|
|
2
|
+
|
|
3
|
+
Simulates a tiny farm and reads it back through the public API, so a broken
|
|
4
|
+
import, schema or loader fails CI even without a test suite.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
import tempfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
import bovidaeta
|
|
13
|
+
from bovidaeta import DairyData, EventType, load_lactations
|
|
14
|
+
|
|
15
|
+
print(f"bovidaeta {bovidaeta.__version__} on Python {sys.version.split()[0]}")
|
|
16
|
+
|
|
17
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
18
|
+
db = Path(tmp) / "farm.db"
|
|
19
|
+
subprocess.run(
|
|
20
|
+
[
|
|
21
|
+
sys.executable,
|
|
22
|
+
"-m",
|
|
23
|
+
"bovidaeta.simulation",
|
|
24
|
+
"--animals",
|
|
25
|
+
"40",
|
|
26
|
+
"--years",
|
|
27
|
+
"1",
|
|
28
|
+
"--db",
|
|
29
|
+
str(db),
|
|
30
|
+
"--seed",
|
|
31
|
+
"1",
|
|
32
|
+
"--yes",
|
|
33
|
+
],
|
|
34
|
+
check=True,
|
|
35
|
+
stdout=subprocess.DEVNULL,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
data = DairyData.from_sqlite(db)
|
|
39
|
+
events = data.load_events()
|
|
40
|
+
cows = data.load_cows()
|
|
41
|
+
herds = data.load_herds()
|
|
42
|
+
milk = data.load_events(
|
|
43
|
+
subset_events=[EventType.MILK_RECORDING], subset_metadata=["milking_yield"]
|
|
44
|
+
)
|
|
45
|
+
lactations = load_lactations(data)
|
|
46
|
+
|
|
47
|
+
print(
|
|
48
|
+
f"events={events.height} cows={cows.height} herds={herds.height} "
|
|
49
|
+
f"milk_recordings={milk.height} lactations={lactations.height}"
|
|
50
|
+
)
|
|
51
|
+
assert events.height > 0 and cows.height > 0 and herds.height > 0
|
|
52
|
+
assert milk.height > 0 and "milking_yield" in milk.columns
|
|
53
|
+
assert lactations.height > 0
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ci-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v5
|
|
21
|
+
- uses: astral-sh/setup-uv@v6
|
|
22
|
+
- name: Ruff lint
|
|
23
|
+
run: uv run --frozen --only-group dev ruff check --output-format=github .
|
|
24
|
+
- name: Ruff format
|
|
25
|
+
run: uv run --frozen --only-group dev ruff format --check .
|
|
26
|
+
|
|
27
|
+
build:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v5
|
|
31
|
+
with:
|
|
32
|
+
fetch-depth: 0 # setuptools-scm needs the tags to work out the version
|
|
33
|
+
- uses: astral-sh/setup-uv@v6
|
|
34
|
+
- name: Build sdist and wheel
|
|
35
|
+
run: uv build
|
|
36
|
+
- name: Check package metadata (renders on PyPI)
|
|
37
|
+
run: uvx twine check --strict dist/*
|
|
38
|
+
|
|
39
|
+
test:
|
|
40
|
+
name: test (${{ matrix.python }}${{ matrix.resolution == 'lowest-direct' && ', lowest deps' || '' }})
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
strategy:
|
|
43
|
+
fail-fast: false
|
|
44
|
+
matrix:
|
|
45
|
+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
46
|
+
resolution: [highest]
|
|
47
|
+
include:
|
|
48
|
+
# Oldest versions our dependency bounds allow, on the oldest Python.
|
|
49
|
+
- python: "3.10"
|
|
50
|
+
resolution: lowest-direct
|
|
51
|
+
env:
|
|
52
|
+
UV_PYTHON: ${{ matrix.python }}
|
|
53
|
+
UV_RESOLUTION: ${{ matrix.resolution }}
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v5
|
|
56
|
+
with:
|
|
57
|
+
fetch-depth: 0
|
|
58
|
+
- uses: astral-sh/setup-uv@v6
|
|
59
|
+
- name: Smoke test
|
|
60
|
+
run: uv run --isolated --no-project --with . python .github/scripts/smoke_test.py
|
|
61
|
+
- name: Unit tests
|
|
62
|
+
if: hashFiles('tests/**/*.py') != ''
|
|
63
|
+
run: uv run --isolated --no-project --with . --with "pytest>=8" pytest -q
|
|
64
|
+
|
|
65
|
+
# Single check to mark as required in branch protection, so the matrix
|
|
66
|
+
# can change without updating the protection rules.
|
|
67
|
+
ci-ok:
|
|
68
|
+
if: always()
|
|
69
|
+
needs: [lint, build, test]
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
steps:
|
|
72
|
+
- name: All CI jobs passed
|
|
73
|
+
run: |
|
|
74
|
+
[[ "${{ needs.lint.result }}" == "success" && \
|
|
75
|
+
"${{ needs.build.result }}" == "success" && \
|
|
76
|
+
"${{ needs.test.result }}" == "success" ]]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: PR title
|
|
2
|
+
|
|
3
|
+
# PRs are squash-merged, so the PR title becomes the commit message on main,
|
|
4
|
+
# and the release workflow reads it to decide the next version:
|
|
5
|
+
# feat: ... -> minor release fix: / perf: ... -> patch release
|
|
6
|
+
# feat!: ... or a "BREAKING CHANGE:" footer -> major (minor while on 0.x)
|
|
7
|
+
# docs: / chore: / ci: / test: / refactor: / build: / style: -> no release
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
pull_request_target:
|
|
11
|
+
types: [opened, edited, reopened, synchronize]
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
pull-requests: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
conventional-title:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: amannn/action-semantic-pull-request@v5
|
|
21
|
+
env:
|
|
22
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# On every push to main: work out the next version from the Conventional
|
|
4
|
+
# Commit messages since the last tag. If there is one, build, publish to
|
|
5
|
+
# PyPI, then tag vX.Y.Z and create a GitHub Release (which Zenodo archives).
|
|
6
|
+
# Nothing is committed to main, so branch protection stays as it is.
|
|
7
|
+
#
|
|
8
|
+
# Run manually (Actions -> Release -> Run workflow) to:
|
|
9
|
+
# - publish a dev build of the next version to TestPyPI (target=testpypi)
|
|
10
|
+
# - force a patch/minor/major release to PyPI (target=pypi, bump=...)
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
push:
|
|
14
|
+
branches: [main]
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
inputs:
|
|
17
|
+
target:
|
|
18
|
+
description: Where to publish
|
|
19
|
+
type: choice
|
|
20
|
+
options: [testpypi, pypi]
|
|
21
|
+
default: testpypi
|
|
22
|
+
bump:
|
|
23
|
+
description: Version bump (auto = from commit messages)
|
|
24
|
+
type: choice
|
|
25
|
+
options: [auto, patch, minor, major]
|
|
26
|
+
default: auto
|
|
27
|
+
|
|
28
|
+
permissions:
|
|
29
|
+
contents: read
|
|
30
|
+
|
|
31
|
+
concurrency:
|
|
32
|
+
group: release
|
|
33
|
+
cancel-in-progress: false
|
|
34
|
+
|
|
35
|
+
env:
|
|
36
|
+
PSR: uvx --from python-semantic-release==10.7.0 semantic-release
|
|
37
|
+
|
|
38
|
+
jobs:
|
|
39
|
+
plan:
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
outputs:
|
|
42
|
+
version: ${{ steps.plan.outputs.version }}
|
|
43
|
+
target: ${{ steps.plan.outputs.target }}
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v5
|
|
46
|
+
with:
|
|
47
|
+
fetch-depth: 0
|
|
48
|
+
- uses: astral-sh/setup-uv@v6
|
|
49
|
+
- id: plan
|
|
50
|
+
env:
|
|
51
|
+
TARGET: ${{ inputs.target || 'pypi' }}
|
|
52
|
+
BUMP: ${{ inputs.bump || 'auto' }}
|
|
53
|
+
run: |
|
|
54
|
+
# semantic-release writes its own step outputs when it detects
|
|
55
|
+
# GitHub Actions; keep those out of ours.
|
|
56
|
+
psr() { GITHUB_OUTPUT=/dev/null $PSR "$@"; }
|
|
57
|
+
|
|
58
|
+
force=""
|
|
59
|
+
if [[ "$BUMP" != "auto" ]]; then force="--$BUMP"; fi
|
|
60
|
+
last=$(psr version --print-last-released || true)
|
|
61
|
+
if [[ -z "$last" ]]; then
|
|
62
|
+
echo "::error::No vX.Y.Z tag found. Tag the last release first, e.g. git tag v0.1.4 && git push origin v0.1.4"
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
next=$(psr version $force --print)
|
|
66
|
+
echo "Last release: ${last:-none}, next version: $next"
|
|
67
|
+
|
|
68
|
+
if [[ "$TARGET" == "testpypi" ]]; then
|
|
69
|
+
# A dev build sorts before the release it leads up to.
|
|
70
|
+
if [[ "$next" == "$last" ]]; then next=$(psr version --patch --print); fi
|
|
71
|
+
version="${next}.dev${GITHUB_RUN_NUMBER}"
|
|
72
|
+
elif [[ "$next" != "$last" ]]; then
|
|
73
|
+
version="$next"
|
|
74
|
+
else
|
|
75
|
+
echo "No release-worthy commits since $last; nothing to publish."
|
|
76
|
+
TARGET="none"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
80
|
+
echo "target=$TARGET" >> "$GITHUB_OUTPUT"
|
|
81
|
+
echo "### Release plan: \`${version:-none}\` → ${TARGET}" >> "$GITHUB_STEP_SUMMARY"
|
|
82
|
+
|
|
83
|
+
build:
|
|
84
|
+
needs: plan
|
|
85
|
+
if: needs.plan.outputs.target != 'none'
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/checkout@v5
|
|
89
|
+
with:
|
|
90
|
+
fetch-depth: 0
|
|
91
|
+
- uses: astral-sh/setup-uv@v6
|
|
92
|
+
- name: Build
|
|
93
|
+
env:
|
|
94
|
+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ needs.plan.outputs.version }}
|
|
95
|
+
run: uv build
|
|
96
|
+
- name: Check
|
|
97
|
+
run: |
|
|
98
|
+
uvx twine check --strict dist/*
|
|
99
|
+
ls dist/bovidaeta-${{ needs.plan.outputs.version }}-py3-none-any.whl
|
|
100
|
+
- uses: actions/upload-artifact@v4
|
|
101
|
+
with:
|
|
102
|
+
name: dist
|
|
103
|
+
path: dist/
|
|
104
|
+
|
|
105
|
+
publish-testpypi:
|
|
106
|
+
needs: [plan, build]
|
|
107
|
+
if: needs.plan.outputs.target == 'testpypi'
|
|
108
|
+
runs-on: ubuntu-latest
|
|
109
|
+
environment:
|
|
110
|
+
name: testpypi
|
|
111
|
+
url: https://test.pypi.org/project/bovidaeta/${{ needs.plan.outputs.version }}/
|
|
112
|
+
permissions:
|
|
113
|
+
id-token: write # Trusted Publishing
|
|
114
|
+
steps:
|
|
115
|
+
- uses: actions/download-artifact@v4
|
|
116
|
+
with:
|
|
117
|
+
name: dist
|
|
118
|
+
path: dist/
|
|
119
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
120
|
+
with:
|
|
121
|
+
repository-url: https://test.pypi.org/legacy/
|
|
122
|
+
|
|
123
|
+
publish-pypi:
|
|
124
|
+
needs: [plan, build]
|
|
125
|
+
if: needs.plan.outputs.target == 'pypi'
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
environment:
|
|
128
|
+
name: pypi
|
|
129
|
+
url: https://pypi.org/project/bovidaeta/${{ needs.plan.outputs.version }}/
|
|
130
|
+
permissions:
|
|
131
|
+
id-token: write # Trusted Publishing
|
|
132
|
+
steps:
|
|
133
|
+
- uses: actions/download-artifact@v4
|
|
134
|
+
with:
|
|
135
|
+
name: dist
|
|
136
|
+
path: dist/
|
|
137
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
138
|
+
|
|
139
|
+
github-release:
|
|
140
|
+
needs: [plan, publish-pypi]
|
|
141
|
+
runs-on: ubuntu-latest
|
|
142
|
+
permissions:
|
|
143
|
+
contents: write # push the tag and create the release
|
|
144
|
+
steps:
|
|
145
|
+
- uses: actions/checkout@v5
|
|
146
|
+
- uses: actions/download-artifact@v4
|
|
147
|
+
with:
|
|
148
|
+
name: dist
|
|
149
|
+
path: dist/
|
|
150
|
+
- name: Tag and create GitHub Release
|
|
151
|
+
env:
|
|
152
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
153
|
+
VERSION: ${{ needs.plan.outputs.version }}
|
|
154
|
+
run: |
|
|
155
|
+
# Tag exactly the commit that was built and published.
|
|
156
|
+
git config user.name "github-actions[bot]"
|
|
157
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
158
|
+
git tag -a "v$VERSION" -m "v$VERSION" "$GITHUB_SHA"
|
|
159
|
+
git push origin "v$VERSION"
|
|
160
|
+
# Release notes list the merged PRs since the previous tag.
|
|
161
|
+
gh release create "v$VERSION" dist/* --title "v$VERSION" --generate-notes --verify-tag
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# TODO(zenodo): after the first release, add `doi:` with the Zenodo concept DOI.
|
|
2
|
+
# If there's a paper describing bovidaeta, add it under `preferred-citation`.
|
|
3
|
+
# Validate with: pipx run cffconvert --validate
|
|
4
|
+
cff-version: 1.2.0
|
|
5
|
+
message: "If you use bovidaeta, please cite it as below."
|
|
6
|
+
type: software
|
|
7
|
+
title: "bovidaeta: a common data format for dairy cattle data"
|
|
8
|
+
abstract: >-
|
|
9
|
+
bovidaeta is a data format for dairy cattle data (herds, cows and a
|
|
10
|
+
timeline of events per cow), with Python data models, SQLite and Delta
|
|
11
|
+
Lake storage, and a loader that reads both.
|
|
12
|
+
authors:
|
|
13
|
+
- family-names: Liu
|
|
14
|
+
given-names: Enhong
|
|
15
|
+
orcid: https://orcid.org/0000-0001-8608-9074
|
|
16
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
17
|
+
- family-names: Leerdam
|
|
18
|
+
name-particle: van
|
|
19
|
+
given-names: Meike
|
|
20
|
+
orcid: https://orcid.org/0009-0003-4187-2112
|
|
21
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
22
|
+
- family-names: Sharma
|
|
23
|
+
given-names: Sumit
|
|
24
|
+
orcid: https://orcid.org/0000-0002-4824-7569
|
|
25
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
26
|
+
- family-names: Yang
|
|
27
|
+
given-names: Haiyu
|
|
28
|
+
orcid: https://orcid.org/0009-0007-5125-4958
|
|
29
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
30
|
+
- family-names: Zhang
|
|
31
|
+
given-names: Hanlu
|
|
32
|
+
orcid: https://orcid.org/0009-0007-2217-9186
|
|
33
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
34
|
+
- family-names: Niu
|
|
35
|
+
given-names: Puchun
|
|
36
|
+
orcid: https://orcid.org/0000-0001-6858-1284
|
|
37
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
38
|
+
- family-names: Hu
|
|
39
|
+
given-names: Haowen
|
|
40
|
+
orcid: https://orcid.org/0009-0008-6538-8428
|
|
41
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
42
|
+
- family-names: Mallikarjuna
|
|
43
|
+
given-names: Lipika
|
|
44
|
+
orcid: https://orcid.org/0009-0002-4468-6895
|
|
45
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
46
|
+
- family-names: Hansen
|
|
47
|
+
given-names: Ed
|
|
48
|
+
orcid: https://orcid.org/0009-0005-1134-310X
|
|
49
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
50
|
+
- family-names: Zoete
|
|
51
|
+
name-particle: de
|
|
52
|
+
given-names: Bart
|
|
53
|
+
orcid: https://orcid.org/0009-0009-3665-4325
|
|
54
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
55
|
+
- family-names: Hostens
|
|
56
|
+
given-names: Miel
|
|
57
|
+
orcid: https://orcid.org/0000-0001-5376-976X
|
|
58
|
+
affiliation: "Bovi-Analytics Lab, Cornell University"
|
|
59
|
+
- name: "Bovi-Analytics Lab, Cornell University"
|
|
60
|
+
repository-code: "https://github.com/Bovi-Analytics/bovidaeta"
|
|
61
|
+
url: "https://bovi-analytics.org/"
|
|
62
|
+
keywords:
|
|
63
|
+
- dairy
|
|
64
|
+
- cattle
|
|
65
|
+
- livestock
|
|
66
|
+
- data format
|
|
67
|
+
- precision livestock farming
|
|
68
|
+
license: Apache-2.0
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Contributing to bovidaeta
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in improving bovidaeta! Bug reports, questions,
|
|
4
|
+
new event types and code changes are all welcome.
|
|
5
|
+
|
|
6
|
+
bovidaeta is maintained by the [Bovi-Analytics lab](https://bovi-analytics.org/)
|
|
7
|
+
at Cornell University. Every pull request is reviewed by at least one lab
|
|
8
|
+
member before it's merged. We're a small team, so a review can take a few
|
|
9
|
+
weeks; thanks for your patience.
|
|
10
|
+
|
|
11
|
+
## Contact
|
|
12
|
+
|
|
13
|
+
For anything that doesn't fit in a GitHub issue, including concerns about
|
|
14
|
+
how people treat each other in this project, contact the maintainers:
|
|
15
|
+
|
|
16
|
+
- Bart de Zoete (main maintainer): bd482@cornell.edu
|
|
17
|
+
- Miel Hostens (principal investigator): miel.hostens@cornell.edu
|
|
18
|
+
|
|
19
|
+
## Questions and bug reports
|
|
20
|
+
|
|
21
|
+
Open an [issue](https://github.com/Bovi-Analytics/bovidaeta/issues). For a
|
|
22
|
+
bug, include the bovidaeta version (`python -c "import bovidaeta; print(bovidaeta.__version__)"`),
|
|
23
|
+
your Python version, and a small example that shows the problem. Please
|
|
24
|
+
don't attach real farm data: the simulator
|
|
25
|
+
(`python -m bovidaeta.simulation`) can usually reproduce the issue.
|
|
26
|
+
|
|
27
|
+
## Development setup
|
|
28
|
+
|
|
29
|
+
We use [uv](https://docs.astral.sh/uv/).
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/Bovi-Analytics/bovidaeta.git
|
|
33
|
+
cd bovidaeta
|
|
34
|
+
uv sync # creates .venv with the package and dev tools
|
|
35
|
+
uv run pytest # run the tests
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
bovidaeta supports Python 3.10 and newer, so avoid syntax and standard
|
|
39
|
+
library features that are newer than that (for example `datetime.UTC`; use
|
|
40
|
+
`datetime.timezone.utc` instead).
|
|
41
|
+
|
|
42
|
+
## Making a change
|
|
43
|
+
|
|
44
|
+
1. Fork the repo (or create a branch, if you have access) and make your
|
|
45
|
+
change.
|
|
46
|
+
2. Add or update tests in `tests/`, and update the docs (README files,
|
|
47
|
+
docstrings) if behaviour changes.
|
|
48
|
+
3. Run `uv run ruff format .`, and make sure `uv run ruff check .` and
|
|
49
|
+
`uv run pytest` pass.
|
|
50
|
+
4. Open a pull request against `main`.
|
|
51
|
+
|
|
52
|
+
### Pull request titles
|
|
53
|
+
|
|
54
|
+
Pull requests are squash-merged, so the PR title becomes the commit message
|
|
55
|
+
on `main`. Titles follow [Conventional Commits](https://www.conventionalcommits.org/),
|
|
56
|
+
which a CI check enforces, and they decide the next release:
|
|
57
|
+
|
|
58
|
+
| Title | Release |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `feat: add HoofTrimming event type` | minor (0.2.0 → 0.3.0) |
|
|
61
|
+
| `fix: handle missing birth_date` | patch (0.2.0 → 0.2.1) |
|
|
62
|
+
| `feat!: rename Cow.exit_date` | breaking change (minor while we're on 0.x) |
|
|
63
|
+
| `docs:`, `test:`, `ci:`, `chore:`, `refactor:` | no release |
|
|
64
|
+
|
|
65
|
+
Releases happen automatically when a PR that warrants one is merged: CI
|
|
66
|
+
publishes the package to PyPI and creates a GitHub Release with notes
|
|
67
|
+
listing the merged PRs.
|
|
68
|
+
|
|
69
|
+
### Changing the data format
|
|
70
|
+
|
|
71
|
+
The models (`cow.py`, `herd.py`, `event.py`, `event_metadata.py`,
|
|
72
|
+
`enums.py`) and the table definitions in `schemas/` describe data that is
|
|
73
|
+
already stored on farms and in Databricks. Changes there affect everyone
|
|
74
|
+
reading that data, so new event types and metadata fields need sign-off
|
|
75
|
+
from the lab. Open an issue to discuss the change before you write the code.
|
|
76
|
+
|
|
77
|
+
bovidaeta stores what was observed or recorded on the farm, and leaves out
|
|
78
|
+
values that can be derived from other events, such as days in milk or
|
|
79
|
+
lactation number.
|
|
80
|
+
|
|
81
|
+
When changing the format:
|
|
82
|
+
|
|
83
|
+
- prefer adding optional fields over renaming or removing existing ones;
|
|
84
|
+
- keep `schemas/sqlite.sql` and `schemas/delta.sql` in line with the models;
|
|
85
|
+
- describe in the PR how existing data is affected.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
bovidaeta is licensed under the Apache License 2.0 (see [LICENSE](LICENSE)).
|
|
90
|
+
As section 5 of that license says, any contribution you submit for
|
|
91
|
+
inclusion is licensed under the same terms.
|