Add documentation for using tempolocus as a Python library#22
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fbb316c4f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| from tempolocus import analyze_activity, load_json | ||
|
|
||
| activity = analyze_activity(load_json("samples/year.json"), kind="yearly") | ||
| print(activity["activity_type"], activity["score"]) |
There was a problem hiding this comment.
Use the actual activity confidence field
In the inspected README library example, this raises KeyError for any valid input because analyze_activity() returns activity_type, confidence, basis, and shares from tempolocus/core.py, not score. Users copying this documented snippet will fail when they try to read the activity summary; update the example and field description to use activity["confidence"] or add a real score alias in the API.
Useful? React with 👍 / 👎.
Motivation
tempolocusprogrammatically instead of via the CLI.Description
Using tempolocus as a Python librarywith install instructions and editable-install guidance inREADME.md.detect,analyze_activity, andload_json, including parameter descriptions fordetectand example usage forweekly,timestamps, andyearlyinputs.tempolocus.core.DetectionErrorfor invalid inputs.Testing
python -m pytest, which executed 31 tests and all tests passed.Codex Task