Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create docs pages #87

Merged
merged 1 commit into from
Apr 29, 2024
Merged

Create docs pages #87

merged 1 commit into from
Apr 29, 2024

Conversation

talmo
Copy link
Contributor

@talmo talmo commented Apr 29, 2024

  • Added docs pages via mkdocs, mkdocs-material, mkdocstrings and mike
  • Fixed many docstrings
  • Updated deps

Summary by CodeRabbit

  • New Features

    • Introduced new documentation files for data formats, model structures, and utilities in the sleap_io module.
    • Added automated checks for docstring conventions.
    • Enhanced styling for documentation content.
  • Documentation

    • Updated CONTRIBUTING.md with new setup instructions and link updates.
    • Added detailed descriptions of core data structures and functions in the newly created documentation files.
    • Configured the documentation site with new settings and structure in mkdocs.yml.
  • Bug Fixes

    • Corrected parameter names and types across various functions to improve clarity and functionality.
    • Fixed typos and enhanced docstring formatting for better readability.
  • Refactor

    • Moved version number settings to a new dedicated file for better management.
    • Updated internal references to package version and dependencies in configuration files.
  • Style

    • Applied new CSS styles to the documentation content for improved visual presentation.

Copy link
Contributor

coderabbitai bot commented Apr 29, 2024

Walkthrough

The updates primarily refine the sleap_io package, enhancing documentation, updating coding conventions, and adjusting parameter names for clarity. Key changes include the migration of version control, improved docstring adherence checks, and the introduction of new files for better structure and detailed guidance.

Changes

File Path Change Summary
CONTRIBUTING.md, pyproject.toml, sleap_io/__init__.py, sleap_io/version.py Updated version control and package settings.
docs/..., mkdocs.yml Enhanced documentation structure and styling.
sleap_io/io/... Parameter name changes and typo corrections for clarity in function arguments.
sleap_io/model/... Documentation adjustments and renaming arguments for consistency.

🐇✨
In the code fields where bytes hop,
Changes bloom like flowers non-stop.
From docs to scripts, updates unfurl,
A digital garden, a new world swirl.
Cheers to clean code, oh what a sight,
Hoppy coding to all, and to all a good byte! 🌟
🐇✨


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between c6b4e4a and e5e1d08.
Files ignored due to path filters (2)
  • docs/assets/favicon.ico is excluded by !**/*.ico
  • docs/assets/sleap-logo.png is excluded by !**/*.png
Files selected for processing (19)
  • CONTRIBUTING.md (3 hunks)
  • docs/css/mkdocstrings.css (1 hunks)
  • docs/formats.md (1 hunks)
  • docs/index.md (1 hunks)
  • docs/model.md (1 hunks)
  • mkdocs.yml (1 hunks)
  • pyproject.toml (2 hunks)
  • scripts/gen_ref_pages.py (1 hunks)
  • sleap_io/init.py (1 hunks)
  • sleap_io/io/jabs.py (1 hunks)
  • sleap_io/io/labelstudio.py (1 hunks)
  • sleap_io/io/main.py (1 hunks)
  • sleap_io/io/nwb.py (2 hunks)
  • sleap_io/io/utils.py (1 hunks)
  • sleap_io/model/instance.py (4 hunks)
  • sleap_io/model/labeled_frame.py (1 hunks)
  • sleap_io/model/labels.py (1 hunks)
  • sleap_io/model/video.py (2 hunks)
  • sleap_io/version.py (1 hunks)
Files skipped from review due to trivial changes (3)
  • sleap_io/io/nwb.py
  • sleap_io/model/labeled_frame.py
  • sleap_io/version.py
Additional Context Used
LanguageTool (109)
CONTRIBUTING.md (39)

Near line 8: Only proper nouns start with an uppercase character (there are exceptions for headlines).
Context: ...Development workflow ### Setting up 1. Clone the repository: ``` git clone h...


