Skip to content

Conversation

@meganrm
Copy link
Member

@meganrm meganrm commented Sep 5, 2025

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

@meganrm meganrm changed the title Feature/ingrediate doc Ingredient docstrings and hint types Sep 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2025

Packing analysis report

Analysis for packing results located at cellpack/tests/outputs/test_spheres/spheresSST

Ingredient name Encapsulating radius Average number packed
ext_A 25 236.0

Packing image

Packing image

Distance analysis

Expected minimum distance: 50.00
Actual minimum distance: 50.01

Ingredient key Pairwise distance distribution
ext_A Distance distribution ext_A

@meganrm meganrm requested review from Copilot, mogres and rugeli September 8, 2025 01:02
Copy link

Copilot AI left a 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,
Copy link
Collaborator

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],
Copy link
Collaborator

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.

Copy link
Collaborator

@mogres mogres Sep 15, 2025

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.

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.

4 participants