-
Notifications
You must be signed in to change notification settings - Fork 3
Ingredient docstrings and hint types #380
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
base: documentation/update_docstrings
Are you sure you want to change the base?
Conversation
…mesoscope/cellpack into feature/ingrediate-doc
…mesoscope/cellpack into feature/ingrediate-doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds comprehensive docstrings and type hints to the Ingredient module and related components. The changes focus on improving code documentation and type safety across multiple ingredient-related files while addressing circular import issues and fixing spelling errors in method names and test expectations.
- Adds detailed docstrings to the Ingredient base class and subclasses with parameter descriptions
- Implements type annotations throughout ingredient classes and utility functions
- Fixes circular import issues using forward reference strings for Environment type
- Corrects spelling errors in method names and test assertion strings
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cellpack/autopack/ingredient/Ingredient.py | Comprehensive docstrings and type hints for base Ingredient class |
| cellpack/autopack/ingredient/single_sphere.py | Full documentation and type annotations for SingleSphereIngr class |
| cellpack/autopack/ingredient/agent.py | Added docstrings and type hints to Agent class methods |
| cellpack/autopack/ingredient/utils.py | Type annotations for utility functions |
| cellpack/autopack/ingredient/grow.py | Fixed method name from oneJitter to jitter_once |
| cellpack/autopack/ingredient/single_cylinder.py | Corrected get_cuttoff_value to get_cutoff_value |
| cellpack/autopack/ingredient/multi_cylinder.py | Fixed spelling and added docstring improvements |
| cellpack/autopack/ingredient/single_cube.py | Updated principal_vector default from tuple to list |
| cellpack/autopack/ingredient/multi_sphere.py | Changed principal_vector default type |
| cellpack/tests/test_ingredient.py | Updated test expectation to match new error message format |
| cellpack/tests/test_gradient_data.py | Updated test expectation for error message |
| cellpack/autopack/writers/init.py | Code formatting improvements |
| cellpack/autopack/loaders/recipe_loader.py | Code formatting improvements |
| cellpack/autopack/Graphics.py | Code formatting improvements |
| cellpack/autopack/GeometryTools.py | Code formatting improvements |
| cellpack/autopack/Environment.py | Parameter name fix and type annotation |
| cellpack/autopack/DBRecipeHandler.py | Code formatting improvements |
| cellpack/autopack/Analysis.py | Made env parameter optional with proper handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| def pick_partner_grid_index( | ||
| self, near_by_ingredients, placed_partners, current_packing_position=[0, 0, 0] | ||
| self, | ||
| near_by_ingredients: list, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: type casing might've been missing here?
near_by_ingredients: List[str],
placed_partners: List[List[Any]],
current_packing_position: List[int] = [0, 0, 0],
also line 86 with placed_partners: list
| positions=None, | ||
| positions2=None, | ||
| principal_vector=(1, 0, 0), | ||
| principal_vector=[1, 0, 0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm wondering if we should standardize all directional/3d/rgb values as tuples, that way it's clear they contain exactly three elements and stay immutable. when we need to update/edit the value, just replace the whole tuple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm wondering if we should standardize all directional/3d/rgb values as tuples
I think we want to have at least some of these remain lists, or even better, numpy arrays since we use them in calculating rotations etc. by multiplying them together or performing other mathematical operations on them.

Problem
Add docstrings to the Ingredient module
Solution
So far I worked on Ingredient.py, agent.py, and single_sphere.py.
Some issues I ran into: typing env with Environment created a circlurlar import so I had to use a solution I found on stackoverflow https://stackoverflow.com/a/72324393
Types are inconsistent, it would be nice for instance to always have the rotMat be a np array.
I deleted unused code as I came across it. but there is still a lot of it.
Type of change
Please delete options that are not relevant.
New feature (non-breaking change which adds functionality)
This change requires updated or new tests