Near line 13: Possible spelling mistake found.
Context: ...he package in development mode: With [conda](https://docs.conda.io/en/latest/minic...


Near line 17: Possible spelling mistake found.
Context: ... activate sleap-io Or without conda: pip install -e .[dev] ```...


Near line 26: Possible spelling mistake found.
Context: ...tall the environment from scratch using conda: ``` conda env remove -n sleap-io && c...


Near line 32: Possible spelling mistake found.
Context: ...lobal environment is to use a tool like pipx: ``` pi...


Near line 38: Possible spelling mistake found.
Context: ...e black available everywhere (such as VSCode), but will not be dependent on your con...


Near line 38: Possible spelling mistake found.
Context: ...ode), but will not be dependent on your conda base environment. ### Contributing ...


Near line 46: Possible spelling mistake found.
Context: ...tive title for the change. For example: talmo/nwb_support or `talmo/update_dependenc...


Near line 46: Possible spelling mistake found.
Context: ...ge. For example: talmo/nwb_support or talmo/update_dependencies. 4. Push as many c...


Near line 48: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...in` with a description of your changes. Feel free to create a "Draft" pull request to work o...


Near line 56: The official name of this software platform is spelled with a capital “H”.
Context: ...ions) to enforce code quality. See the .github/workflows folder for how our checks ar...


Near line 59: Possible spelling mistake found.
Context: ...dependency management This package uses [setuptools](https://setuptools.pypa.io/en/latest/...


Near line 63: This sentence does not start with an uppercase letter.
Context: ... be changed. - setup.cfg which contains the [declarative configuration...


Near line 65: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s need to be introduced (or if versions need to be fenced), specify these in [`setup.cf...


Near line 65: Don’t put a space before the full stop.
Context: ... when specifying the dev extras like: pip install -e .[dev] or pip install sleap-io[dev]. ...


Near line 65: Possible spelling mistake found.
Context: ...extras like: pip install -e .[dev] or pip install sleap-io[dev]. Best practices for adding depen...


Near line 72: Possible spelling mistake found.
Context: ... For more reference see: - [Configuring setuptools using setup.cfg files](https://setupt...


Near line 73: Possible spelling mistake found.
Context: ...t/userguide/declarative_config.html) - [Setuptools Keywords](https://setuptools.pypa.io/en...


Near line 76: Possible spelling mistake found.
Context: ...python.org/pep-0508/) Note: We use [conda](https://docs.conda.io/en/latest/minic...


Near line 79: Possible typo: you repeated a word
Context: ...vironment.yml](environment.yml). ### Testing Testing is done via [pytest`](https://docs.pyt...


Near line 80: Possible spelling mistake found.
Context: ...yml). ### Testing Testing is done via pytest. Tests sho...


Near line 82: Possible spelling mistake found.
Context: ...onvention test_{MODULE_NAME}.py which mimicks the main module organization. It is hi...


Near line 88: The official name of this software platform is spelled with a capital “H”.
Context: ...rating systems and Python versions (see .github/workflows/ci.yml). ### Coverage We c...


Near line 92: Possible spelling mistake found.
Context: ...or coverage by parsing the outputs from pytest and uploading to [Codecov](https://app...


Near line 92: Possible spelling mistake found.
Context: ...outputs from pytest and uploading to [Codecov](https://app.codecov.io/gh/talmolab/sle...


Near line 100: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...to set this up in your local environment so your code is auto-formatted before push...


Near line 102: The official name of this software platform is spelled with a capital “H”.
Context: ...e is automatically checked on push (see .github/workflows/lint.yml). ### Documentati...


Near line 106: Possible spelling mistake found.
Context: ....html) conventions. This is checked via pydocstyle. For exa...


Near line 137: When ‘88-character’ is used as a modifier, it is usually spelled with a hyphen.
Context: ... - The first line should fit within the 88 character limit, be on the same line as the initi...


Near line 137: Unpaired symbol: ‘"’ seems to be missing
Context: ...mit, be on the same line as the initial """, and should use imperative tense (e.g....


Near line 141: Possible spelling mistake found.
Context: ...puts that are arrays. Adherence to the docstring conventions is automatically checked on...


Near line 141: The official name of this software platform is spelled with a capital “H”.
Context: ...s is automatically checked on push (see .github/workflows/ci.yml). ## Releases ### V...


Near line 146: Possible spelling mistake found.
Context: ...rsioning This package follows standard semver version practices...


Near line 160: Possible spelling mistake found.
Context: ...yPI-compatible package settings are in [pyproject.toml]. The version number is set in [s...


Near line 160: Possible spelling mistake found.
Context: ...ible package settings are in [pyproject.toml]. The version number is set in [sleap_...


Near line 162: Possible spelling mistake found.
Context: ...t.toml]. The version number is set in [sleap_io/version.py] in the __version__ var...


Near line 162: Possible spelling mistake found.
Context: ...]. The version number is set in [sleap_io/version.py] in the __version__ variab...


Near line 162: Possible spelling mistake found.
Context: ...variable. This is read automatically by setuptools during installation and build. To manu...


Near line 169: The official name of this software platform is spelled with a capital “H”.
Context: ...o trigger an automated build (via the [.github/workflows/build.yml] action), [publish ...

docs/formats.md (28)

Near line 3: Possible spelling mistake found.
Context: # Data formats ::: sleap_io.load_file ::: sleap_io.save_file :...


Near line 3: Possible spelling mistake found.
Context: # Data formats ::: sleap_io.load_file ::: sleap_io.save_file ::: ...


Near line 5: Possible spelling mistake found.
Context: ...ta formats ::: sleap_io.load_file ::: sleap_io.save_file ::: sleap_io.load_video ...


Near line 5: Possible spelling mistake found.
Context: ...mats ::: sleap_io.load_file ::: sleap_io.save_file ::: sleap_io.load_video :::...


Near line 7: Possible spelling mistake found.
Context: ....load_file ::: sleap_io.save_file ::: sleap_io.load_video ::: sleap_io.load_slp :...


Near line 7: Possible spelling mistake found.
Context: ...file ::: sleap_io.save_file ::: sleap_io.load_video ::: sleap_io.load_slp ::: ...


Near line 9: Possible spelling mistake found.
Context: ...save_file ::: sleap_io.load_video ::: sleap_io.load_slp ::: sleap_io.save_slp :::...


Near line 9: Possible spelling mistake found.
Context: ...ile ::: sleap_io.load_video ::: sleap_io.load_slp ::: sleap_io.save_slp ::: sl...


Near line 9: Possible spelling mistake found.
Context: ... sleap_io.load_video ::: sleap_io.load_slp ::: sleap_io.save_slp ::: sleap_io.lo...


Near line 11: Possible spelling mistake found.
Context: ....load_video ::: sleap_io.load_slp ::: sleap_io.save_slp ::: sleap_io.load_nwb :::...


Near line 11: Possible spelling mistake found.
Context: ...video ::: sleap_io.load_slp ::: sleap_io.save_slp ::: sleap_io.load_nwb ::: sl...


Near line 11: Possible spelling mistake found.
Context: ...:: sleap_io.load_slp ::: sleap_io.save_slp ::: sleap_io.load_nwb ::: sleap_io.sa...


Near line 13: Possible spelling mistake found.
Context: ...io.load_slp ::: sleap_io.save_slp ::: sleap_io.load_nwb ::: sleap_io.save_nwb :::...


Near line 13: Possible spelling mistake found.
Context: ...d_slp ::: sleap_io.save_slp ::: sleap_io.load_nwb ::: sleap_io.save_nwb ::: sl...


Near line 13: Possible spelling mistake found.
Context: ...:: sleap_io.save_slp ::: sleap_io.load_nwb ::: sleap_io.save_nwb ::: sleap_io.lo...


Near line 15: Possible spelling mistake found.
Context: ...io.save_slp ::: sleap_io.load_nwb ::: sleap_io.save_nwb ::: sleap_io.load_jabs ::...


Near line 15: Possible spelling mistake found.
Context: ...e_slp ::: sleap_io.load_nwb ::: sleap_io.save_nwb ::: sleap_io.load_jabs ::: s...


Near line 15: Possible spelling mistake found.
Context: ...:: sleap_io.load_nwb ::: sleap_io.save_nwb ::: sleap_io.load_jabs ::: sleap_io.s...


Near line 17: Possible spelling mistake found.
Context: ...io.load_nwb ::: sleap_io.save_nwb ::: sleap_io.load_jabs ::: sleap_io.save_jabs :...


Near line 17: Possible spelling mistake found.
Context: ...d_nwb ::: sleap_io.save_nwb ::: sleap_io.load_jabs ::: sleap_io.save_jabs ::: ...


Near line 19: Possible spelling mistake found.
Context: ...o.save_nwb ::: sleap_io.load_jabs ::: sleap_io.save_jabs ::: sleap_io.load_labelst...


Near line 19: Possible spelling mistake found.
Context: ..._nwb ::: sleap_io.load_jabs ::: sleap_io.save_jabs ::: sleap_io.load_labelstudi...


Near line 21: Possible spelling mistake found.
Context: ....load_jabs ::: sleap_io.save_jabs ::: sleap_io.load_labelstudio ::: sleap_io.save_...


Near line 21: Possible spelling mistake found.
Context: ...jabs ::: sleap_io.save_jabs ::: sleap_io.load_labelstudio ::: sleap_io.save_lab...


Near line 21: Possible spelling mistake found.
Context: ...: sleap_io.save_jabs ::: sleap_io.load_labelstudio ::: sleap_io.save_labelstudio


Near line 23: Possible spelling mistake found.
Context: ...abs ::: sleap_io.load_labelstudio ::: sleap_io.save_labelstudio


Near line 23: Possible spelling mistake found.
Context: ...:: sleap_io.load_labelstudio ::: sleap_io.save_labelstudio


Near line 23: Possible spelling mistake found.
Context: ..._io.load_labelstudio ::: sleap_io.save_labelstudio

docs/index.md (4)

Near line 1: Possible spelling mistake found.
Context: # sleap-io [![CI](https://github.com/talmolab/sle...


Near line 3: Possible spelling mistake found.
Context: ...olab/sleap-io/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/talmolab/sleap-i...


Near line 11: Possible spelling mistake found.
Context: ...ntended to be a complement to the core SLEAP pac...


Near line 114: Possible spelling mistake found.
Context: ...f your problem or request. For general SLEAP usage, see the [main website](https://s...

docs/model.md (38)

Near line 3: This sentence does not start with an uppercase letter.
Context: # Data model sleap-io implements the core data structures used in SLEAP ...


Near line 3: Possible spelling mistake found.
Context: ...ements the core data structures used in SLEAP for storing data related to multi-insta...


Near line 7: Possible spelling mistake found.
Context: ...otation, training and inference. ::: sleap_io.Labels ::: sleap_io.LabeledFrame :...


Near line 7: Possible spelling mistake found.
Context: ...n, training and inference. ::: sleap_io.Labels ::: sleap_io.LabeledFrame ::: ...


Near line 7: Add a space between sentences.
Context: ...training and inference. ::: sleap_io.Labels ::: sleap_io.LabeledFrame ::: sleap_i...


Near line 9: Possible spelling mistake found.
Context: ... inference. ::: sleap_io.Labels ::: sleap_io.LabeledFrame ::: sleap_io.Instance ...


Near line 9: Possible spelling mistake found.
Context: ...ence. ::: sleap_io.Labels ::: sleap_io.LabeledFrame ::: sleap_io.Instance ::...


Near line 9: Add a space between sentences.
Context: ...e. ::: sleap_io.Labels ::: sleap_io.LabeledFrame ::: sleap_io.Instance ::: sleap_io.Pr...


Near line 11: Possible spelling mistake found.
Context: ....Labels ::: sleap_io.LabeledFrame ::: sleap_io.Instance ::: sleap_io.PredictedInst...


Near line 11: Possible spelling mistake found.
Context: ...s ::: sleap_io.LabeledFrame ::: sleap_io.Instance ::: sleap_io.PredictedInstanc...


Near line 11: Add a space between sentences.
Context: ...::: sleap_io.LabeledFrame ::: sleap_io.Instance ::: sleap_io.PredictedInstance ::: sl...


Near line 13: Possible spelling mistake found.
Context: ...abeledFrame ::: sleap_io.Instance ::: sleap_io.PredictedInstance ::: sleap_io.Poin...


Near line 13: Possible spelling mistake found.
Context: ...Frame ::: sleap_io.Instance ::: sleap_io.PredictedInstance ::: sleap_io.Point ...


Near line 13: Add a space between sentences.
Context: ...me ::: sleap_io.Instance ::: sleap_io.PredictedInstance ::: sleap_io.Point ::: sleap_io.Predi...


Near line 15: Possible spelling mistake found.
Context: ...ce ::: sleap_io.PredictedInstance ::: sleap_io.Point ::: sleap_io.PredictedPoint ...


Near line 15: Possible spelling mistake found.
Context: ...: sleap_io.PredictedInstance ::: sleap_io.Point ::: sleap_io.PredictedPoint :::...


Near line 15: Add a space between sentences.
Context: ...leap_io.PredictedInstance ::: sleap_io.Point ::: sleap_io.PredictedPoint ::: sleap...


Near line 17: Possible spelling mistake found.
Context: ...dictedInstance ::: sleap_io.Point ::: sleap_io.PredictedPoint ::: sleap_io.Skeleto...


Near line 17: Possible spelling mistake found.
Context: ...Instance ::: sleap_io.Point ::: sleap_io.PredictedPoint ::: sleap_io.Skeleton ...


Near line 17: Add a space between sentences.
Context: ...tance ::: sleap_io.Point ::: sleap_io.PredictedPoint ::: sleap_io.Skeleton ::: sleap_io.No...


Near line 19: Possible spelling mistake found.
Context: ...Point ::: sleap_io.PredictedPoint ::: sleap_io.Skeleton ::: sleap_io.Node ::: sle...


Near line 19: Possible spelling mistake found.
Context: ... ::: sleap_io.PredictedPoint ::: sleap_io.Skeleton ::: sleap_io.Node ::: sleap_...


Near line 19: Add a space between sentences.
Context: ...: sleap_io.PredictedPoint ::: sleap_io.Skeleton ::: sleap_io.Node ::: sleap_io.Edge ...


Near line 21: Possible spelling mistake found.
Context: ...dictedPoint ::: sleap_io.Skeleton ::: sleap_io.Node ::: sleap_io.Edge ::: sleap_i...


Near line 21: Possible spelling mistake found.
Context: ...Point ::: sleap_io.Skeleton ::: sleap_io.Node ::: sleap_io.Edge ::: sleap_io.S...


Near line 21: Add a space between sentences.
Context: ...nt ::: sleap_io.Skeleton ::: sleap_io.Node ::: sleap_io.Edge ::: sleap_io.Symmet...


Near line 23: Possible spelling mistake found.
Context: ...eap_io.Skeleton ::: sleap_io.Node ::: sleap_io.Edge ::: sleap_io.Symmetry ::: sle...


Near line 23: Possible spelling mistake found.
Context: ....Skeleton ::: sleap_io.Node ::: sleap_io.Edge ::: sleap_io.Symmetry ::: sleap_...


Near line 23: Add a space between sentences.
Context: ...eleton ::: sleap_io.Node ::: sleap_io.Edge ::: sleap_io.Symmetry ::: sleap_io.Tr...


Near line 25: Possible spelling mistake found.
Context: ...: sleap_io.Node ::: sleap_io.Edge ::: sleap_io.Symmetry ::: sleap_io.Track ::: sl...


Near line 25: Possible spelling mistake found.
Context: ...p_io.Node ::: sleap_io.Edge ::: sleap_io.Symmetry ::: sleap_io.Track ::: sleap...


Near line 25: Add a space between sentences.
Context: ...o.Node ::: sleap_io.Edge ::: sleap_io.Symmetry ::: sleap_io.Track ::: sleap_io.Video...


Near line 27: Possible spelling mistake found.
Context: ...eap_io.Edge ::: sleap_io.Symmetry ::: sleap_io.Track ::: sleap_io.Video


Near line 27: Possible spelling mistake found.
Context: ....Edge ::: sleap_io.Symmetry ::: sleap_io.Track ::: sleap_io.Video


Near line 27: Add a space between sentences.
Context: ...ge ::: sleap_io.Symmetry ::: sleap_io.Track ::: sleap_io.Video


Near line 29: Possible spelling mistake found.
Context: ...ap_io.Symmetry ::: sleap_io.Track ::: sleap_io.Video


Near line 29: Possible spelling mistake found.
Context: ...Symmetry ::: sleap_io.Track ::: sleap_io.Video


Near line 29: Add a space between sentences.
Context: ...metry ::: sleap_io.Track ::: sleap_io.Video

Ruff (35)
sleap_io/__init__.py (24)

3-3: sleap_io.version.__version__ imported but unused; consider removing, adding to __all__, or using a redundant alias


4-4: sleap_io.model.skeleton.Node imported but unused; consider removing, adding to __all__, or using a redundant alias


4-4: sleap_io.model.skeleton.Edge imported but unused; consider removing, adding to __all__, or using a redundant alias


4-4: sleap_io.model.skeleton.Skeleton imported but unused; consider removing, adding to __all__, or using a redundant alias


4-4: sleap_io.model.skeleton.Symmetry imported but unused; consider removing, adding to __all__, or using a redundant alias


5-5: sleap_io.model.video.Video imported but unused; consider removing, adding to __all__, or using a redundant alias


7-7: sleap_io.model.instance.Point imported but unused; consider removing, adding to __all__, or using a redundant alias


8-8: sleap_io.model.instance.PredictedPoint imported but unused; consider removing, adding to __all__, or using a redundant alias


9-9: sleap_io.model.instance.Track imported but unused; consider removing, adding to __all__, or using a redundant alias


10-10: sleap_io.model.instance.Instance imported but unused; consider removing, adding to __all__, or using a redundant alias


11-11: sleap_io.model.instance.PredictedInstance imported but unused; consider removing, adding to __all__, or using a redundant alias


13-13: sleap_io.model.labeled_frame.LabeledFrame imported but unused; consider removing, adding to __all__, or using a redundant alias


14-14: sleap_io.model.labels.Labels imported but unused; consider removing, adding to __all__, or using a redundant alias


16-16: sleap_io.io.main.load_slp imported but unused; consider removing, adding to __all__, or using a redundant alias


17-17: sleap_io.io.main.save_slp imported but unused; consider removing, adding to __all__, or using a redundant alias


18-18: sleap_io.io.main.load_nwb imported but unused; consider removing, adding to __all__, or using a redundant alias


19-19: sleap_io.io.main.save_nwb imported but unused; consider removing, adding to __all__, or using a redundant alias


20-20: sleap_io.io.main.load_labelstudio imported but unused; consider removing, adding to __all__, or using a redundant alias


21-21: sleap_io.io.main.save_labelstudio imported but unused; consider removing, adding to __all__, or using a redundant alias


22-22: sleap_io.io.main.load_jabs imported but unused; consider removing, adding to __all__, or using a redundant alias


23-23: sleap_io.io.main.save_jabs imported but unused; consider removing, adding to __all__, or using a redundant alias


24-24: sleap_io.io.main.load_video imported but unused; consider removing, adding to __all__, or using a redundant alias


25-25: sleap_io.io.main.load_file imported but unused; consider removing, adding to __all__, or using a redundant alias


26-26: sleap_io.io.main.save_file imported but unused; consider removing, adding to __all__, or using a redundant alias

sleap_io/io/labelstudio.py (1)

39-39: Do not compare types, use isinstance()

sleap_io/model/instance.py (4)

215-215: Do not compare types, use isinstance()


223-223: Do not compare types, use isinstance()


257-257: Do not compare types, use isinstance()


257-257: Do not compare types, use isinstance()

sleap_io/model/labels.py (4)

15-15: sleap_io.Instance imported but unused


64-64: Do not compare types, use isinstance()


68-68: Do not compare types, use isinstance()


149-149: Do not compare types, use isinstance()

sleap_io/model/video.py (2)

9-9: Redefinition of unused Optional from line 9


90-90: Do not use bare except

Additional comments not posted (7)
scripts/gen_ref_pages.py (1)

1-35: Script logic appears correct and well-structured for generating documentation pages.

pyproject.toml (1)

Line range hint 39-55: Development dependencies are correctly updated to support the new documentation setup.

docs/css/mkdocstrings.css (1)

1-47: Custom CSS styles are well-defined and enhance the documentation's readability and visual appeal.

mkdocs.yml (1)

1-156: Configuration settings in mkdocs.yml are comprehensive and correctly set up to enhance the documentation site's functionality and appearance.

CONTRIBUTING.md (1)

141-141: Ensure docstring conventions are enforced in CI checks as mentioned.

Please verify that the new CI checks for docstring conventions are correctly implemented in .github/workflows/ci.yml.

sleap_io/model/labels.py (1)

246-248: Updated documentation clarifies behavior when return_new is True.

sleap_io/io/jabs.py (1)

198-201: Parameter renaming and addition in prediction_to_instance function are clear and align with expected functionality.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.46%. Comparing base (c6b4e4a) to head (e5e1d08).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #87   +/-   ##
=======================================
  Coverage   95.46%   95.46%           
=======================================
  Files          13       14    +1     
  Lines        1632     1633    +1     
=======================================
+ Hits         1558     1559    +1     
  Misses         74       74           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Out of diff range and nitpick comments (4)
sleap_io/__init__.py (1)

Line range hint 3-26: Many imports are unused. Consider removing them or adding them to __all__ if they are meant to be exposed as public API.

- from sleap_io.version import __version__
- from sleap_io.model.skeleton import Node, Edge, Skeleton, Symmetry
- from sleap_io.model.video import Video
- from sleap_io.model.instance import (
-     Point,
-     PredictedPoint,
-     Track,
-     Instance,
-     PredictedInstance,
- )
- from sleap_io.model.labeled_frame import LabeledFrame
- from sleap_io.model.labels import Labels
- from sleap_io.io.main import (
-     load_slp,
-     save_slp,
-     load_nwb,
-     save_nwb,
-     load_labelstudio,
-     save_labelstudio,
-     load_jabs,
-     save_jabs,
-     load_video,
-     load_file,
-     save_file,
- )
sleap_io/model/video.py (2)

Line range hint 9-9: Remove duplicate import of Optional.

- from typing import Tuple, Optional, Optional
+ from typing import Tuple, Optional

Line range hint 90-90: Replace bare except with specific exceptions to avoid catching unexpected errors.

-        except:
+        except AttributeError:  # or other specific exceptions
sleap_io/model/instance.py (1)

Line range hint 44-58: Replace type comparison with isinstance() for better practice.

- if type(other) is not type(self):
+ if not isinstance(other, type(self)):

Comment on lines +111 to +121
def __eq__(self, other: object) -> bool:
"""Compare `self` and `other` for equality.

See `Point.__eq__()` for important notes about point equality semantics!

Args:
self, other: instance of `PredictedPoint` to compare
other: Instance of `PredictedPoint` to compare

Returns:
True if all attributes of `self` and `other` are the identical (possibly
allowing precision error for `x` and `y` attributes).
Returns True if all attributes of `self` and `other` are the identical
(possibly allowing precision error for `x` and `y` attributes).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace type comparison with isinstance() for better practice.

- if not super().__eq__(other):
+ if not isinstance(other, PredictedPoint) or not super().__eq__(other):

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
def __eq__(self, other: object) -> bool:
"""Compare `self` and `other` for equality.
See `Point.__eq__()` for important notes about point equality semantics!
Args:
self, other: instance of `PredictedPoint` to compare
other: Instance of `PredictedPoint` to compare
Returns:
True if all attributes of `self` and `other` are the identical (possibly
allowing precision error for `x` and `y` attributes).
Returns True if all attributes of `self` and `other` are the identical
(possibly allowing precision error for `x` and `y` attributes).
def __eq__(self, other: object) -> bool:
"""Compare `self` and `other` for equality.
See `Point.__eq__()` for important notes about point equality semantics!
Args:
other: Instance of `PredictedPoint` to compare
Returns:
Returns True if all attributes of `self` and `other` are the identical
(possibly allowing precision error for `x` and `y` attributes).
if not isinstance(other, PredictedPoint) or not super().__eq__(other):

@@ -64,7 +64,7 @@ def load_labelstudio(
"""Read Label Studio-style annotations from a file and return a `Labels` object.

Args:
labels_path: Path to the label-studio annotation file in JSON format.
filename: Path to the label-studio annotation file in JSON format.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename parameter labels_path to filename to align with other I/O functions.

-    filename: Path to the label-studio annotation file in JSON format.
+    labels_path: Path to the label-studio annotation file in JSON format.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
filename: Path to the label-studio annotation file in JSON format.
labels_path: Path to the label-studio annotation file in JSON format.

@@ -119,7 +119,7 @@ def __getitem__(self, inds: int | list[int] | slice) -> np.ndarray:
"""Return the frames of the video at the given indices.

Args:
ind: Index or list of indices of frames to read.
inds: Index or list of indices of frames to read.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename parameter ind to inds to reflect that it can handle multiple indices.

-            inds: Index or list of indices of frames to read.
+            ind: Index or list of indices of frames to read.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
inds: Index or list of indices of frames to read.
ind: Index or list of indices of frames to read.

@@ -121,7 +121,7 @@ def write_group(parent_group, data_to_write):


def read_hdf5_attrs(
filename, dataset: str = "/", attribute: Optional[str] = None
filename: str, dataset: str = "/", attribute: Optional[str] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add explicit typing to the filename parameter to improve type clarity.

-    filename: str, dataset: str = "/", attribute: Optional[str] = None
+    filename: str | Path, dataset: str = "/", attribute: Optional[str] = None

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
filename: str, dataset: str = "/", attribute: Optional[str] = None
filename: str | Path, dataset: str = "/", attribute: Optional[str] = None

Comment on lines +160 to +162
The PyPI-compatible package settings are in [pyproject.toml].

The version number is set in [sleap_io/__init__.py] in the `__version__` variable. This is read automatically by setuptools during installation and build.
The version number is set in [sleap_io/version.py] in the `__version__` variable. This is read automatically by setuptools during installation and build.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the version number setting location to sleap_io/version.py.

- The version number is set in [sleap_io/__init__.py] in the `__version__` variable.
+ The version number is set in [sleap_io/version.py] in the `__version__` variable.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
The PyPI-compatible package settings are in [pyproject.toml].
The version number is set in [sleap_io/__init__.py] in the `__version__` variable. This is read automatically by setuptools during installation and build.
The version number is set in [sleap_io/version.py] in the `__version__` variable. This is read automatically by setuptools during installation and build.
The PyPI-compatible package settings are in [pyproject.toml].
The version number is set in [sleap_io/version.py] in the `__version__` variable. This is read automatically by setuptools during installation and build.

@@ -294,7 +294,7 @@ def filter_and_index(annotations: Iterable[dict], annot_type: str) -> Dict[str,
"""Filter annotations based on the type field and index them by ID.

Args:
annotation: annotations to filter and index
annotations: annotations to filter and index
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct typo in parameter name from annotation to annotations.

-        annotations: annotations to filter and index
+        annotation: annotations to filter and index

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
annotations: annotations to filter and index
annotation: annotations to filter and index


::: sleap_io.load_labelstudio

::: sleap_io.save_labelstudio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure files end with a single newline character.

+ 

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
::: sleap_io.save_labelstudio
::: sleap_io.save_labelstudio

@@ -0,0 +1,29 @@
# Data model

`sleap-io` implements the core data structures used in SLEAP for storing data related to multi-instance pose tracking, including for annotation, training and inference.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence should start with an uppercase letter.

- `sleap-io` implements the core data structures used in SLEAP for storing data related to multi-instance pose tracking, including for annotation, training and inference.
+ `Sleap-io` implements the core data structures used in SLEAP for storing data related to multi-instance pose tracking, including for annotation, training and inference.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
`sleap-io` implements the core data structures used in SLEAP for storing data related to multi-instance pose tracking, including for annotation, training and inference.
`Sleap-io` implements the core data structures used in SLEAP for storing data related to multi-instance pose tracking, including for annotation, training and inference.


::: sleap_io.Track

::: sleap_io.Video
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure files end with a single newline character.

+ 

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
::: sleap_io.Video
::: sleap_io.Video

Comment on lines +16 to +120
For development, use one of the following syntaxes:
```
conda env create -f environment.yml
```
```
pip install -e .[dev]
```

## Usage

### Load and save in different formats

```py
import sleap_io as sio

# Load from SLEAP file.
labels = sio.load_file("predictions.slp")

# Save to NWB file.
sio.save_file(labels, "predictions.nwb")
# Or:
# labels.save("predictions.nwb")
```

### Convert labels to raw arrays

```py
import sleap_io as sio

labels = sio.load_slp("tests/data/slp/centered_pair_predictions.slp")

# Convert predictions to point coordinates in a single array.
trx = labels.numpy()
n_frames, n_tracks, n_nodes, xy = trx.shape
assert xy == 2

# Convert to array with confidence scores appended.
trx_with_scores = labels.numpy(return_confidence=True)
n_frames, n_tracks, n_nodes, xy_score = trx.shape
assert xy_score == 3
```

### Read video data

```py
import sleap_io as sio

video = sio.load_video("test.mp4")
n_frames, height, width, channels = video.shape

frame = video[0]
height, width, channels = frame.shape
```

### Create labels from raw data

```py
import sleap_io as sio
import numpy as np

# Create skeleton.
skeleton = sio.Skeleton(
nodes=["head", "thorax", "abdomen"],
edges=[("head", "thorax"), ("thorax", "abdomen")]
)

# Create video.
video = sio.load_video("test.mp4")

# Create instance.
instance = sio.Instance.from_numpy(
points=np.array([
[10.2, 20.4],
[5.8, 15.1],
[0.3, 10.6],
]),
skeleton=skeleton
)

# Create labeled frame.
lf = sio.LabeledFrame(video=video, frame_idx=0, instances=[instance])

# Create labels.
labels = sio.Labels(videos=[video], skeletons=[skeleton], labeled_frames=[lf])

# Save.
labels.save("labels.slp")
```

## Support
For technical inquiries specific to this package, please [open an Issue](https://github.com/talmolab/sleap-io/issues)
with a description of your problem or request.

For general SLEAP usage, see the [main website](https://sleap.ai).

Other questions? Reach out to `[email protected]`.

## License
This package is distributed under a BSD 3-Clause License and can be used without
restrictions. See [`LICENSE`](https://github.com/talmolab/sleap-io/blob/main/LICENSE) for details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several formatting issues detected: missing blank lines around headings and fenced code blocks, and missing language specification for code blocks.

+ 
+ ```bash
+ ```bash
+ ```bash

@talmo talmo merged commit 01a638b into main Apr 29, 2024
8 of 9 checks passed
@talmo talmo deleted the talmo/docs branch April 29, 2024 05:48
@talmo talmo linked an issue Apr 29, 2024 that may be closed by this pull request
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs
1 participant